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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| collerek | ormar | >= 0.9.9, < 0.23.0 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | ormar | 0.23.0-1 | — |
| Debian 12 | ormar | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | ormar | No fix yet | — |
| Ubuntu 26.04 LTS | ormar | No fix yet | — |
| Ubuntu 25.10 | ormar | No fix yet | — |
| Ubuntu 24.04 LTS | ormar | No fix yet | — |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
GitHub 2 repositories
-
NetVanguard-cmd/CVE-2026-26198 ★ 0 · Apr 19, 2026
-
sergicortesabadia/CVE-2026-26198-analysis ★ 0 · Mar 25, 2026
Deep dive into a critical SQL injection in Python's Ormar ORM — reproduction, fix, and tests
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| PyPI | ormar | >= 0.9.9, < 0.23.0 | 0.23.0 | GHSA-xxh2-68g9-8jqr |