{"id":"CVE-2026-26198","published":"2026-02-24T02:03:47Z","modified":"2026-02-24T20:35:44Z","title":"ormar is vulnerable to SQL Injection through aggregate functions min() and max()","vendor":"collerek","product":"ormar","tier":"tail","description":{"text":"Ormar is a async mini ORM for Python. In versions 0.9.9 through 0.22.0, when performing aggregate queries, Ormar ORM constructs SQL expressions by passing user-supplied column names directly into `sqlalchemy.text()` without any validation or sanitization. The `min()` and `max()` methods in the `QuerySet` class accept arbitrary string input as the column parameter. While `sum()` and `avg()` are partially protected by an `is_numeric` type check that rejects non-existent fields, `min()` and `max()` skip this validation entirely. As a result, an attacker-controlled string is embedded as raw SQL inside the aggregate function call. Any unauthorized user can exploit this vulnerability to read the entire database contents, including tables unrelated to the queried model, by injecting a subquery as the column parameter. Version 0.23.0 contains a patch.","provenance":"source","from":"CVE.org"},"cvss":{"score":9.8,"severity":"CRITICAL","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00829,"percentile":0.54674,"provenance":"source"},"cwes":[{"id":"CWE-89","name":"Improper Neutralization of Special Elements used in an SQL Command"}],"references":[{"url":"https://github.com/collerek/ormar/security/advisories/GHSA-xxh2-68g9-8jqr","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/collerek/ormar/commit/a03bae14fe01358d3eaf7e319fcd5db2e4956b16","tags":["x_refsource_MISC"]},{"url":"https://github.com/collerek/ormar/releases/tag/0.23.0","tags":["x_refsource_MISC"]}],"priority":{"score":22.8,"factors":[{"name":"EPSS percentile","points":10.93},{"name":"Public exploit code","points":5.0},{"name":"CVSS severity","points":6.86}]},"exploitSources":{"pocGithub":{"count":1,"skipped":0,"earliest":"2026-03-25","earliestUrl":"https://github.com/sergicortesabadia/CVE-2026-26198-analysis","repos":[{"name":"sergicortesabadia/CVE-2026-26198-analysis","url":"https://github.com/sergicortesabadia/CVE-2026-26198-analysis","stars":0,"created":"2026-03-25"}]},"first":{"date":"2026-03-25","source":"PoC-in-GitHub","url":"https://github.com/sergicortesabadia/CVE-2026-26198-analysis"},"provenance":"source"},"vendorSlug":"collerek","affectedVersions":[{"vendor":"collerek","product":"ormar","versions":[">= 0.9.9, < 0.23.0"]}],"ssvc":{"exploitation":"poc","automatable":"yes","technicalImpact":"total","timestamp":"2026-02-24T20:29:06.990744Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"ormar","vulnerableRanges":[">=0.9.9, <0.23.0"],"patched":["0.23.0"],"from":["GHSA-xxh2-68g9-8jqr","PYSEC-2026-439"],"provenance":"source"}],"summary":{"text":"A SQL injection flaw in the ormar async Python ORM (collerek) lies in the min() and max() aggregate methods of its QuerySet class, which pass user-supplied column names unvalidated into raw SQL. An unauthenticated remote attacker who can supply the column parameter to these methods can inject a subquery to read the entire database, including tables unrelated to the queried model, with no special configuration or user interaction required.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-21T15:02:22Z"},"euvd":{"id":"EUVD-2026-7409","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2026-26198","published":"2026-02-24","fixed":"0.23.0","kev":false},{"cve":"CVE-2026-27953","published":"2026-03-19","fixed":"0.23.1","kev":false,"link":{"from":"CVE-2026-26198","to":"CVE-2026-27953","relation":"successor","confidence":"medium","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:ormar","fromFixed":"0.23.0","toFixed":"0.23.1","daysApart":23},{"kind":"similar","provenance":"machine","score":0.31,"basis":"same package + description similarity"}]}}],"package":"PyPI:ormar"}}