PortGate

Advisories · Node.js & Next.js

CVE-2026-96889 Critical CVSS 9.5

Next.js image optimizer remote code execution through SVG

Disclosed 14 Oct 2026 · Last reviewed 2 Dec 2026

A memory bug in the SVG library behind sharp lets an attacker run code through Next.js image optimization. The score is CVSS v4.

What happened

Next.js does not render SVG itself. It hands images to sharp, which uses librsvg. A memory-safety flaw there was reachable with an attacker-supplied SVG. The fix raises the bundled sharp to a release with a patched librsvg.

Affected and patched versions

Affected
Self-hosted Next.js before 15.5.28 and 16.x before 16.4.1 on glibc-based Linux, when the image optimizer or next/og processes untrusted SVG files.
Patched
Next.js 15.5.28 and 16.4.1 (14 October 2026), which pull in a patched sharp.

How to check your server

Check

node -p "require('./node_modules/next/package.json').version"
npm ls sharp

How to fix and harden

  1. Run the version check in the app directory.
  2. Upgrade to 15.5.28 on the 15.x line or 16.4.1 on 16.x. Older minors are not patched.
  3. Reinstall dependencies so the new sharp is installed, rebuild and redeploy.
  4. If you cannot upgrade today, stop optimizing remote or user-supplied SVG images.

Fix

npm install [email protected]

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON