medium6.5
CVE-2025-57822
Next.js Improper Middleware Redirect Handling Leads to SSRF
Impact
A vulnerability in **Next.js Middleware** has been fixed in **v14.2.32** and **v15.4.7**. The issue occurred when request headers were directly passed into `NextResponse.next()`. In self-hosted applications, this could allow Server-Side Request Forgery (SSRF) if certain sensitive headers from the incoming request were reflected back into the response. All users implementing custom middleware logic in self-hosted environments are strongly encouraged to upgrade and verify correct usage of the `next()` function. More details at [Vercel Changelog](https://vercel.com/changelog/cve-2025-57822)
Affected packages
| Ecosystem | Package | Affected | Fixed in |
|---|---|---|---|
| npm | next | >= 15.0.0-canary.0, < 15.4.7 | 15.4.7 |
Affected products
| Vendor | Product | Affected versions |
|---|---|---|
| Vercel | Next.Js | before 14.2.32 from 15.0.0 before 15.4.7 |
Weakness classification
References
- NVD record
- CVE.org record
- GitHub advisory
- https://github.com/vercel/next.js/commit/9c9aaed5bb9338ef31b0517ccf0ab4414f2093d8
- https://github.com/vercel/next.js/security/advisories/GHSA-4342-x723-ch2f
- https://vercel.com/changelog/cve-2025-57822
- https://github.com/advisories/GHSA-4342-x723-ch2f
- https://nvd.nist.gov/vuln/detail/CVE-2025-57822