CVE-2025-57822mediumCWE-918

CVE-2025-57822: medium-severity vulnerability in vercel next.js

Next.js Improper Middleware Redirect Handling Leads to SSRF

Published · Updated

E-mail alert when it lands in KEV, gets a public PoC or its score goes up.

28Vexday Risk Score

Patch soon. It has a working public exploit.

ssvc Attendcvss 6.5epss 2.6%
In short

Next.js middleware in certain versions can inadvertently allow attackers to make requests to internal servers when the next() function is used improperly, potentially exposing sensitive internal resources in self-hosted applications.

Technical detail

When next() is called without explicitly passing the request object in custom middleware, user-supplied headers may be forwarded unsafely in self-hosted environments, enabling Server-Side Request Forgery (SSRF) attacks against internal infrastructure. The vulnerability affects Next.js versions before 14.2.32 and 15.4.7; exploitation requires improper middleware configuration that fails to sanitize or control header propagation.

Summary generated and translated by AI from the official 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.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N
Affected products
vercel · next.js