A serious security issue in Next.js could allow attackers to run code on a server by sending specially crafted SVG content.
Tracked as CVE-2026-94545, the vulnerability affects the Node.js version of the ImageResponse feature in the next/og package. It can become dangerous when applications use untrusted data inside SVG images.
The issue affects Next.js 16.2.0 through versions before 16.3.6. Developers should upgrade to Next.js 16.3.6, which includes the fix.
How the Attack Can Happen
ImageResponse is commonly used to generate Open Graph images, social media previews, and other graphics directly from a Next.js application.
The problem appears when user-controlled information is placed into SVG content, attributes, or styles during image generation.
For example, an application might take information from a URL parameter, form, or API request and insert it into an SVG before generating an image.
An attacker could send specially crafted input that reaches the vulnerable image-rendering process. If the application is configured in a vulnerable way, this could result in remote code execution on the server.
The potential impact depends on the application’s permissions and what resources the server can access. A compromised environment could potentially expose sensitive information, modify content, disrupt services, or provide access to other connected systems.
Who Is Affected?
Not every Next.js application is vulnerable.
According to the provided advisory information, applications using the Edge implementation of ImageResponse are not affected.
Applications using the Node.js implementation may also be unaffected if they never place attacker-controlled data into SVG content, attributes, or CSS styles.
The vulnerability has been rated Critical and can be exploited remotely without authentication or user interaction.
Update to Next.js 16.3.6
Developers should review applications that generate images through next/og, especially Open Graph image endpoints that accept URL parameters or other external input.
The recommended action is to:
- Upgrade affected Next.js installations to 16.3.6.
- Check image-generation routes for untrusted input.
- Review SVG content, attributes, and styles that use user-controlled data.
- Avoid passing untrusted input directly into SVG processing.
- Review internet-facing image-generation endpoints.
If an immediate upgrade is not possible, removing attacker-controlled input from SVG processing can reduce the risk.
The vulnerability was reported by security researchers RaghavMaheshwari124 and rafabd1. Given that image-generation endpoints can be exposed to the internet, organizations using the affected Node.js ImageResponse implementation should review and patch their applications promptly.