CVE-2021-21263: Laravel/framework Query Binding Exploitation Vulnerability
HIGHCVE-2021-21263 is a HIGH (CVSS 7.2) query binding exploitation vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Laravel/framework libraries in the Packagist ecosystem. The issue involves query binding exploitation. Remediation is available by upgrading affected packages to version 8.22.1, 7.30.3, 6.20.12, 6.20.11, 7.30.2.
CVE-2021-21263 at a Glance
Security Impact
CVSS: 7.2
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:C/C:L/I:L/A:N).
How to Fix CVE-2021-21263
To remediate this vulnerability, upgrade all affected Laravel/framework 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 laravel/framework to 8.22.1
Upgrade illuminate/database to 7.30.3
Upgrade illuminate/database to 8.22.1
Upgrade illuminate/database to 6.20.12
Upgrade laravel/framework to 6.20.11
Upgrade laravel/framework to 7.30.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for laravel/framework
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-21263, inspect your project dependencies for Laravel/framework:
inspect dependencies for laravel/framework
Analyze the terminal output to locate any version of Laravel/framework in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.22.1), 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 Laravel/framework, 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-21263 Affected Laravel/framework Versions
6 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
laravel/framework
|
Packagist |
≥ 8.0.0
< 8.22.1
|
8.22.1
|
|
illuminate/database
|
Packagist |
≥ 7.0.0
< 7.30.3
|
7.30.3
|
|
illuminate/database
|
Packagist |
≥ 8.0.0
< 8.22.1
|
8.22.1
|
|
illuminate/database
|
Packagist |
≥ 6.0.0
< 6.20.12
|
6.20.12
|
|
laravel/framework
|
Packagist |
≥ 6.0.0
< 6.20.11
|
6.20.11
|
|
laravel/framework
|
Packagist |
≥ 7.0.0
< 7.30.2
|
7.30.2
|
References
Frequently Asked Questions
What is CVE-2021-21263?
Which Laravel/framework versions are affected?
What version fixes CVE-2021-21263?
Is laravel/framework affected?
Is illuminate/database affected?
What is the CVSS score of CVE-2021-21263?
What CWE is associated with CVE-2021-21263?
How can I check Packagist dependencies for CVE-2021-21263?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-3p32-j457-pg5x",
"modified" : "2021-03-29T17:41:17Z",
"published" : "2021-01-19T19:36:51Z",
"aliases" : [ "CVE-2021-21263" ],
"summary" : "Query Binding Exploitation",
"details" : "### Description\n\nLaravel versions <6.20.12, <7.30.3 & <8.22.1 contain a query binding exploitation.\n\nIf a request is crafted where a field that is normally a non-array value is an array, and that input is not validated or cast to its expected type before being passed to the query builder, an unexpected number of query bindings can be added to the query. In some situations, this will simply lead to no results being returned by the query builder; however, it is possible certain queries could be affected in a way that causes the query to return unexpected results.\n\nThis vulnerability was discovered by Tim Groenevelt (tim.g@foodbyus.com).\n\n### References\n\n- https://github.com/laravel/framework/pull/35865",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "laravel/framework"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "8.0.0"
}, {
"fixed" : "8.22.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "illuminate/database"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.0.0"
}, {
"fixed" : "7.30.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "illuminate/database"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "8.0.0"
}, {
"fixed" : "8.22.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "illuminate/database"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "6.0.0"
}, {
"fixed" : "6.20.12"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "laravel/framework"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "6.0.0"
}, {
"fixed" : "6.20.11"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "laravel/framework"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.0.0"
}, {
"fixed" : "7.30.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/laravel/framework/security/advisories/GHSA-3p32-j457-pg5x"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21263"
}, {
"type" : "WEB",
"url" : "https://github.com/laravel/framework/pull/35865"
}, {
"type" : "WEB",
"url" : "https://blog.laravel.com/security-laravel-62011-7302-8221-released"
}, {
"type" : "WEB",
"url" : "https://blog.laravel.com/security-laravel-62012-7303-released"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/illuminate/database/CVE-2021-21263.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/laravel/framework/CVE-2021-21263.yaml"
}, {
"type" : "WEB",
"url" : "https://packagist.org/packages/illuminate/database"
}, {
"type" : "WEB",
"url" : "https://packagist.org/packages/laravel/framework"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-74", "CWE-89" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-01-19T19:36:31Z",
"nvd_published_at" : "2021-01-19T20:15:00Z"
}
}