Ormar
CVE-2026-26198
CRITICAL
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft malicious column name parameter
-
ExploitPass to min()/max() QuerySet methods
-
ExecutionInject SQL into sqlalchemy.text()
-
ImpactExecute arbitrary SQL commands
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Parameterized queries, prepared statements
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Persistence The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Ormar ORM versions 0.9.9 through 0.22.0 with min() or max() aggregate query methods called with unsanitized user input. No authentication required; default installations vulnerable to remote SQL injection via application endpoints accepting column parameters. |
| Impact | CVSS 9.8. ORM-level SQL injection is particularly dangerous because developers trust the ORM to handle SQL safety. |
| Exploit ScenarioDerived | Attacker sends crafted input that reaches an Ormar aggregate query, injecting SQL that bypasses the ORM's parameterization and directly manipulates the database. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Mar 12, 2026
SQL injection in Ormar async ORM for Python versions 0.9.9 through 0.22.0. Aggregate queries pass unsanitized input to SQL, enabling database compromise through the ORM abstraction. PoC and patch available.
Earlier versions of this analysis (1)
SQL injection through aggregate queries in Ormar Python ORM.
RemediationAI
Update Ormar beyond 0.22.0. Review all aggregate query usage for user-controlled inputs.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
CWE-89 SQL injection in ORM aggregate functions. The ORM fails to properly parameterize inputs in aggregate query construction, bypassing the ORM's intended SQL safety.
Know when Ormar gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Primary rating from GitHub Advisory · only source for this CVE.
CVSS VectorGitHub Advisory
Lifecycle Timeline
3DescriptionGitHub Advisory
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.
Executive ViewAI
Ormar ORM versions 0.9.9 through 0.22.0 contain a critical SQL injection vulnerability in aggregate query functions that allows unauthenticated attackers to execute arbitrary SQL commands and compromise databases. Any organization using affected Ormar versions in production applications faces immediate risk of data theft, manipulation, or system compromise.
Apply vendor patch. If immediate patching is not possible: (1) Disable aggregate query functionality at the application layer, (2) Implement database-level query monitoring and alerting for suspicious SQL patterns, (3) Restrict database user permissions to minimum required privileges, (4) Deploy WAF rules to detect SQL injection attempts in application inputs, (5) Segment affected systems from critical assets.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
GHSA-xxh2-68g9-8jqr
NVD
CVE.org
EPSS
Exploit-DB