CVE-2019-7548: SQLAlchemy SQL Injection Vulnerability
CRITICALCVE-2019-7548 is a CRITICAL (CVSS 7.8) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting SQLAlchemy libraries in the PyPI ecosystem. The issue involves sqlalchemy is vulnerable to sql injection via group_by parameter. Remediation is available by upgrading affected packages to version 1.2.19.
CVE-2019-7548 at a Glance
Security Impact
CVSS: 7.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2019-7548
To remediate this vulnerability, upgrade all affected SQLAlchemy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install SQLAlchemy>=1.2.19
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show SQLAlchemy
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2019-7548, inspect your installed packages using pip:
pip show SQLAlchemy
Analyze the terminal output to locate any version of SQLAlchemy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.19), your application is affected.
Note: The pip show SQLAlchemy command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In SQLAlchemy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2019-7548 Affected SQLAlchemy Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
SQLAlchemy
|
PyPI |
< 1.2.19
|
1.2.19
|
References
Frequently Asked Questions
What is CVE-2019-7548?
Which SQLAlchemy versions are affected?
What version fixes CVE-2019-7548?
Is SQLAlchemy affected?
What is the CVSS score of CVE-2019-7548?
What CWE is associated with CVE-2019-7548?
How can I check PyPI dependencies for CVE-2019-7548?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-38fc-9xqv-7f7q",
"modified" : "2024-10-28T14:22:48Z",
"published" : "2019-04-16T15:50:39Z",
"aliases" : [ "CVE-2019-7548" ],
"summary" : "SQLAlchemy is vulnerable to SQL Injection via group_by parameter ",
"details" : "SQLAlchemy 1.2.17 has SQL Injection when the group_by parameter can be controlled.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "SQLAlchemy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.2.19"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-7548"
}, {
"type" : "WEB",
"url" : "https://github.com/sqlalchemy/sqlalchemy/issues/4481#issuecomment-461204518"
}, {
"type" : "WEB",
"url" : "https://github.com/sqlalchemy/sqlalchemy/issues/4510"
}, {
"type" : "WEB",
"url" : "https://access.redhat.com/errata/RHSA-2019:0981"
}, {
"type" : "WEB",
"url" : "https://access.redhat.com/errata/RHSA-2019:0984"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-38fc-9xqv-7f7q"
}, {
"type" : "WEB",
"url" : "https://github.com/no-security/sqlalchemy_test"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/sqlalchemy/PYSEC-2019-124.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/sqlalchemy/sqlalchemy"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2019/03/msg00020.html"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2021/11/msg00005.html"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpujan2021.html"
}, {
"type" : "WEB",
"url" : "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00087.html"
}, {
"type" : "WEB",
"url" : "http://lists.opensuse.org/opensuse-security-announce/2019-09/msg00010.html"
}, {
"type" : "WEB",
"url" : "http://lists.opensuse.org/opensuse-security-announce/2019-09/msg00016.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T20:54:34Z",
"nvd_published_at" : "2019-02-06T21:29:00Z"
}
}