CVE-2019-7548: SQL Injection in SQLAlchemy

sqlalchemy Updated 02 Oct 2025

Summary

06/02/2019
Yes i
Critical
7.8

CVE-2019-7548: SQLAlchemy 1.2.17 has SQL Injection when the group_by parameter can be controlled. Affects sqlalchemy versions < 1.2.18. Fixed in 1.2.18. How to fix ↓

Also tracked for

The same CVE-2019-7548 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

SQLAlchemy is a popular Python SQL toolkit and Object-Relational Mapping (ORM) library. It provides a set of high-level API for interacting with databases, allowing developers to write SQL queries in a more Pythonic way. SQLAlchemy is widely used in various Python applications and frameworks.

Vulnerability Detail

The vulnerability identified as CVE-2019-7548 is a SQL Injection vulnerability in SQLAlchemy version 1.2.17. This vulnerability arises when the 'group_by' parameter can be controlled by an attacker. An attacker can exploit this vulnerability to inject malicious SQL code, potentially leading to unauthorized access, data manipulation, or data leakage. The vulnerability was fixed in version 1.2.18 of SQLAlchemy.

How To Fix

Minimum fixed version

1.2.18

This is the first release that contains the fix.

pip install --upgrade "sqlalchemy==1.2.18"

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

Workaround

There is no specific workaround mentioned for this vulnerability. However, as a general best practice, it is recommended to sanitize and validate user input before using it in SQL queries to prevent SQL Injection attacks. Developers should use parameterized queries or prepared statements to ensure that user input is properly escaped and treated as data rather than executable code.

Conclusion

In conclusion, the SQL Injection vulnerability (CVE-2019-7548) in SQLAlchemy version 1.2.17 can be exploited by an attacker to execute arbitrary SQL code. It is crucial to upgrade to version 1.2.18 or later to mitigate this vulnerability. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for sqlalchemy →

Share this vulnerability

FAQ

SQLAlchemy is a Python SQL toolkit and ORM library used for interacting with databases.

SQL Injection is a type of vulnerability where an attacker can manipulate SQL queries to execute arbitrary SQL code, potentially leading to unauthorized access or data manipulation.

This vulnerability in SQLAlchemy can allow an attacker to inject malicious SQL code, potentially leading to unauthorized access, data manipulation, or data leakage in applications that use the affected version.

Yes, the vulnerability has been fixed in SQLAlchemy version 1.2.18.

To protect your application, it is recommended to upgrade SQLAlchemy to version 1.2.18 or later and follow secure coding practices to prevent SQL Injection vulnerabilities.

Related vulnerabilities

Recent vulnerabilities recorded for sqlalchemy.

How To Fix

Minimum fixed version

1.2.18

This is the first release that contains the fix.

pip install --upgrade "sqlalchemy==1.2.18"

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