Server-side Request Forgery (SSRF) Affecting next package, versions >=12.0.0 <15.5.21>=16.0.0 <16.2.11


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Server-side Request Forgery (SSRF) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-NEXT-18233752
  • published23 Jul 2026
  • disclosed22 Jul 2026
  • creditsajdakabir

Introduced: 22 Jul 2026

NewCVE-2026-64645  (opens in a new tab)
CWE-918  (opens in a new tab)

How to fix?

Upgrade next to version 15.5.21, 16.2.11 or higher.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via the prepareDestination rewrite/redirect handling in packages/next/src/shared/lib/router/utils/prepare-destination.ts. An attacker can make the application proxy a request to an arbitrary hostname by supplying crafted path or query values that are substituted into an external rewrites() or redirects() destination hostname. When a destination hostname is built from request-controlled input, Next.js accepts the attacker-chosen host instead of the configured suffix, causing rewrites to fetch and serve content from the attacker’s target host and redirects to send users there. This can expose internal services to SSRF or send users to unintended destinations.

Workarounds

  • Do not build the hostname of an external rewrites() or redirects() destination from user-controlled input.
  • If you must use a dynamic subdomain in a rewrites() rule, constrain the capture to hostname-safe characters, for example value: '(?<region>[a-z0-9-]+)'.

CVSS Base Scores

version 4.0
version 3.1