GHSA-4mg9-vhxq-vm7j SQL Server LIMIT / OFFSET SQL Injection in laravel/framework and illuminate/database
SQL injection vulnerability in Laravel when using SQL Server with user-controlled limit and offset parameters, allowing unauthorized database access.
- Exploited in the wild
- Not known
- Login needed
- Not stated
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is GHSA-4mg9-vhxq-vm7j?
GHSA-4mg9-vhxq-vm7j is a SQL injection vulnerability in illuminate/database, published on 29 Apr 2021. It can be exploited over the network, with no action from the victim.
Official description
Impact
Those using SQL Server with Laravel and allowing user input to be passed directly to the limit and offset functions are vulnerable to SQL injection. Other database drivers such as MySQL and Postgres are not affected by this vulnerability.
Patches
This problem has been patched on Laravel versions 6.20.26, 7.30.5, and 8.40.0.
Workarounds
You may workaround this vulnerability by ensuring that only integers are passed to the limit and offset functions, as well as the skip and take functions.
Which versions are affected by GHSA-4mg9-vhxq-vm7j?
8 open source packages ship an affected version, including illuminate/database and laravel/framework.
| Package | Affected | Fixed in |
|---|---|---|
illuminate/database Packagist | All versions | 6.20.26 |
illuminate/database Packagist | All versions | 6.20.26 |
illuminate/database Packagist | From 8.0.0 | 8.40.0 |
illuminate/database Packagist | From 8.0.0 | 8.40.0 |
laravel/framework Packagist | All versions | 6.20.26 |
laravel/framework Packagist | All versions | 6.20.26 |
2 more packages
laravel/framework Packagist | From 8.0.0 | 8.40.0 |
laravel/framework Packagist | From 8.0.0 | 8.40.0 |
How do I fix GHSA-4mg9-vhxq-vm7j?
Upgrade illuminate/database to a fixed version for your release line: 6.20.26 or 8.40.0.
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 GHSA-4mg9-vhxq-vm7j being exploited?
There is no known exploitation of GHSA-4mg9-vhxq-vm7j in the wild and no public exploit code.