Critical Next.js ImageResponse Flaw Exposes Servers to Code Execution Risks
A critical vulnerability in Next.js ImageResponse could allow server code execution via crafted SVG input, prompting urgent updates.
- Topic
- Next.js
- Reading time
- 5 min
- Length
- 461 words
- Published
- Sep 24, 2026
05:34 pm IST
In this article
Introduction
A newly discovered security vulnerability in Next.js has raised significant concerns among developers and organisations using the framework. This flaw, identified in the ImageResponse feature, poses a risk of allowing attackers to execute arbitrary code on servers through specially crafted SVG input. Vercel, the company behind Next.js, has issued a fix, but the implications of this vulnerability warrant close attention.
Details of the Vulnerability
The vulnerability, tracked as CVE-2026-94545, affects Next.js versions 16.2.0 through 16.3.5 when the ImageResponse feature operates on the Node.js runtime. This feature is primarily used for generating Open Graph and other social preview images. Vercel has rated the severity of this flaw as critical, assigning it a CVSS score of 9.5.
The issue arises when applications incorporate values controlled by attackers, such as text extracted from request URLs, into SVG content during image generation. The flaw was addressed in the release of Next.js version 16.3.6 on September 22, 2026.
Key Highlights
- The vulnerability allows for potential server code execution via crafted SVG input.
- Affects Next.js versions 16.2.0 to 16.3.5 using the Node.js runtime.
- Critical rating with a CVSS score of 9.5.
- Fixed in Next.js version 16.3.6.
- Workaround involves avoiding attacker-controlled values in SVG content.
Understanding the Impact
According to Vercel's advisory, the flaw specifically impacts applications that pass attacker-controlled values into SVG content, attributes, or styles during the image generation process. For instance, if an application takes a value from the request URL and places it within an SVG title element, it becomes vulnerable to exploitation. However, the advisory does not clarify whether values in standard HTML elements, such as headings within a div, are also at risk.
Identifying Affected Applications
Developers can identify where their applications utilise the ImageResponse feature by searching for imports from next/og, typically found in route handlers and opengraph-image files. These route handlers generate images upon receiving requests, while opengraph-image files can create images either at build time or on request.
Mitigation and Recommendations
As of September 23, 2026, The Hacker News has not identified any public reports of attacks exploiting this vulnerability, nor has any public exploit code been released. The only patched version available is Next.js 16.3.6, which can be installed using the command npm install next@16.3.6. Applications still running on version 16.2 must upgrade to 16.3.6 to mitigate the risk.
For those unable to upgrade immediately, Vercel recommends a workaround: ensure that attacker-controlled values are excluded from SVG content, attributes, and styles rendered by the Node.js ImageResponse.
Additional Security Measures
Next.js version 15.5.26 also introduces enhanced security hardening for the next/og module. Developers should consider updating to this version if they are using the 15.x line.
Conclusion
The discovery of the critical vulnerability in Next.js's ImageResponse feature underscores the importance of maintaining up-to-date software and implementing robust security practices. Developers are urged to review their applications for potential vulnerabilities and apply the necessary updates to safeguard against potential exploits.