A critical vulnerability in Next.js could allow an unauthenticated attacker to execute code on servers that generate images from untrusted SVG data. Tracked as CVE-2026-94545, the issue affects the Node.js implementation of ImageResponse in the next/og package, a feature commonly used to build Open Graph cards and other dynamic preview graphics.
The vulnerable range begins with Next.js 16.2.0 and includes releases before 16.3.6. The fixed version is 16.3.6. While the weakness does not affect every Next.js site, it creates a high-impact path on applications that combine the affected server-side renderer with values supplied by visitors.
How a preview image becomes an execution path
Modern applications often generate social-media images on demand. A route may accept a page title, username, product label, or campaign name from a query string and place it into SVG markup before rendering the final image. That pattern becomes dangerous when the renderer processes specially crafted input without a safe boundary.
According to the security advisory summarized by Cyber Security News, the underlying rendering component contains an upstream flaw. Attacker-controlled material placed in SVG elements, attributes, or CSS styles may trigger the condition. A malicious request can therefore reach the image-generation process without requiring an account or any action from another user.
Successful exploitation could give an intruder code execution in the server context handling the request. From there, the real damage depends on deployment design: the process may be able to read environment variables, reach internal services, use cloud credentials, alter application content, or pivot into build and hosting infrastructure.
Which Next.js deployments are exposed
The distinction between the Node.js and Edge implementations is important. The advisory says the Edge version of ImageResponse is not affected. A Node.js deployment is also not automatically exploitable merely because it uses the package; the risky condition requires untrusted values to reach SVG content, attributes, or styles.
Security teams should focus first on internet-facing routes that produce Open Graph or social preview images. These endpoints are easy to enumerate and are frequently designed to accept URL parameters. Code searches for ImageResponse, next/og, dynamic SVG construction, and request-derived values can quickly identify likely exposure.
Patch first, then reduce renderer privileges
Developers should upgrade affected applications to Next.js 16.3.6 and redeploy every running instance, including preview, staging, and forgotten regional workloads. Updating a lockfile without rebuilding the deployed artifact is not enough. Teams should verify the installed package version from the actual production image or runtime.
- Inventory all server-side image-generation routes and their input sources.
- Remove user-controlled data from SVG elements, attributes, and styles where possible.
- Rotate secrets if logs show suspicious requests to vulnerable routes.
- Restrict the image worker’s network access, filesystem permissions, and cloud identity.
- Monitor image endpoints for encoded SVG fragments, unusual errors, and process spawning.
If an immediate upgrade is impossible, temporarily disabling affected routes or replacing dynamic content with fixed templates is safer than relying solely on validation. SVG and CSS parsing are complex, and blocklists often miss alternative encodings or syntax.
Why this deserves urgent attention
The advisory rates the vulnerability Critical under CVSS 4.0 because exploitation can occur remotely, without authentication or user interaction, while potentially affecting confidentiality, integrity, and availability. Public image routes also provide attackers with a repeatable surface that can be scanned at scale.
CVE-2026-94545 is a reminder that media-generation features execute substantial parsing logic on the server. Treating them as cosmetic can hide their real privilege. Organizations should patch promptly, but they should also isolate renderers so that a future flaw cannot automatically inherit access to production secrets and internal systems.
Leave a Reply
You must be logged in to post a comment.