Skip to content
OpenAdvisories
Critical · 9.8 Public exploit CVE-2026-26198 EUVD-2026-7409GHSA-xxh2-68g9-8jqrPYSEC-2026-439

ormar is vulnerable to SQL Injection through aggregate functions min() and max()

Published Feb 24, 2026 · Updated Feb 24, 2026 · 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.

Affected products

VendorProductAffectedFixed
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.

ReleasePackageFixed inAdvisory
Debian 14 ormar 0.23.0-1 —
Debian 12 ormar No fix yet —
ReleasePackageFixed inAdvisory
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.

Third-party code, not reviewed by us. Public PoCs are sometimes fake or contain malware. Read the code first and run it only in an isolated lab, against systems you are authorised to test.

GitHub 2 repositories

Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI ormar >= 0.9.9, < 0.23.0 0.23.0 GHSA-xxh2-68g9-8jqr

References