CVE-2026-64645: Next Server-Side Request Forgery Vulnerability

HIGH
Advisory Identifier: GHSA-p9j2-gv94-2wf4
CWE-918
Published
Advisory Summary

CVE-2026-64645 is a HIGH server-side request forgery vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Next libraries in the npm ecosystem. The issue involves server-side request forgery in rewrites via attacker-controlled destination hostname. Remediation is available by upgrading affected packages to version 15.5.21, 16.2.11.

CVE-2026-64645 at a Glance

CVE Identifier CVE-2026-64645
GHSA Identifier GHSA-p9j2-gv94-2wf4
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product Next
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-64645

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.

next fixed: 15.5.21
npm install next@15.5.21
next fixed: 16.2.11
npm install next@16.2.11
Verify Direct and Transitive Dependencies

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-2026-64645, 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 15.5.21), 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

## 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-]+)'`.

CVE-2026-64645 Affected Next Versions

2 component(s)
Fixed Versions:
15.5.2116.2.11
Product / Package Ecosystem Affected Versions Fixed Version
next
npm
≥ 12.0.0
< 15.5.21
15.5.21
next
npm
≥ 16.0.0
< 16.2.11
16.2.11

References

Frequently Asked Questions

What is CVE-2026-64645?
CVE-2026-64645 is a security vulnerability in Next involving Server-Side Request Forgery in rewrites via attacker-controlled destination hostname under CWE-918: Server-Side Request Forgery (SSRF).
Which Next versions are affected?
Affected versions include releases prior to 15.5.21, 16.2.11 across affected packages: next.
What version fixes CVE-2026-64645?
Upgrading to 15.5.21, 16.2.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is next affected?
Yes, next is affected in releases prior to 15.5.21, 16.2.11. Upgrade your dependency to 15.5.21, 16.2.11 or later.
What CWE is associated with CVE-2026-64645?
CVE-2026-64645 is classified under CWE-918: Server-Side Request Forgery (SSRF) (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.).
How can I check npm dependencies for CVE-2026-64645?
Run the dependency tree command: 'npm ls next'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-p9j2-gv94-2wf4",
  "modified" : "2026-07-22T23:02:23Z",
  "published" : "2026-07-22T23:02:23Z",
  "aliases" : [ "CVE-2026-64645" ],
  "summary" : "Next.js: Server-Side Request Forgery in rewrites via attacker-controlled destination hostname",
  "details" : "## Impact\n\nA `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.\n\nThis affects any destination that puts a dynamic segment in the hostname, whether from the path:\n\n```javascript\n// next.config.js\nmodule.exports = {\n  async rewrites() {\n    return [\n      {\n        source: '/:tenant',\n        destination: 'https://:tenant.api.example.com',\n      },\n    ]\n  },\n}\n```\n\nor from a `has` capture:\n\n```javascript\n// next.config.js\nmodule.exports = {\n  async rewrites() {\n    return [\n      {\n        source: '/',\n        has: [{ type: 'query', key: 'region', value: '(?<region>.+)' }],\n        destination: 'https://:region.api.example.com',\n      },\n    ]\n  },\n}\n```\n\n## Workarounds\n\nIf 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-]+)'`.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "next"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "12.0.0"
      }, {
        "fixed" : "15.5.21"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "next"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "16.0.0"
      }, {
        "fixed" : "16.2.11"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vercel/next.js/security/advisories/GHSA-p9j2-gv94-2wf4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vercel/next.js/commit/35f501357e9b0fe7c950b0d6aa8fcf5343f707e9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vercel/next.js/commit/d3033266c6dff23f7be71e19341fe3a8c6e2c599"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vercel/next.js"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vercel/next.js/releases/tag/v15.5.21"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vercel/next.js/releases/tag/v16.2.11"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-22T23:02:23Z",
    "nvd_published_at" : null
  }
}