# GHSA-h97c-qp24-439v: Insecure State Generation in laravel/socialite

> Insecure random state generation in Laravel Socialite allows attackers to bypass OAuth CSRF protections, potentially leading to account takeover.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 15 May 2024

## What is GHSA-h97c-qp24-439v?

GHSA-h97c-qp24-439v is a vulnerability in laravel/socialite, published on 15 May 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

laravel/socialite versions prior to 2.0.9 are found to have an insecure state generation mechanism, potentially exposing the OAuth authentication process to security risks. The issue has been addressed in version 2.0.9 by ensuring that the state is generated using a truly random approach, enhancing the security of the OAuth flow.

## Which versions are affected by GHSA-h97c-qp24-439v?

2 open source packages ship an affected version, including laravel/socialite.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `laravel/socialite` | Packagist | From 1.0.0 | 2.0.9 |
| `laravel/socialite` | Packagist | From 1.0.0 | 2.0.9 |

## How do I fix GHSA-h97c-qp24-439v?

Upgrade laravel/socialite to 2.0.9 or later.

## Is GHSA-h97c-qp24-439v being exploited?

There is no known exploitation of GHSA-h97c-qp24-439v in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-h97c-qp24-439v and fix it if it is affected.

What it is: GHSA-h97c-qp24-439v is a vulnerability in laravel/socialite, published on 15 May 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-h97c-qp24-439v in the wild and no public exploit code.

Affected packages and fixed versions:
- laravel/socialite (Packagist): affected from 1.0.0; fixed in 2.0.9
- laravel/socialite (Packagist): affected from 1.0.0; fixed in 2.0.9

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-h97c-qp24-439v/ (Markdown: https://insights.sbomify.com/GHSA-h97c-qp24-439v/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-h97c-qp24-439v

---
From sbomify Insights: https://insights.sbomify.com/GHSA-h97c-qp24-439v/
Summaries are generated and may contain mistakes; the official description above is the record.
