# GHSA-qm5c-m76r-2hfr: Laravel RCE vulnerability in "cookie" session driver

> Attackers can achieve remote code execution by exploiting an encryption oracle to craft malicious session payloads in applications using the cookie session driver.

- **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-qm5c-m76r-2hfr?

GHSA-qm5c-m76r-2hfr is an unsafe deserialization 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

Applications using the "cookie" session driver that were also exposing an encryption oracle via their application were vulnerable to remote code execution. An encryption oracle is a mechanism where arbitrary user input is encrypted and the encrypted string is later displayed or exposed to the user. This combination of scenarios lets the user generate valid Laravel signed encryption strings for any plain-text string, thus allowing them to craft Laravel session payloads when an application is using the "cookie" driver.

## Which versions are affected by GHSA-qm5c-m76r-2hfr?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `laravel/framework` | Packagist | From 4.1.0 | 6.18.31 |
| `laravel/framework` | Packagist | From 4.1.0 | 6.18.31 |
| `laravel/framework` | Packagist | From 7.0.0 | 7.22.4 |
| `laravel/framework` | Packagist | From 7.0.0 | 7.22.4 |

## How do I fix GHSA-qm5c-m76r-2hfr?

Upgrade laravel/framework to a fixed version for your release line: 6.18.31 or 7.22.4.

## Is GHSA-qm5c-m76r-2hfr being exploited?

There is no known exploitation of GHSA-qm5c-m76r-2hfr in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-qm5c-m76r-2hfr and fix it if it is affected.

What it is: GHSA-qm5c-m76r-2hfr is an unsafe deserialization 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-qm5c-m76r-2hfr in the wild and no public exploit code.

Affected packages and fixed versions:
- laravel/framework (Packagist): affected from 4.1.0; fixed in 6.18.31
- laravel/framework (Packagist): affected from 4.1.0; fixed in 6.18.31
- laravel/framework (Packagist): affected from 7.0.0; fixed in 7.22.4
- laravel/framework (Packagist): affected from 7.0.0; fixed in 7.22.4

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-qm5c-m76r-2hfr/ (Markdown: https://insights.sbomify.com/GHSA-qm5c-m76r-2hfr/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-qm5c-m76r-2hfr

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