# CVE-2026-26198: ormar is vulnerable to SQL Injection through aggregate functions min() and max()

- Severity: Critical 9.8 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.00%, higher than 63% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-02-23T22:12:17.000Z
- Modified: 2026-11-16T16:00:05.782Z
- Also known as: GHSA-xxh2-68g9-8jqr, PYSEC-2026-439
- Weaknesses: CWE-89
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- collerek ormar: >= 0.9.9, < 0.23.0; from 0.9.9 before 0.23.0
- ormar (PyPI): from 0.9.9 before 0.23.0

## Every score

- GitHub_M: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- GitHub: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`
- PyPA Advisory Database: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://github.com/collerek/ormar/security/advisories/GHSA-xxh2-68g9-8jqr> (exploit, vendor-advisory, web)
- <https://github.com/collerek/ormar/commit/a03bae14fe01358d3eaf7e319fcd5db2e4956b16> (patch, web)
- <https://github.com/collerek/ormar/releases/tag/0.23.0> (product, release-notes, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-26198> (advisory)
- <https://github.com/collerek/ormar> (package)
- <https://github.com/pypa/advisory-database/tree/main/vulns/ormar/PYSEC-2026-439.yaml> (web)
- <https://pypi.org/project/ormar> (package, web)
- <https://github.com/advisories/GHSA-xxh2-68g9-8jqr> (advisory)

## Sources

- CVE List: [CVE-2026-26198](https://www.cve.org/CVERecord?id=CVE-2026-26198), CVE Terms of Use, modified 2026-02-24
- GitHub Advisory Database: [GHSA-xxh2-68g9-8jqr](https://github.com/advisories/GHSA-xxh2-68g9-8jqr), CC-BY-4.0, modified 2026-11-16
- NVD: [CVE-2026-26198](https://nvd.nist.gov/vuln/detail/CVE-2026-26198), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2026-439](https://osv.dev/vulnerability/PYSEC-2026-439), CC-BY-4.0, modified 2026-07-13

---

Page: https://cve.day/CVE-2026-26198 · Whole record: https://cve.day/CVE-2026-26198.json · Rebuilt by cve.day 2026-11-25T22:59:14.699Z
