CVE-2012-0805: SQL Injection Vulnerabilities in SQLAlchemy

sqlalchemy Updated 02 Oct 2025

Summary

05/06/2012
Yes i
Critical
9.8

CVE-2012-0805: Multiple SQL injection vulnerabilities in SQLAlchemy before 0.7.0b4, as used in Keystone, allow remote attackers to execute arbitrary SQL commands via the (1) limit or (2) offset keyword to the select function, or unspec... Affects sqlalchemy versions < 0.7.0. Fixed in 0.7.0. How to fix ↓

Also tracked for

The same CVE-2012-0805 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

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

SQLAlchemy is a Python SQL toolkit and Object-Relational Mapping (ORM) library that provides a set of high-level API for interacting with databases. It is widely used in various Python applications and frameworks. However, versions prior to 0.7.0b4 of SQLAlchemy are vulnerable to multiple SQL injection attacks. These vulnerabilities can be exploited by remote attackers to execute arbitrary SQL commands.

Vulnerability Detail

The SQL injection vulnerabilities in SQLAlchemy are caused by improper input sanitization in the select function's 'limit' and 'offset' keywords, as well as the 'select.limit' and 'select.offset' functions. An attacker can manipulate these parameters to inject malicious SQL commands, potentially leading to unauthorized data access, data manipulation, or even remote code execution.

How To Fix

Minimum fixed version

0.7.0

This is the first release that contains the fix.

pip install --upgrade "sqlalchemy==0.7.0"

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

Workaround

If upgrading SQLAlchemy is not immediately feasible, developers can implement input validation and sanitization measures to mitigate the risk of SQL injection attacks. It is crucial to properly validate and sanitize user-supplied input before using it in SQL queries. This can be achieved by using parameterized queries or prepared statements, which separate the SQL code from the user input.

Conclusion

SQLAlchemy versions prior to 0.7.0b4 are vulnerable to SQL injection attacks. It is crucial for developers to upgrade to the latest patched version or implement proper input validation and sanitization measures to protect their applications. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for sqlalchemy →

Share this vulnerability

FAQ

SQLAlchemy is a Python SQL toolkit and Object-Relational Mapping (ORM) library that provides a set of high-level API for interacting with databases.

Versions of SQLAlchemy prior to 0.7.0b4 are affected by these SQL injection vulnerabilities.

These vulnerabilities can allow remote attackers to execute arbitrary SQL commands, potentially leading to unauthorized data access, data manipulation, or even remote code execution.

To fix these vulnerabilities, it is recommended to upgrade SQLAlchemy to version 0.7.0b4 or later. Alternatively, developers can implement input validation and sanitization measures to mitigate the risk of SQL injection attacks.

If upgrading SQLAlchemy is not immediately feasible, developers can implement input validation and sanitization measures to mitigate the risk of SQL injection attacks.

Related vulnerabilities

Recent vulnerabilities recorded for sqlalchemy.

How To Fix

Minimum fixed version

0.7.0

This is the first release that contains the fix.

pip install --upgrade "sqlalchemy==0.7.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