next/og RCE: SVG Injection Runs Code on Your Server

On September 22, 2026, Vercel shipped an out-of-band security update for Next.js: 16.3.6 (Active LTS) and 15.5.26 (Maintenance LTS). Behind it is CVE-2026-94545, a critical-severity flaw in the ImageResponse path inside next/og. An attacker-controlled value reaches the generated image and is read as SVG markup instead of plain text — and from there it reaches vulnerabilities in other upstream dependencies and ends in remote code execution on the server.

The problem: an OG image is not just an image

Open Graph image generation has become routine. A post title, an author name, a logo — assembled on demand into a card that social platforms render. next/og takes JSX and hands it to Satori, which builds an SVG document before anything becomes a raster image.

The implicit assumption along that path is that the output is "an image": something static and non-executable. That assumption is exactly where it breaks. Between the JSX and the picture sits a full textual stage called SVG, and SVG is markup with escaping rules like any HTML.

What changed

The Satori advisory (GHSA-wx4j-mvgx-mqwp) states it plainly: the library did not properly escape certain values before including them in generated SVG output. Versions 0.0.27 through 0.33.4 are affected; 0.33.5 carries the fix. On its own, Satori rates the issue moderate — CVSS v4 5.3 — because the real impact depends on what consumes the SVG afterwards.

Inside Next.js, that impact grows. The injected value does not stop at a mangled image; it flows into other libraries in the dependency tree, and the end state is code execution. Affected versions are >=16.2.0 <16.3.6, and the fix works by upgrading those upstream dependencies rather than by changing Next.js logic.

Three conditions must hold together: ImageResponse running on the Node.js runtime (the default), invoked through next/og, with an attacker-controlled value reaching SVG content, attributes, or styles.

The risky path in code

This pattern is extremely common — and it is the exact path in question:

tsx
// app/og/route.tsx
import { ImageResponse } from 'next/og'

export async function GET(req: Request) {
  const title = new URL(req.url).searchParams.get('title') ?? 'bahashwan.dev'

  return new ImageResponse(
    <div style={{ display: 'flex', fontSize: 64 }}>{title}</div>,
    { width: 1200, height: 630 },
  )
}

title is the critical line: a query-string value travelling unmediated into the tree Satori turns into SVG. Patch first:

bash
npm install next@16.3.6   # on 16.3
npm install next@15.5.26  # on 15.5 (hardening only)

Then verify what actually resolved in the tree, since the fix arrives through transitive dependencies:

bash
npm ls satori
npm ls next

Real-world caveats

The Edge ImageResponse implementation is not affected, so teams serving image routes on the Edge runtime are outside the blast radius. Next.js 15.x is not affected by the RCE at all; 15.5.26 is precautionary hardening.

The advisory notes there is no complete workaround besides upgrading. Sanitizing inputs narrows the surface but does not close the hole, because the defect lives in the generation stage, not the intake stage.

The point that matters most: this path has been open since Next.js 16.2 shipped on March 18, 2026. So the right question after patching is not "is the version current?" but "did suspicious requests hit the image route during that window?" — and that question is answered from logs, not from package.json. No public exploitation campaigns have been reported so far, which is a working window rather than a reason to defer.

The separately announced Next.js security release scheduled for September 30, 2026 is a different batch; today's upgrade does not replace it.

Takeaway

The engineering lesson outlasts the version number. Any stage that builds structured text from external input — SVG, HTML, SQL, shell — is an escaping boundary, even when the final artifact is a picture. Treat image-generation routes as full input paths: upgrade immediately, bound exactly which values users control, and review logs retroactively.

For the wider rhythm of patching in this project, the scheduled July 2026 security release shows how this work became a regular cycle.

Primary sources: Vercel's September 22, 2026 security update and the Satori advisory.