---
title: "Next.js RCE Vulnerability: Upgrade to 16.4.5 or 15.5.29"
description: "Two critical Next.js RCE flaws and a Server Actions DoS, fixed in 16.4.1 and 15.5.28 on 14 October 2026. Affected versions, workarounds and how to patch."
url: "https://no7software.co.uk/blog/nextjs-rce-vulnerability"
last_modified: "2026-11-18"
---

# Next.js RCE Vulnerability: Upgrade to 16.4.5 or 15.5.29

## Key takeaways

- Since 3 November 2026 the minimum safe versions are Next.js 16.4.5 and 15.5.29; the npm latest tag is 16.4.6, and next build on 16.4.0 or later warns when the installed version is affected.
- Next.js 16.4.1 and 15.5.28, released 14 October 2026, fix two critical unauthenticated remote code execution flaws and one high-severity denial of service.
- The use cache flaw affects App Router apps with Cache Components on 16.0.0 to 16.4.0 and has no workaround.
- The Image Optimization flaw (CVE-2026-96889) affects glibc-based Linux and has a workaround: sharp 0.35.5 or later.
- The Server Actions denial of service does not affect Pages Router apps or apps without Server Actions.
- Upgrade, confirm the resolved sharp version, rebuild and redeploy every app and container.

### Update, 18 November 2026, 06:55 UTC: Why next build now says your Next.js version is affected by a known security vulnerability

Since Next.js 16.4.0, `next dev` and `next build` check the installed version against the Next.js security advisories. The check is controlled by [`experimental.agentUpgrade`](https://nextjs.org/docs/app/api-reference/config/next-config-js/agentUpgrade), and its default policy, `security`, recommends a safe upgrade when the installed stable version is affected. The CLI warns that the installed Next.js version is affected by a known security vulnerability and points to `next upgrade --agent=security`.

How the command behaves depends on where it runs, according to the Next.js docs:

- In an interactive terminal the reminder offers Upgrade now, Skip, or Skip until next version, and skips on its own after ten seconds while the build carries on behind it.
- When a coding agent runs the command, the first reminder stops it with instructions to report the upgrade. Running the same command again promptly continues with a warning.
- Setting `experimental.agentUpgrade` to `false` turns the reminders off. It does not fix anything: the installed version stays vulnerable.

The fix is the upgrade the message asks for. Every 2026 advisory that names a fixed version is fixed in Next.js 16.4.5 or later on 16.x and 15.5.29 or later on 15.x. The npm `latest` tag now points to [16.4.6](https://github.com/vercel/next.js/releases/tag/v16.4.6), released on 9 November 2026, a bug fix release on top of 16.4.5. [`next upgrade --agent`](https://nextjs.org/docs/app/guides/upgrading/agent-upgrade) hands the upgrade to a coding agent; running `npm install next@16.4.6` and rebuilding does the same job by hand.

### Update, 3 November 2026, 19:45 UTC: Next.js rates the unstable_cache flaw High in its release post

The Next.js team has now published its [November 2026 Security Release](https://nextjs.org/blog/november-2026-security-release) post. It lists the same seven issues and the same fixed versions, 16.4.5 (Active LTS) and 15.5.29 (Maintenance LTS), but rates one of them higher than the GitHub advisory: cross-tenant cache disclosure when a `use cache` function is also called through `unstable_cache` (GHSA-mfr8-8qww-v76h) is marked High severity in the post, while the advisory itself still says medium. The post says that where root parameters separate tenants, the leaked result can contain another tenant's data. The other six remain Medium. The post also narrows two issues: the Edge cookie leak needs attacker-controlled JavaScript on the same origin and did not reproduce in Node.js Route Handlers or with `cookies().set()`, and the SVG bypass needs a native image backend that can decode SVG.

### Update, 3 November 2026, 18:55 UTC: Next.js 16.4.5 and 15.5.29 fix seven medium vulnerabilities

The scheduled release announced on 27 October shipped today. According to the [v16.4.5 release notes](https://github.com/vercel/next.js/releases/tag/v16.4.5), Next.js 16.4.5 fixes all seven advisories. The [v15.5.29 release notes](https://github.com/vercel/next.js/releases/tag/v15.5.29) list the three that also affect 15.x. All seven are rated moderate (medium) severity:

- CVE-2026-119346 ([GHSA-f3mh-rxg3-f5g2](https://github.com/vercel/next.js/security/advisories/GHSA-f3mh-rxg3-f5g2)): cookies set through `NextResponse` on Edge runtime routes are repeated in an internal `x-middleware-set-cookie` response header, so HttpOnly cookies such as session tokens become readable by JavaScript on the same origin. Affects 15.x and 16.x.
- CVE-2026-119347 ([GHSA-7qx7-33qx-rqx2](https://github.com/vercel/next.js/security/advisories/GHSA-7qx7-33qx-rqx2)): on self-hosted deployments the image optimiser (`/_next/image`) can be made to process an attacker-supplied SVG even with `dangerouslyAllowSVG: false`, the default. Affects 15.x and 16.x.
- CVE-2026-119348 ([GHSA-pc58-hwjq-p385](https://github.com/vercel/next.js/security/advisories/GHSA-pc58-hwjq-p385)): self-hosted apps that return a fetched upstream response unchanged, behind an HTTP/1.1 reverse proxy that allows pipelined responses, can mix up responses between clients. Affects 15.x and 16.x.
- CVE-2026-119349 ([GHSA-rhh4-g77r-r9qj](https://github.com/vercel/next.js/security/advisories/GHSA-rhh4-g77r-r9qj)): `use cache` functions that take binary arguments such as `Uint8Array` or `Blob` can produce the same cache key for different arguments, which can share cached results across users. Affects 16.x.
- CVE-2026-119350 ([GHSA-vvgp-ww4w-46vf](https://github.com/vercel/next.js/security/advisories/GHSA-vvgp-ww4w-46vf)): self-hosted apps on `next start` built with `cacheComponents: true` and without Partial Prefetching can have a shared fallback shell poisoned by one unauthenticated GET request. Affects 16.4.0 and later. The advisory's workaround is `partialPrefetching: true` in `next.config`.
- CVE-2026-119351 ([GHSA-vc7v-qv4w-wrv8](https://github.com/vercel/next.js/security/advisories/GHSA-vc7v-qv4w-wrv8)): with Cache Components, an outer `use cache` function can be stored under a key that leaves out a root param read by an inner one, so content for one root param value is served for another. Affects 16.2.0 and later.
- CVE-2026-119790 ([GHSA-mfr8-8qww-v76h](https://github.com/vercel/next.js/security/advisories/GHSA-mfr8-8qww-v76h)): a `use cache` function that reads a root param and is called both directly and through `unstable_cache()` can leak cached data across root param values during a cold process start. Affects 16.3.0 and later.

Upgrade to 16.4.5, or to 15.5.29 on the 15.x line. The 16.4.1 and 15.5.28 releases still fix the 14 October RCE and denial of service flaws covered below, but they do not include these seven fixes.

### Update, 28 October 2026, 15:15 UTC: Next.js schedules a November security release

On 27 October the Next.js team [announced a scheduled security release](https://nextjs.org/blog/upcoming-nextjs-security-release-november-2026) for Tuesday 3 November 2026. It will address seven medium-severity vulnerabilities in Next.js, and the full advisories, with impact, affected versions and upgrade instructions, will be published alongside the release. The 14 October fixes in this post still apply: stay on 16.4.1 or 15.5.28 or later now, then plan to upgrade again once the 3 November patches are available.

A **Next.js RCE vulnerability** is a flaw that lets an attacker run their own code on the server that runs your Next.js app. On 14 October 2026 the Next.js team [published an out-of-band security update](https://nextjs.org/blog/nextjs-security-update-october-14-2026) that fixes two critical unauthenticated remote code execution vulnerabilities and one high-severity denial of service. The fixes ship in Next.js 16.4.1 (Active LTS) and 15.5.28 (Maintenance LTS). If you run a headless storefront or any other Next.js app, upgrade now.

## Next.js vulnerabilities fixed on 14 October 2026

The three issues, with the affected and fixed versions from each GitHub advisory:

| Issue | Advisory | Severity | Affected versions | Fixed in |
| --- | --- | --- | --- | --- |
| Unauthenticated remote code execution in `use cache` functions returning typed arrays | [GHSA-673q-mjm6-r5xr](https://github.com/vercel/next.js/security/advisories/GHSA-673q-mjm6-r5xr) | Critical | 16.0.0 to 16.4.0 | 16.4.1 |
| Unauthenticated remote code execution in the Image Optimization API when SVG files are used | [CVE-2026-96889 (GHSA-2464-fhr4-w9xw)](https://github.com/vercel/next.js/security/advisories/GHSA-2464-fhr4-w9xw) | Critical | 10.0.0 to 15.5.27, and 16.x above 16.0.0 up to 16.4.0 | 15.5.28, 16.4.1 |
| Denial of service in App Router using Server Actions | [GHSA-p3m5-59mp-jv5r](https://github.com/vercel/next.js/security/advisories/GHSA-p3m5-59mp-jv5r) | High | 13.0.0 to 15.5.27, and 16.0.0 to 16.4.0 | 15.5.28, 16.4.1 |

The `use cache` and Server Actions issues have related upstream advisories in React, GHSA-xqc2-xf4c-x3h3 and GHSA-h3gv-c5rc-p453, which the Next.js team links from its announcement.

## Is my Next.js app affected?

- **`use cache` remote code execution:** affects apps using the App Router with Cache Components when a `use cache` function returns multiple typed arrays. In the Next.js docs, `use cache` is a Cache Components feature that you turn on with the `cacheComponents` option in `next.config`. The advisory gives no workaround and tells you to upgrade even if your app has no such function.
- **Image Optimization remote code execution:** a memory-related bug in an upstream library used for Image Optimization can lead to remote code execution when Next.js runs on glibc-based Linux. The advisory's workaround is to make sure the `sharp` package Next.js uses is 0.35.5 or later. Upgrading Next.js makes package managers pull in a fixed `sharp`.
- **Server Actions denial of service:** crafted requests to an App Router app with at least one Server Action can drive CPU usage up and block further requests in the same process. Apps using the Pages Router, or not using Server Actions, are not vulnerable.

The Image Optimization advisory covers every release from 10.0.0 up to 15.5.27, so apps still on Next.js 14 or older are in range. The advisory lists fixes only on the 15.5 and 16.4 lines. On an older line, move to 15.5.28 or 16.4.1, or apply the `sharp` workaround until you can. Next.js 13 and 14 App Router apps with Server Actions are also in range of the denial of service advisory, which has no workaround besides upgrading.

## How to patch Next.js

1. **Check the installed versions.** Run `npm ls next sharp` (or the equivalent for your package manager) in every app and build image.
2. **Upgrade Next.js.** Run `npm install next@16.4.1` on the 16.4 line or `npm install next@15.5.28` on the 15.5 line. The npm `latest` tag now points to 16.4.3, which is later than the fixed release.
3. **Confirm `sharp`.** After installing, check that the resolved `sharp` is 0.35.5 or later. If you cannot upgrade Next.js straight away, pin `sharp` to 0.35.5 or later as the advisory's interim workaround for the Image Optimization flaw.
4. **Rebuild and redeploy.** Commit the lockfile, rebuild every container and redeploy. A running server keeps the old code until it restarts.
5. **Test the paths that changed.** Check pages that use `next/image`, cached functions and Server Actions, such as cart and checkout forms, before you close the ticket.

## Timeline

- **30 September 2026:** the Next.js September security release. Two fixes were held back from it because of upstream dependency delays.
- **8 October 2026:** the Next.js team pre-announced an out-of-band update for 14 October covering two critical and one high-severity issue.
- **14 October 2026:** npm records 15.5.28 at 17:36 UTC and 16.4.1 at 17:43 UTC; the three GitHub advisories were published between 17:46 and 17:47 UTC.

## What to do next

List every Next.js app you run, including preview and staging deployments, and move each one to 16.4.1 or 15.5.28 or later today. If the same stack runs Node.js or PHP, the [Node.js Brotli RCE fix](https://no7software.co.uk/blog/nodejs-security-release-brotli-rce) and the [PHP2Shell vulnerabilities](https://no7software.co.uk/blog/php2shell-php-vulnerability) need the same treatment. Our [ecommerce supply chain security checklist](https://no7software.co.uk/blog/ecommerce-supply-chain-security-checklist) covers dependency pinning and patch routines. If you want a headless storefront upgraded and tested for you, our [headless Shopify development](https://no7software.co.uk/headless-shopify-development) team can scope it.

Related guide: [Is my Next.js version vulnerable? How to check and fix](https://no7software.co.uk/blog/check-nextjs-version-vulnerable).

## Frequently Asked Questions

The questions buyers and engineers ask us most about this topic.

### Which Next.js versions fix the October 2026 RCE vulnerabilities?

Next.js 16.4.1 and 15.5.28, released on 14 October 2026. The use cache remote code execution flaw affects 16.0.0 to 16.4.0, and the Image Optimization remote code execution flaw affects releases from 10.0.0 up to 15.5.27 and from above 16.0.0 up to 16.4.0.

### Is there a workaround for the Next.js Image Optimization RCE?

Yes. The advisory for CVE-2026-96889 says to make sure the sharp package used by Next.js is 0.35.5 or later. Upgrading Next.js to a patched version pulls in a fixed sharp automatically. The flaw affects Next.js running on glibc-based Linux.

### Is there a workaround for the use cache RCE in Next.js?

No. The advisory says there is no known workaround for affected applications and that you should upgrade to 16.4.1 immediately, even if your app has no use cache function returning typed arrays.

### Are Next.js apps using the Pages Router affected by the Server Actions denial of service?

No. The advisory says apps using the Pages Router, or not using Server Actions, are not vulnerable. App Router apps with at least one Server Action should upgrade to 16.4.1 or 15.5.28.

### I am on Next.js 14. Is there a patch?

The Image Optimization advisory covers every release from 10.0.0 up to 15.5.27 and lists fixes only in 15.5.28 and 16.4.1. Move to one of those, or pin sharp to 0.35.5 or later as an interim workaround. Next.js 13 and 14 App Router apps with Server Actions are also in range of the denial of service advisory, which has no workaround besides upgrading.

### Why does next build say my Next.js version is affected by a known security vulnerability?

Since Next.js 16.4.0, next dev and next build check the installed version against the Next.js security advisories through the experimental.agentUpgrade option, whose default policy is security. When the installed stable version is affected, the CLI warns and recommends next upgrade --agent=security. Upgrading to 16.4.5 or later on 16.x, or 15.5.29 or later on 15.x, removes the warning and the vulnerabilities.

### What is the latest Next.js version?

The npm latest tag points to Next.js 16.4.6, released on 9 November 2026 as a bug fix release on top of 16.4.5. On the 15.x Maintenance LTS line the latest release is 15.5.29, from 3 November 2026.

### Is Next.js 16.4.1 still safe?

No. Next.js 16.4.1 fixes the 14 October 2026 advisories, but seven medium-severity advisories published on 3 November 2026 are fixed only from 16.4.5 on 16.x and 15.5.29 on 15.x. Versions 16.4.1 to 16.4.4 remain affected by those seven.
