CVE-2021-21263 Query Binding Exploitation in Laravel
Attackers can manipulate query bindings by passing arrays instead of expected types, potentially causing SQL queries to return unexpected results.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-21263?
CVE-2021-21263 is a high-severity SQL injection vulnerability in laravel framework, published on 19 Jan 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Laravel is a web application framework. Versions of Laravel before 6.20.11, 7.30.2 and 8.22.1 contain a query binding exploitation. This same exploit applies to the illuminate/database package which is used by Laravel. If 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.
Which versions are affected by CVE-2021-21263?
13 open source packages ship an affected version, including laravel/framework, laravel and illuminate/database. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
laravel/framework Packagist | From 6.0.0 | 6.20.11 |
laravel/framework Packagist | From 6.0.0 | 6.20.11 |
laravel/framework Packagist | From 7.0.0 | 7.30.2 |
laravel/framework Packagist | From 7.0.0 | 7.30.2 |
laravel/framework Packagist | From 8.0.0 | 8.22.1 |
laravel/framework Packagist | From 8.0.0 | 8.22.1 |
7 more packages
laravel Bitnami | From 6.0.0 | 6.20.11, 7.30.2, 8.22.1 |
illuminate/database Packagist | From 6.0.0 | 6.20.12 |
illuminate/database Packagist | From 6.0.0 | 6.20.12 |
illuminate/database Packagist | From 7.0.0 | 7.30.3 |
illuminate/database Packagist | From 7.0.0 | 7.30.3 |
illuminate/database Packagist | From 8.0.0 | 8.22.1 |
illuminate/database Packagist | From 8.0.0 | 8.22.1 |
Products include Laravel Laravel.
How do I fix CVE-2021-21263?
Upgrade laravel/framework to a fixed version for your release line: 6.20.11, 7.30.2 or 8.22.1.
Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.
Is CVE-2021-21263 being exploited?
There is no known exploitation of CVE-2021-21263 in the wild and no public exploit code.
Other vulnerabilities in laravel framework
Sources
Also known as BIT-laravel-2021-21263, CLSA-2026-1774486145, DEBIAN-CVE-2021-21263, GHSA-3p32-j457-pg5x.