{"id":"GHSA-p9j2-gv94-2wf4","revision":"244ee210972a4ba1bc3d5646fad78a8d","records":[{"revision":"244ee210972a4ba1bc3d5646fad78a8d","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"GHSA-p9j2-gv94-2wf4","aliases":["CVE-2026-64645"],"title":"Next.js: Server-Side Request Forgery in rewrites via attacker-controlled destination hostname","description":"## 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\u00A0hostname 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-]+)'`.","state":0,"publishedAt":"2026-07-22T23:02:23+00:00","modifiedAt":"2026-09-10T03:51:11.5546712+00:00","affected":[{"ecosystem":"npm","name":"next","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"12.0.0"},{"kind":"fixed","version":"15.5.21"}]}],"versions":[],"rawVersionEvidence":null},{"ecosystem":"npm","name":"next","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"16.0.0"},{"kind":"fixed","version":"16.2.11"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V4","vector":"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","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"HIGH"}],"references":["https://github.com/vercel/next.js/security/advisories/GHSA-p9j2-gv94-2wf4","https://github.com/vercel/next.js/commit/35f501357e9b0fe7c950b0d6aa8fcf5343f707e9","https://github.com/vercel/next.js/commit/d3033266c6dff23f7be71e19341fe3a8c6e2c599","https://github.com/vercel/next.js","https://github.com/vercel/next.js/releases/tag/v15.5.21","https://github.com/vercel/next.js/releases/tag/v16.2.11"],"sourceUrl":"https://github.com/advisories/GHSA-p9j2-gv94-2wf4","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-p9j2-gv94-2wf4","identifiers":["GHSA-p9j2-gv94-2wf4","CVE-2026-64645"]},"retained":false,"historicalAffected":[]}],"coverage":[]}