6.5medium
Next.js Improper Middleware Redirect Handling Leads to SSRF
- Severity
- 6.5medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 2.85% (higher than 87% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-4342-x723-ch2f
Description
Next.js is a React framework for building full-stack web applications. Prior to versions 14.2.32 and 15.4.7, when next() was used without explicitly passing the request object, it could lead to SSRF in self-hosted applications that incorrectly forwarded user-supplied headers. This vulnerability has been fixed in Next.js versions 14.2.32 and 15.4.7. All users implementing custom middleware logic in self-hosted environments are strongly encouraged to upgrade and verify correct usage of the next() function.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| vercel next.js | < 14.2.32, < 15.4.7, before 14.2.32, from 15.0.0 before 15.4.7 | CVE List, NVD |
| next (npm) | from 0.9.9 before 14.2.32, from 15.0.0-canary.0 before 15.4.7 | GitHub Advisory Database |
All scores
| GitHub_M | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N |
| GitHub | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N |
| NVD | 8.2high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
Next.js is a React framework for building full-stack web applications. Prior to versions 14.2.32 and 15.4.7, when next() was used without explicitly passing the request object, it could lead to SSRF in self-hosted applications that incorrectly forwarded user-supplied headers. This vulnerability has been fixed in Next.js versions 14.2.32 and 15.4.7. All users implementing custom middleware logic in self-hosted environments are strongly encouraged to upgrade and verify correct usage of the next() function.
GitHub Advisory Database
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
NVD (es)
Next.js es un React framework para construir aplicaciones web full-stack. Antes de las versiones 14.2.32 y 15.4.7, cuando se utilizaba next() sin pasar explícitamente el objeto de solicitud, podría conducir a SSRF en aplicaciones autoalojadas que reenviaban incorrectamente los encabezados proporcionados por el usuario. Esta vulnerabilidad ha sido corregida en las versiones 14.2.32 y 15.4.7 de Next.js. Se recomienda encarecidamente a todos los usuarios que implementan lógica de middleware personalizada en entornos autoalojados actualizar y verificar el uso correcto de la función next().
References
| https://github.com/vercel/next.js/security/advisories/GHSA-4342-x723-ch2f | vendor-advisory, web | |
| https://github.com/vercel/next.js/commit/9c9aaed5bb9338ef31b0517ccf0ab4414f2093d8 | patch, web | |
| https://vercel.com/changelog/cve-2025-57822 | mitigation, vendor-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2025-57822 | advisory | |
| https://github.com/vercel/next.js | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-57822 changed 2025-09-02 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-4342-x723-ch2f changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2025-57822 changed 2026-10-18 | Public domain |