Critical Next.js ImageResponse Vulnerability Enables Server Code Execution

Next.js has patched a serious security issue in its ImageResponse feature that could allow attackers to execute code on a vulnerable server via manipulated SVG input. The flaw affected versions 16.2.0 through 16.3.5 when running the Node.js runtime—used by default—and carried a critical severity rating (CVSS 9.5). The fix is included in version 16.3.6, released on September 22. Version 15 remains unaffected. ImageResponse instances running on the Edge runtime are not exposed to this risk either.

ImageResponse is widely used to generate social preview images and Open Graph graphics. It relies on the Satori library to parse layout into SVG, which is then converted into final image formats like PNG. The vulnerability emerges when values derived from untrusted sources—such as parts of a request URL—are injected into SVG content, attributes or style definitions without proper escaping. In such cases, specially crafted input may bypass sanitization and be interpreted as executable SVG rather than plain text.

How the Vulnerability Works & Which Setups Are Affected

Any Next.js app that uses ImageResponse from next/og in a route handler or in a file meant to serve Open Graph images is potentially exposed—if it inserts attacker-controlled text into any component of the SVG (content, attributes, or styles). The flaw was specific to the Node.js runtime. Apps running Edge—or using Next.js version 15—escape SVG content more rigorously and thus don’t expose the same risk. The vulnerability stems from Satori, whose own advisory confirms that certain inputs reach its SVG output without sufficient escaping. Developers using Satori directly are advised to update to version 0.33.5.

While there are no confirmed public exploit instances yet and no published proof-of-concept code as of September 23, the potential is clear for attackers to gain remote code execution via vulnerable ImageResponse endpoints. The advisory also covers non-Satori Next.js dependencies that might be abused due to this vulnerability, though the specific libraries are not identified.

Remediation & Prevention Steps

The immediate recommended action is to upgrade to Next.js 16.3.6. If an app is still on version 16.2.x, an upgrade to 16.3.6 is required since no fix exists in the older branch. For users on the 15.5 line, Next.js 15.5.26 introduces enhanced hardening for next/og. In the interim, developers should avoid inserting untrusted values into SVG content, attributes, or styles when using ImageResponse under Node.js. Switching to the Edge runtime isn’t suggested as a long-term mitigation, especially since the Edge runtime is marked deprecated in the Next.js docs.

There’s also no current way to assess whether any servers have already been compromised via this flaw. The versions 16.2–16.3.5 have been public since March 18, in which period services might have been affected. Tools like npm audit do not currently flag impacted versions, and the GitHub Advisory Database has yet to formally list CVE-2026-94545.

Why this matters: web applications rely heavily on dynamic image generation for social sharing, marketing and SEO. A vulnerability like this bypasses what many developers assume is a safer SVG-to-image pipeline. Beyond ImageResponse, any feature that converts layouts or uses SVG internally should be carefully audited. Watch for upcoming patches—not just for Next.js or Satori, but for libraries further down the stack. If you maintain any dynamic image generation, review how you handle untrusted input.