# GHSA-wq8p-mqvg-2p5h: laravel framework SQL Injection via limit and offset functions

> SQL injection vulnerability in Laravel when using SQL Server with user-controlled limit and offset parameters, allowing attackers to read or modify database data.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 May 2024

## What is GHSA-wq8p-mqvg-2p5h?

GHSA-wq8p-mqvg-2p5h is a SQL injection vulnerability in laravel/framework, published on 15 May 2024. An attacker can exploit it over the internet without logging in, 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-wq8p-mqvg-2p5h?

6 open source packages ship an affected version, including laravel/framework.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `laravel/framework` | Packagist | From 6.0.0 | 6.20.26 |
| `laravel/framework` | Packagist | From 6.0.0 | 6.20.26 |
| `laravel/framework` | Packagist | From 7.0.0 | 7.30.5 |
| `laravel/framework` | Packagist | From 7.0.0 | 7.30.5 |
| `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-wq8p-mqvg-2p5h?

Upgrade laravel/framework to a fixed version for your release line: 6.20.26, 7.30.5 or 8.40.0.

## Is GHSA-wq8p-mqvg-2p5h being exploited?

There is no known exploitation of GHSA-wq8p-mqvg-2p5h in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-wq8p-mqvg-2p5h and fix it if it is affected.

What it is: GHSA-wq8p-mqvg-2p5h is a SQL injection vulnerability in laravel/framework, published on 15 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-wq8p-mqvg-2p5h in the wild and no public exploit code.

Affected packages and fixed versions:
- laravel/framework (Packagist): affected from 6.0.0; fixed in 6.20.26
- laravel/framework (Packagist): affected from 6.0.0; fixed in 6.20.26
- laravel/framework (Packagist): affected from 7.0.0; fixed in 7.30.5
- laravel/framework (Packagist): affected from 7.0.0; fixed in 7.30.5
- laravel/framework (Packagist): affected from 8.0.0; fixed in 8.40.0
- laravel/framework (Packagist): affected from 8.0.0; fixed in 8.40.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-wq8p-mqvg-2p5h/ (Markdown: https://insights.sbomify.com/GHSA-wq8p-mqvg-2p5h/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-wq8p-mqvg-2p5h

---
From sbomify Insights: https://insights.sbomify.com/GHSA-wq8p-mqvg-2p5h/
Summaries are generated and may contain mistakes; the official description above is the record.
