SQL Injection Vulnerability in Laravel Framework

laravel/framework Updated 02 Oct 2025

Summary

15/05/2024
HIGH
Yes i
High
Not published

GHSA-wq8p-mqvg-2p5h: laravel framework SQL Injection via limit and offset functions. Affects laravel/framework across 3 version ranges.

>= 6.0.0, < 6.20.26 >= 7.0.0, < 7.30.5 >= 8.0.0, < 8.40.0

Fixed in 6.20.26, 7.30.5 or 8.40.0, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The Laravel framework is a popular PHP framework used for developing web applications. It provides a robust set of tools and features for building secure and scalable applications. However, a vulnerability has been discovered in the framework that affects the SQL Server database driver. When user input is directly passed to the limit and offset functions, it can lead to SQL injection attacks. It's important to note that this vulnerability does not affect other database drivers such as MySQL and Postgres.

Vulnerability Detail

The SQL injection vulnerability in Laravel allows an attacker to manipulate the SQL queries executed by the application. By injecting malicious SQL code, an attacker can bypass authentication, access unauthorized data, modify or delete data, and potentially gain full control over the database. This vulnerability can have severe consequences for the confidentiality, integrity, and availability of the application and its data.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 6.0.0, < 6.20.26 6.20.26
    composer require laravel/framework:6.20.26
  • >= 7.0.0, < 7.30.5 7.30.5
    composer require laravel/framework:7.30.5
  • >= 8.0.0, < 8.40.0 8.40.0
    composer require laravel/framework:8.40.0

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If you are unable to immediately update to the patched versions of Laravel, you can implement a workaround by ensuring that only integers are passed to the limit and offset functions, as well as the skip and take functions. This can be done by validating and sanitizing user input before using it in these functions. Here's an example of how to sanitize user input using Laravel's built-in validation:

$request->validate([
    'limit' => 'integer',
    'offset' => 'integer',
]);

$limit = (int) $request->input('limit');
$offset = (int) $request->input('offset');

$results = DB::table('table')
    ->limit($limit)
    ->offset($offset)
    ->get();

Conclusion

The SQL injection vulnerability in the Laravel framework can have serious consequences for the security and integrity of your application. It is crucial to update to the patched versions of Laravel or implement the provided workaround to mitigate the risk. If you need further assistance or support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for laravel/framework →

Share this vulnerability

FAQ

The vulnerability allows attackers to execute arbitrary SQL queries, potentially bypassing authentication, accessing unauthorized data, modifying or deleting data, and gaining control over the database.

The vulnerability affects Laravel versions 6.x, 7.x, and 8.x. However, only those using the SQL Server database driver are vulnerable. MySQL and Postgres database drivers are not affected.

At the time of this advisory, there are no known public exploits specifically targeting this vulnerability. However, it is important to patch or implement the workaround as soon as possible to mitigate the risk.

No, there is no CVE assigned to this vulnerability at the moment.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Simply upload your composer.lock file to the playground, and it will analyze the dependencies and alert you if any vulnerabilities are found.

Related vulnerabilities

Recent vulnerabilities recorded for laravel/framework.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 6.0.0, < 6.20.26 6.20.26
    composer require laravel/framework:6.20.26
  • >= 7.0.0, < 7.30.5 7.30.5
    composer require laravel/framework:7.30.5
  • >= 8.0.0, < 8.40.0 8.40.0
    composer require laravel/framework:8.40.0

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback