CVE-2026-26198: Ormar ORM SQL Injection Vulnerability via Aggregate Functions

ormar Updated 24 Feb 2026

Summary

23/02/2026
Yes i
Critical
9.8

CVE-2026-26198: ormar is vulnerable to SQL Injection through aggregate functions min() and max(). Affects ormar versions >= 0.9.9, < 0.23.0. Fixed in 0.23.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Ormar is an asynchronous ORM (Object-Relational Mapping) library for Python that simplifies database interactions by allowing developers to work with Python objects instead of SQL queries. It is built on top of SQLAlchemy and is designed to be user-friendly, providing features such as automatic schema generation, validation, and support for various database backends. However, a critical vulnerability has been identified in versions 0.9.9 to 0.22.0, which allows for SQL injection through the min() and max() aggregate functions, potentially exposing sensitive data.

Vulnerability Detail

The vulnerability arises from the way Ormar handles user-supplied input in aggregate queries. Specifically, the min() and max() methods accept arbitrary string input as column parameters without proper validation or sanitization. This allows an attacker to inject malicious SQL code, leading to unauthorized access to the database. The affected code constructs SQL expressions using sqlalchemy.text() directly with user input, making it susceptible to SQL injection attacks. As a result, attackers can execute arbitrary SQL queries, read sensitive data, and compromise the integrity of the database.

How To Fix

Latest published version: 0.26.0 as of 23 Oct 2026

pip install --upgrade "ormar==0.26.0"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.23.0

This is the first release that contains the fix.

pip install --upgrade "ormar==0.23.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, avoid using the min() and max() methods with user-controlled input. Instead, implement server-side validation to ensure that only valid column names are accepted. For example, you can create a whitelist of acceptable column names and check user input against this list before executing any aggregate queries.

Conclusion

The SQL injection vulnerability in Ormar ORM through the min() and max() aggregate functions poses a significant risk to applications using affected versions. It is crucial to update to the patched version 0.23.0 or later to safeguard against potential data breaches. Implementing input validation can serve as a temporary measure to mitigate risks until the update is applied.

See every vulnerability recorded for ormar →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 9.8, indicating a critical level of severity.

Versions 0.9.9 to 0.22.0 of Ormar are affected by this SQL injection vulnerability.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.

Exploitation of this vulnerability can lead to unauthorized access to sensitive data, including user credentials and other confidential information stored in the database.

Yes, you can implement server-side validation to restrict user input to known safe column names, effectively mitigating the risk of SQL injection.

Related vulnerabilities

Recent vulnerabilities recorded for ormar.

How To Fix

Latest published version: 0.26.0 as of 23 Oct 2026

pip install --upgrade "ormar==0.26.0"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.23.0

This is the first release that contains the fix.

pip install --upgrade "ormar==0.23.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback