CVE-2025-57822
Next.js Improper Middleware Redirect Handling Leads to SSRF
Record summary
CVE-2025-57822 has a selected CVSS score of 6.5 (medium); EIP currently links 1 Nuclei template.
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.
Exploitation context
Available material
- Nuclei templates
- 1
CISA SSVC decision
CISA Coordinator · SSVC 2.0.3 · Evaluated Sep 2, 2025 · Source: CVE List
Affected products and versions
2| Product | Source | Version range | Status |
|---|---|---|---|
next.jsBrowse vercel / next.js | CVE List | < 14.2.32 | affected |
| < 15.4.7 | affected | ||
| GitHub Advisory | 0.9.9 to < 14.2.32 · Fixed in 14.2.32 | affected | |
| 15.0.0-canary.0 to < 15.4.7 · Fixed in 15.4.7 | affected |
Nuclei templates
1ProjectDiscoveryMEDIUMNext.js Middleware - Server-Side Request ForgeryCVSS 6.5
In Next.js prior to versions 14.2.32 and 15.4.7, when request headerswere insecurely passed to NextResponse.next(), an attacker could exploit this behavior to perform Server-Side Request Forgery (SSRF) attacks.
Impact
Attackers can manipulate request headers to perform SSRF attacks by forcing the server to make requests to arbitrary internal or external URLs when middleware passes headers unsafely.
Remediation
Upgrade Next.js to version 14.2.32, 15.4.7, or later that properly validates and sanitizes request headers in NextResponse.next().
Source: ProjectDiscovery