Next.js has Server-Side Request Forgery in Image OptimizationGHSA-cjq9-62q9-8jv4
MEDIUMFix: vercel/next.js@e002ad6GHSA-cjq9-62q9-8jv4 is a medium-severity (CVSS 6.5) Server-Side Request Forgery (SSRF) vulnerability in next. A fix is available for next — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-cjq9-62q9-8jv4.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
GHSA-cjq9-62q9-8jv4 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 394,803 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
nextnpmDescription
Next.js is a React framework for building full-stack web applications. From 16.0.0 until 16.3.8, Image Optimization can follow attacker-controlled DNS resolution for a remote URL that matches images.remotePatterns, allowing the optimized image fetch to reach private IP addresses after the URL passes the allow-list check. Applications without images.remotePatterns are not affected. Administrators unable to upgrade should audit allow-listed hosts and avoid entries whose DNS records are not trusted. This issue is fixed in version 16.3.8.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | next | ≥ 16.0.0&&< 16.3.8 | 16.3.8npm install next@16.3.8 |
Affected Products
next.jsvercelDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for next, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update next to 16.3.8 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-cjq9-62q9-8jv4 is resolved across your whole dependency graph.
Workarounds
Restrict outbound requests from the affected component to an allowlist of hosts, block access to link-local and internal address ranges at the network layer, and require authentication on internal services so a forged request cannot reach them unauthenticated.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This vulnerability is rated with a Low severity because exploitation requires a specific, non-default configuration where the application explicitly permits remote domains whose DNS records can be controlled or manipulated by an external adversary. In typical Red Hat deployments, Next.js is not exposed with arbitrary…
Audit and restrict the `images.remotePatterns` configuration in `next.config.js` to eliminate untrusted hostnames, or remove the `remotePatterns` configuration entirely if external image fetching is not required. Additionally, egress network filtering can be enforced to prevent application containers or hosts from reaching private network ranges. Caveats: Disabling or removing remote image entries will prevent external image optimization. Warning: Modifying application configuration requires restarting the affected container or service, which will temporarily interrupt service availability.Source: Red Hat security advisory for GHSA-cjq9-62q9-8jv4 (CC BY 4.0)
Frequently Asked Questions
Is GHSA-cjq9-62q9-8jv4 in your dependencies?
Find it across npm, including transitive dependencies.