CVE-2021-43608: Doctrine/dbal SQL Injection Vulnerability
CRITICALCVE-2021-43608 is a CRITICAL (CVSS 9.8) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Doctrine/dbal libraries in the Packagist ecosystem. The issue involves dbal 3 sql injection security vulnerability. Remediation is available by upgrading affected packages to version 3.1.4.
CVE-2021-43608 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-43608
To remediate this vulnerability, upgrade all affected Doctrine/dbal dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade doctrine/dbal to 3.1.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for doctrine/dbal
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-43608, inspect your project dependencies for Doctrine/dbal:
inspect dependencies for doctrine/dbal
Analyze the terminal output to locate any version of Doctrine/dbal in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.4), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
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 Doctrine/dbal, 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-2021-43608 Affected Doctrine/dbal Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
doctrine/dbal
|
Packagist |
≥ 3.0.0
< 3.1.4
|
3.1.4
|
References
Frequently Asked Questions
What is CVE-2021-43608?
Which Doctrine/dbal versions are affected?
What version fixes CVE-2021-43608?
Is doctrine/dbal affected?
What is the CVSS score of CVE-2021-43608?
What CWE is associated with CVE-2021-43608?
How can I check Packagist dependencies for CVE-2021-43608?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-r7cj-8hjg-x622",
"modified" : "2021-12-16T14:11:44Z",
"published" : "2021-11-16T17:25:57Z",
"aliases" : [ "CVE-2021-43608" ],
"summary" : "DBAL 3 SQL Injection Security Vulnerability",
"details" : "We have released a new version Doctrine DBAL 3.1.4 that fixes a critical SQL injection vulnerability in the LIMIT clause generation API provided by the Platform abstraction.\n\nWe advise everyone using Doctrine DBAL 3.0.0 up to 3.1.3 to upgrade to 3.1.4 immediately.\n\nThe vulnerability can happen when unsanitized input is passed to many APIs in Doctrine DBAL and ORM that ultimately end up calling `AbstractPlatform::modifyLimitQuery`. \n\nAs a workaround you can cast all limit and offset parameters to integers before passing them to Doctrine APIs.\n\nThis vulnerability has been assigned [CVE-2021-43608](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-43608).\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "doctrine/dbal"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.1.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/doctrine/dbal/security/advisories/GHSA-r7cj-8hjg-x622"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43608"
}, {
"type" : "WEB",
"url" : "https://github.com/doctrine/dbal/commit/9dcfa4cb6c03250b78a84737ba7ceb82f4b7ba4d"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/doctrine/dbal/CVE-2021-43608.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/doctrine/dbal"
}, {
"type" : "WEB",
"url" : "https://github.com/doctrine/dbal/releases"
}, {
"type" : "WEB",
"url" : "https://www.doctrine-project.org/2021/11/11/dbal3-vulnerability-fixed.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2021-11-15T22:34:32Z",
"nvd_published_at" : "2021-12-09T20:15:00Z"
}
}