CVE-2026-64645: Next.js: Server-Side Request Forgery in rewrites via attacker-controlled destination hostname

Published Jul 22, 2026
·
Updated

Impact

A rewrites() or redirects() rule that builds its external destination hostname from request-controlled input can be pointed at an arbitrary hostname, regardless of the rule's hostname suffix. For a rewrite, Next.js proxies the request to that arbitrary host and serves the response from the application's origin, leading to Server-Side Request forgery. A redirects() rule configured this way is vulnerable to an Open Redirect.

This affects any destination that puts a dynamic segment in the hostname, whether from the path:

javascript // next.config.js module.exports = { async rewrites() { return [ { source: '/:tenant', destination: 'https://:tenant.api.example.com', }, ] }, }

or from a has capture:

javascript // next.config.js module.exports = { async rewrites() { return [ { source: '/', has: [{ type: 'query', key: 'region', value: '(?<region>.+)' }], destination: 'https://:region.api.example.com', }, ] }, }

Workarounds

If you cannot upgrade immediately, do not build the hostname of an external rewrites() or redirects() destination from user-controlled input. If a dynamic subdomain is required, constrain the value to hostname-safe characters: value: '(?<region>[a-z0-9-]+)'.

Other sources

Next.js is a React framework for building full-stack web applications. In versions 12.0.0 through 15.5.20 and 16.0.0 through 16.2.10, a rewrites() or redirects() rule that builds its external destination hostname from request-controlled input can be pointed at an arbitrary hostname, regardless of the rule's hostname suffix. For a rewrite, Next.js proxies the request to that arbitrary host and serves the response from the application's origin, leading to Server-Side Request forgery. A redirects() rule configured this way is vulnerable to an Open Redirect. This issue has been fixed in versions 15.5.21 and 16.2.11.

MITRE

Affected Software

4 affected componentsFixes available
npm/next>=16.0.0<16.2.11
16.2.11
npm/next>=12.0.0<15.5.21
15.5.21
Vercel Next.js Node.js>=12.0.0<15.5.21
Vercel Next.js Node.js>=16.0.0<16.2.11

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/next to a version that resolves this vulnerability.

    Fixed in 16.2.11
  2. Upgrade

    Upgrade npm/next to a version that resolves this vulnerability.

    Fixed in 15.5.21
  3. Upgrade

    Upgrade Next.js to a version that resolves this vulnerability.

    Fixed in 15.5.21
  4. Upgrade

    Upgrade Next.js to a version that resolves this vulnerability.

    Fixed in 16.2.11
  5. Configuration

    If a dynamic subdomain is required, constrain the value used in the external destination hostname to hostname-safe characters (e.g., use a capture regex such as `value: '(?<region>[a-z0-9-]+)'`).

    Next.js rewrites()/redirects() rules destination hostname construction from request-controlled input = Constrain dynamic subdomain values to hostname-safe characters using a capture like '(?<region>[a-z0-9-]+)'
  6. Compensating control

    If you cannot upgrade immediately, do not build the external destination hostname for a `rewrites()` or `redirects()` rule from user-controlled input (avoid using request-controlled segments/captures to form an external destination hostname).

Event History

Jul 22, 2026
Advisory Published
via GitHub·11:02 PM
Data Sourced
via GitHub·11:02 PM
DescriptionWeaknessAffected Software
Jul 27, 2026
CVE Published
via MITRE·05:37 PM
Data Sourced
via MITRE·05:37 PM
DescriptionWeakness
Data Sourced
via NVD·06:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-64645?

The severity of CVE-2026-64645 is rated at 71.

2

What type of vulnerability is CVE-2026-64645?

CVE-2026-64645 is classified as a Server-Side Request Forgery (SSRF) vulnerability.

3

How do I fix CVE-2026-64645?

To fix CVE-2026-64645, validate and sanitize input used in `rewrites()` and `redirects()` rules to prevent arbitrary hostname targeting.

4

What software is affected by CVE-2026-64645?

CVE-2026-64645 affects the Next.js framework, specifically versions available through npm.

5

When was CVE-2026-64645 published?

CVE-2026-64645 was published on July 22, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203