Next.js Shipped 17 Security Fixes in 5 Weeks. Is Your App Patched?
Two critical RCEs in October, seven more fixes on November 3. Which ones hit your app, how to get to 16.4.5, and a script to check it in CI.
CarnielOn this page16 sections
On October 6, Next.js 16.4 made Cache Components the default for every new app created with create-next-app. Eight days later, the Next.js team shipped an emergency patch for a critical bug in that same feature: a use cache function could be used to run code on your server without logging in (Next.js blog).
That fix came with a second critical one, in how Next.js handles SVG images. Then on November 3, seven more fixes landed (Next.js blog). Add the seven from the September 30 release (Next.js blog) and that's 17 security fixes in about five weeks.
If you've been putting off upgrades because "it's just a patch version", this is the post to read. Here's what was fixed, which ones actually affect your app, and how to make sure you're covered.
The short version
The safe versions right now are 16.4.5 on the 16 line and 15.5.29 on the 15 line. Anything older is missing at least one fix.
npm install next@16.4.5 # on Next.js 16
npm install next@15.5.29 # on Next.js 15If you're on 16.0 to 16.3, there is no patched release on your line. Only 16.4 gets fixes, so move to 16.4.5. If you're on Next.js 14 or older, the SVG bug reaches all the way back to version 10, and those versions get no more fixes.
Then redeploy. Upgrading package.json does nothing for the version running on your server until you ship it.
October 14: the two critical ones
Remote code execution in use cache
This one affects App Router apps with Cache Components turned on. When a use cache function returns more than one typed array (like Uint8Array), an attacker with no account could run code on your server. It's rated Critical (GHSA-673q-mjm6-r5xr).
Two things make it worse than it sounds:
There's no workaround. You can't switch something off to be safe. You have to upgrade.
The Next.js team says to upgrade even if none of your functions return typed arrays. Don't spend an afternoon searching your code for
Uint8Arrayand decide you're fine.
The root cause is in React's Server Components code, and React patched it too (GHSA-xqc2-xf4c-x3h3). But Next.js ships its own copy of that code inside the next package, so upgrading react alone doesn't fix a Next.js app. You need the new next.
Remote code execution through SVG images
Next.js uses a library called sharp to resize and convert images. sharp uses another library, librsvg, to read SVG files. A memory bug in librsvg meant a crafted SVG could run code on your server (CVE-2026-96889).
You're exposed if your app runs on glibc-based Linux (Debian, Ubuntu, and most node:*-slim Docker images) and SVGs reach sharp. Next.js doesn't optimize SVGs by default, so the clearest risk is if you set images.dangerouslyAllowSVG: true or use next/og on the Node.js runtime (The Hacker News).
The fix lives in sharp 0.35.5. Hold on to that detail, because it matters for the November fixes too.
Denial of service through Server Actions
The third October fix is rated High rather than Critical. A crafted request to any App Router app with at least one Server Action could push the CPU so hard that the process stops handling other requests (GHSA-p3m5-59mp-jv5r). One request, and your site stops answering. Pages Router apps and apps without Server Actions aren't affected.
This isn't the first time. A similar Server Components denial-of-service bug was patched in April, in 16.2.3 (CVE-2026-23869). Rate limiting can soften the hit, but it doesn't fix the bug.
November 3: seven more
All seven are rated Medium except one High. None of them let an attacker run code. Most are about one user seeing another user's data, which can be just as bad for a real product:
Three cache mix-ups in
use cache. In certain setups, cached content made for one tenant, site or locale could be served to another. One of them, rated High, happens when the sameuse cachefunction is called both directly and insideunstable_cache. Another involves passing binary data (like a buffer) as an argument, where two different values could end up with the same cache key.Shared shell poisoning in self-hosted apps running
next startwith Cache Components on and Partial Prefetching off. A crafted URL could make other pages render wrong content or a lasting 404.Cookie values leaking through an internal header in Edge routes that set cookies with
NextResponse.cookies.set(). EvenHttpOnlycookies could be read by JavaScript on the same site.Responses sent to the wrong client in a specific self-hosted setup behind an HTTP/1.1 reverse proxy.
An SVG check that could be tricked. More on this one below.
Why the SVG bypass matters
After the October SVG bug, a common piece of advice was: "If you never set dangerouslyAllowSVG to true, SVGs never reach sharp, so you're fine."
The November release shows that wasn't fully true. An image from an allowed source could be disguised as an AVIF file, slip past dangerouslyAllowSVG: false, and still be decoded as SVG (GHSA-7qx7-33qx-rqx2). The advisory says this on its own doesn't prove code execution. But put it next to an unpatched librsvg and the "SVGs are off" wall had a door in it.
The lesson: config settings are not a substitute for patched dependencies. Make sure sharp is on 0.35.5 or later no matter how your images are configured.
A pattern worth noticing
Of the 17 fixes since September 30, seven involve use cache or Cache Components. That's not a reason to avoid them. I'm still a fan of use cache, and I wrote a whole guide to it.
But it is new code, and new code gets the most security attention in its first months. If you've adopted Cache Components, or created an app with create-next-app since 16.4, you can't sit on old versions. Staying current is part of the price.
Check your app in one minute
Start with what's actually installed, not what package.json says:
npm ls next sharpYou want next at 16.4.5 or 15.5.29 or later, and every copy of sharp at 0.35.5 or later.
Don't trust npm audit alone
npm audit now flags the October issues. But at the time of writing (November 5), running it on a fresh project with next@16.4.4 reports found 0 vulnerabilities, even though the November 3 advisories affect that version. The audit database can lag behind new advisories. One of the seven November issues doesn't even have an advisory ID yet.
A small script you can run in CI
This script checks the version of next and the copy of sharp that Next.js itself loads, which isn't always the one at the top of your node_modules. It needs no packages. Save it in your project as check-next-security.mjs:
// check-next-security.mjs
// Run from your project root: node check-next-security.mjs
import { createRequire } from "node:module";
import fs from "node:fs";
import path from "node:path";
const require = createRequire(path.join(process.cwd(), "package.json"));
// Lowest safe version on each supported line (November 3, 2026 release)
const SAFE = { "16.4": "16.4.5", "15.5": "15.5.29" };
const SAFE_SHARP = "0.35.5";
const parse = (v) => v.split("-")[0].split(".").map(Number);
const atLeast = (v, min) => {
const a = parse(v), b = parse(min);
for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return a[i] > b[i];
return true;
};
let failed = false;
const nextPkgPath = require.resolve("next/package.json");
const nextVersion = require(nextPkgPath).version;
const line = nextVersion.split(".").slice(0, 2).join(".");
const safeNext = SAFE[line];
if (!safeNext) {
console.log(`✗ next ${nextVersion}: this line gets no more security fixes. Move to ${SAFE["16.4"]}.`);
failed = true;
} else if (!atLeast(nextVersion, safeNext)) {
console.log(`✗ next ${nextVersion}: upgrade to ${safeNext} or later.`);
failed = true;
} else {
console.log(`✓ next ${nextVersion}`);
}
// Check the sharp that Next.js itself loads, not just the one at the top level
try {
let dir = path.dirname(createRequire(nextPkgPath).resolve("sharp"));
while (!fs.existsSync(path.join(dir, "package.json"))) dir = path.dirname(dir);
const sharpVersion = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8")).version;
if (atLeast(sharpVersion, SAFE_SHARP)) {
console.log(`✓ sharp ${sharpVersion}`);
} else {
console.log(`✗ sharp ${sharpVersion}: needs ${SAFE_SHARP} or later. Run: npm update sharp`);
failed = true;
}
} catch {
console.log("• sharp not installed, so image optimization can't use it");
}
process.exit(failed ? 1 : 0);Here's what it prints on a project still on 16.4.0 with an old lockfile:
$ node check-next-security.mjs
✗ next 16.4.0: upgrade to 16.4.5 or later.
✗ sharp 0.35.4: needs 0.35.5 or later. Run: npm update sharpAnd after upgrading:
$ node check-next-security.mjs
✓ next 16.4.5
✓ sharp 0.35.5It exits with code 1 when something needs fixing, so you can add node check-next-security.mjs as a CI step and a vulnerable build will fail. Update the SAFE versions when the next security release comes out.
The Next.js 15 sharp trap
If you're on Next.js 15, upgrading next may not be enough. Next.js 15.5.28 and later accept both the old and new sharp lines, so if your lockfile already has sharp 0.34.x, npm keeps it (DEV Community). Fix it with:
npm update sharp
npm ls sharpIn a monorepo, pin it with overrides (npm), pnpm.overrides (pnpm) or resolutions (Yarn) so every workspace gets the fixed version.
If you self-host
A lot of us deploy to a VPS with Docker, Coolify or PM2 instead of Vercel, often to keep hosting costs down. The patch only reaches you if the new code reaches the server:
Commit your lockfile. Without it, your server build can resolve different versions from your laptop.
Rebuild without the cache. An old Docker layer can keep the old
sharparound. With plain Docker:docker compose build --no-cache && docker compose up -d.Check what's running, not what you think you deployed. Run
npm ls next sharpinside the container, or run the script above there.Clean up old deployments. Preview and branch deployments stay live on many hosts. Netlify warns that old deploys can stay vulnerable until they're deleted (Netlify). The same goes for any host that keeps old deployments reachable.
Two of the November fixes, the shell poisoning and the reverse proxy issue, only affect self-hosted apps. So did one of September's cache poisoning bugs. If you self-host, these releases matter more for you, not less.
Let Next.js remind you next time
Next.js 16.4 added an option that warns you during next dev and next build when there's an upgrade that fixes a known vulnerability in your version (Next.js 16.4):
// next.config.ts
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
agentUpgrade: 'security',
},
}
export default nextConfigIt's built for AI coding agents, but the reminder shows up for you too. Combined with the CI script, you'll hear about the next security release without having to check the blog.
If you think you were hit
As of mid-October there were no public reports of these bugs being used in attacks (The Hacker News). Still, a few signs are worth a look in your logs and monitoring:
The Node process stuck at 100% CPU, with lots of
POSTrequests carrying aNext-Actionheader.Requests to
/_next/imagewith SVG sources, or crashes during image optimization.New files in your container, unexpected outbound connections, or your API keys being used from IP addresses you don't recognise.
If anything looks wrong, patch first, then rotate your secrets: database URLs, API keys, payment keys and NEXT_SERVER_ACTIONS_ENCRYPTION_KEY. If you want to go further on keeping secrets off machines, I covered that in npm install Is the Riskiest Command You Run Every Day.
Checklist
Upgrade to
next@16.4.5ornext@15.5.29. On 16.0 to 16.3, jump to 16.4.5.Run
npm ls next sharpand make suresharpis 0.35.5 or later.On Next.js 15, run
npm update sharp.Rebuild without cache and redeploy. Check the version inside the running container.
Delete old preview deployments.
Add the check script to CI and turn on
agentUpgrade: 'security'.Don't treat a clean
npm auditas proof you're safe.
It's ten minutes of work. Skipping it means trusting that nobody will point a crafted request at your app before you get around to it.