CVE-2025-57822: Next Next.js Improper Middleware Redirect Handling Vulnerability
MODERATECVE-2025-57822 is a MODERATE (CVSS 6.5) next.js improper middleware redirect handling vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Next libraries in the npm ecosystem. The issue involves next.js improper middleware redirect handling leads to ssrf. Remediation is available by upgrading affected packages to version 14.2.32, 15.4.7.
CVE-2025-57822 at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N).
How to Fix CVE-2025-57822
To remediate this vulnerability, upgrade all affected Next dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install next@14.2.32
npm install next@15.4.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls next
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-57822, inspect your project dependencies using npm:
npm ls next
Analyze the terminal output to locate any version of Next in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 14.2.32), your application is affected.
Note: The npm ls next command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In Next, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-57822 Affected Next Versions
2 component(s)References
Frequently Asked Questions
What is CVE-2025-57822?
Which Next versions are affected?
What version fixes CVE-2025-57822?
Is next affected?
What is the CVSS score of CVE-2025-57822?
What CWE is associated with CVE-2025-57822?
How can I check npm dependencies for CVE-2025-57822?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4342-x723-ch2f",
"modified" : "2025-09-11T15:41:02Z",
"published" : "2025-08-29T21:33:09Z",
"aliases" : [ "CVE-2025-57822" ],
"summary" : "Next.js Improper Middleware Redirect Handling Leads to SSRF",
"details" : "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.\n\nAll users implementing custom middleware logic in self-hosted environments are strongly encouraged to upgrade and verify correct usage of the `next()` function.\n\nMore details at [Vercel Changelog](https://vercel.com/changelog/cve-2025-57822)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "next"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.9.9"
}, {
"fixed" : "14.2.32"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "next"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "15.0.0-canary.0"
}, {
"fixed" : "15.4.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/vercel/next.js/security/advisories/GHSA-4342-x723-ch2f"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-57822"
}, {
"type" : "WEB",
"url" : "https://github.com/vercel/next.js/commit/9c9aaed5bb9338ef31b0517ccf0ab4414f2093d8"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/vercel/next.js"
}, {
"type" : "WEB",
"url" : "https://vercel.com/changelog/cve-2025-57822"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-918" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-08-29T21:33:09Z",
"nvd_published_at" : "2025-08-29T22:15:32Z"
}
}