SQL Server LIMIT / OFFSET SQL Injection in laravel/framework and illuminate/database
Published 29 Apr 2021 · Updated 2 Dec 2024
Affected packages
- Affected
- >=8.0.0 <8.40.0
- Fixed in
- 8.40.0
composer require laravel/framework:^8.40.0- Affected
- <6.20.26
- Fixed in
- 6.20.26
composer require laravel/framework:^6.20.26- Affected
- >=8.0.0 <8.40.0
- Fixed in
- 8.40.0
composer require illuminate/database:^8.40.0- Affected
- <6.20.26
- Fixed in
- 6.20.26
composer require illuminate/database:^6.20.26Details
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.
Is GHSA-4mg9-vhxq-vm7j in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected laravel/framework, and gives you the command that fixes it.
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.