Next.js Vulnerability Risks Server Code Execution via ImageResponse
Share
A critical vulnerability in the Next.js ImageResponse feature could allow attackers to execute code on a server via specially crafted SVG input, Vercel has warned.
The flaw, tracked as CVE-2026-94545, has been assigned a CVSS severity score of 9.5. The risk specifically affects applications that use the feature to generate social media preview images, such as Open Graph images, and pass attacker-controlled values into the SVG content.
Technical Breakdown of the Flaw
The vulnerability originates in Satori, a library bundled within Next.js that converts layout designs into SVG code before they are rendered as PNG images. According to Vercel, certain values can reach the SVG output without being properly escaped.
If an application takes data controlled by a user—such as text extracted from a request URL—and places it into an SVG element, attribute, or style, an attacker can inject malicious SVG code. This injected code can then interact with other libraries used by Next.js to achieve remote code execution (RCE) on the host server.
Affected Versions and Scope
The vulnerability impacts Next.js versions 16.2.0 through 16.3.5 when the application is running on the Node.js runtime. Developers using the Edge runtime version of ImageResponse are not affected, and Next.js 15 is also considered secure from this specific flaw.
While the bug is rooted in Satori, the impact is magnified within the Next.js environment, potentially allowing an attacker to compromise the entire server running the application.
Remediation and Mitigation
Vercel has released a patch to address the issue. Developers are advised to upgrade to Next.js version 16.3.6 immediately. For those currently using the 16.2 version line, an upgrade to 16.3.6 is the recommended path to ensure security.
Additionally, Next.js 15.5.26 includes extra security hardening for the next/og module. If an immediate upgrade is not possible, the current mitigation is to ensure that no attacker-controlled or unvalidated values are passed into SVG content, attributes, or styles during the image generation process.




Leave a Reply