Remote code execution in next/og ImageResponse
Original title: Next.js: Remote Code Execution in next/og ImageResponse
What happens
The Node.js ImageResponse implementation in next/og inherits an upstream vulnerability (satori). If an application passes attacker-controlled values into SVG content, attributes or styles while generating an image, an attacker can run code on the server.
Who is affected
- Routes that build images with
ImageResponsefromnext/ogon the Node.js runtime and put request values (query, body, headers) into the SVG. - Not affected: the Edge
ImageResponseimplementation, or apps that put no attacker-controlled values into the SVG.
Affected and fixed versions
| Affected | Fixed in |
|---|---|
>= 16.2.0, < 16.3.6 | 16.3.6 |
What to do
- Upgrade Next.js to the fixed version in the table below.
- If you cannot upgrade yet: do not pass attacker-controlled values into SVG content, attributes or styles rendered by the Node.js
ImageResponse.
Check yourself
- Find the uses:
grep -rn "next/og" app src pages. - For each route: does it have
export const runtime = "edge", and which SVG values come from therequest?
Sources
- GitHub Advisory Database GHSA-vcvr-r3jv-pc5j
- vercel/next.js GHSA-vcvr-r3jv-pc5j
- vercel/satori GHSA-wx4j-mvgx-mqwp
Rewritten from the original advisory; versions from the GitHub Advisory Database (CC-BY-4.0), updated 2026-10-29. Where they differ, the original advisory wins.