Next.js CVE-2026-96889: a remote code flaw in self-hosted image optimization
In October 2026 Next.js published an advisory for a flaw that lets an attacker run code on a self-hosted server without logging in. The bug sits in librsvg, a library that renders SVG images, and is reached through the Next.js Image Optimization API. If you host Next.js yourself on Linux, check your versions today.
- CVE
CVE-2026-96889 - SeverityCVSS 9.5 Critical
- ProductNext.js (self-hosted)
What happened
Next.js can resize and convert images on the fly. It does this with the sharp package, which uses librsvg for SVG files. NVD describes CVE-2026-96889 as a use-after-free in librsvg and rates it 7.8 under CVSS 3.1. The Next.js advisory, GHSA-2464-fhr4-w9xw, says the bug is in an upstream library used for image optimization and delivers the fix through sharp.
Both describe the same CVE. Put simply: it is a librsvg flaw, and Next.js image optimization makes it reachable from the internet. That is why Vercel and GitHub rate it higher, at 9.5 under CVSS 4.0.
The flaw is not in the CISA catalog of exploited vulnerabilities. There are reports of proof-of-concept code, but they are not confirmed.
Who is affected
| Next.js version | Vulnerable | Recommended version |
|---|---|---|
| 10.0.0 to 15.5.27 | Yes | 15.5.29 or later |
| 16.0.x to 16.4.0 | Yes | 16.4.5 or later |
| 15.5.28 and 16.4.1 to 16.4.4 | Fixed for this CVE | 15.5.29 or 16.4.5 or later |
The flaw affects self-hosted Next.js on glibc-based Linux that uses image optimization with SVG. It is not confirmed whether the dangerouslyAllowSVG setting must be on, or whether apps hosted on Vercel are exposed. Check the advisory for the current answer.
The recommended versions, 15.5.29 and 16.4.5, were released on 3 November 2026. They carry more fixes, including GHSA-673q-mjm6-r5xr, a use cache flaw that is also rated 9.5.
How to check your app
Run these where the app runs: on the server or inside the container. The first command shows the Next.js and sharp versions, the second shows whether the system uses glibc.
npm ls next sharp
ldd --version
# In a Docker image
docker run --rm <your-image> sh -c 'npm ls next sharp; ldd --version'How to fix it
- Update Next.js to 15.5.29, 16.4.5 or later.
- Make sure
sharpis at 0.35.5 or later. Runnpm ls sharpto find nested copies. - Update the librsvg package from your Linux distribution, because it is a system library too.
- Commit the updated lockfile, rebuild your Docker images on an updated base image, and redeploy.
- Run
npm ls next sharpagain inside the running container to confirm.
If you cannot upgrade Next.js today
Vercel gives one workaround:
- Make sure
sharpis at version 0.35.5 or later, and redeploy. - Our suggestion: if your site does not need SVG through image optimization, do not serve SVG files through it until you upgrade.
What to look for
If a self-hosted app ran a vulnerable version, check for signs of compromise: unknown processes run by the Node user, new files in the app, cache or temp directories, unexpected outbound connections, and changed secrets. A web application penetration test covers image optimization and other Next.js features. Next.js apps with the App Router should also check for React2Shell.
Questions
My site is hosted on Vercel. Am I affected?
That is not confirmed. Check the Next.js advisory, and update Next.js anyway as part of normal maintenance.
Is updating Next.js enough?
Update sharp and the librsvg system package as well. Then rebuild and redeploy your images so the new libraries are in use.
Is there working attack code for this flaw?
There are reports of proof-of-concept code, but they are not confirmed, and the flaw is not in the CISA catalog. Do not wait for that: update now.
This article is written for defenders and contains no exploit code. It reflects the vendor advisories on the date above; always check the vendor advisory for the latest fixed versions.
Not sure whether you are affected?
We check your servers and applications for this vulnerability and others like it, and give you a clear report with fixes.