All posts

Next.js security update: what to patch, and how to check.

Next.js 16.4.1 and 15.5.28 fix two critical remote code execution flaws and a denial-of-service bug. What each one needs to be exploitable, and how to check your app.

Published
Reading time
8 min
By
Girish Babu GV

What happened#

A week before, the Next.js team had announced an upcoming out-of-band release. It included two fixes that had been postponed from the September security release because of delays in upstream dependencies. On 14 October the update landed in the two supported lines: 16.4.1 (Active LTS) and 15.5.28 (Maintenance LTS). If you’re already on 16.4 or 15.5 that is a patch bump. If you’re on an earlier 16.x or 15.x minor, it is a minor bump.

Two of the issues are also reflected in React’s own advisories, because Next.js builds on React’s server components packages. That matters if you run a custom setup, and it explains why you’ll see React version numbers in the same announcement.

The three issues#

1. Remote code execution through use cache and typed arrays (Critical)

GHSA-673q-mjm6-r5xr, CVSS v4 9.5. A vulnerability in apps that use the App Router with Cache Components can lead to unauthenticated remote code execution when a use cache function returns multiple typed arrays. Typed arrays are JavaScript’s binary data views, such as Uint8Array. The advisory doesn’t describe the mechanism. It says there is no known workaround and tells everyone to upgrade immediately, even if your app has no similar functions.

The related React advisory, GHSA-xqc2-xf4c-x3h3, describes the same family of problem in the server components packages: in what it calls extremely rare cases, a response that carries multiple typed arrays plus an attacker-controlled value can lead to remote code execution.

2. Remote code execution in the Image Optimization API (Critical)

CVE-2026-96889 / GHSA-2464-fhr4-w9xw, CVSS v4 9.5. 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 title says SVG files are involved. The announcement’s workaround names sharp: make sure the version Next.js uses is 0.35.5 or later. Upgrading Next.js handles that for you, because the patched releases pull in a fixed sharp.

The affected range here is wide: from Next.js 10.0.0 up to 15.5.27, and 16.x up to 16.4.0. The advisory doesn’t explain how SVG input triggers the bug, and it doesn’t say whether the default configuration is vulnerable.

3. Denial of service in App Router with Server Actions (High)

GHSA-p3m5-59mp-jv5r, CVSS v4 8.2. Crafted requests to an App Router app that has at least one Server Action can cause excessive CPU use. Because that blocks other requests handled by the same process, the app stops responding. The Pages Router, and apps with no Server Actions, aren’t vulnerable. There is no workaround besides upgrading.

The React counterpart, GHSA-h3gv-c5rc-p453, describes crafted requests to server function endpoints that can cause out-of-memory conditions or excessive CPU use.

Am I affected?#

What each Next.js advisory needs to be exploitable
IssueNeedsAffected Next.jsFixed inWorkaround
RCE: use cache and typed arrays (Critical, 9.5)App Router, Cache Components, and a use cache function that returns multiple typed arrays16.0.0 to 16.4.016.4.1None known
RCE: Image Optimization with SVG (Critical, 9.5)The Image Optimization API in use, on glibc-based Linux10.0.0 to 15.5.27, and 16.x up to 16.4.015.5.28, 16.4.1sharp 0.35.5 or later
DoS: Server Actions (High, 8.2)App Router with at least one Server Action13.0.0 to 15.5.27, and 16.0.0 to 16.4.015.5.28, 16.4.1None
The matching React server components advisories
AdvisoryAffected packagesAffected versionsFixed in
RCE (Critical, 9.5)react-server-dom-webpack, -turbopack, -parcel19.0.0 to 19.0.8, 19.1.0 to 19.1.9, 19.2.0 to 19.2.8, 19.3.019.0.9, 19.1.10, 19.2.9, 19.3.1
DoS (High, 8.2)The same three packagesThe same rangesThe same versions

Three honest caveats. First, the Next.js advisories list fixed versions only for the 15.5 and 16.4 lines, so if you’re on 14.x or older, the only path they describe is moving to a supported line. Second, how exposed you are to the image bug can depend on your host: Netlify, for example, says its image CDN serves next/image itself, so on Netlify the exposure is limited to apps that render untrusted input through ImageResponse. Check your own platform’s statement. Third, the React advisories apply to the server components packages, which Next.js bundles with itself, so upgrading Next.js should cover most apps.

What to do now#

  1. Find your version. The two commands below show your Next.js and sharp versions, including the copy of sharp that Next.js uses.
  2. Upgrade to 16.4.1 or later on the 16 line, or 15.5.28 on the 15 line. The latest 16.4 release on npm when I wrote this was 16.4.3, and the 16.3 and 16.4 release notes list new opt-in features and no breaking changes for existing apps. Update eslint-config-next to match.
  3. Check sharp. After the upgrade, npm ls sharp should show 0.35.5 or later.
  4. Redeploy, and clean up. A patched repository does nothing until the new build is live. Self-hosting? Rebuild and restart the process. Also remove old preview or branch deployments you don’t need, since they keep running the old code.
  5. Check anything custom. If you depend on react-server-dom-* packages directly, or run your own server components setup, update those to the patched versions in the table.
Check, upgrade, verify
# 1. What am I running?
npm ls next sharp

# 2. Upgrade (pick your line)
npm install next@16.4.1        # 16.x, or a later 16.4.x
npm install next@15.5.28       # 15.x

# 3. Is the bundled sharp new enough?
npm ls sharp                   # expect 0.35.5 or later

To see which of the risky features your app actually uses, a few searches help. Hits aren’t proof of exposure, and no hits aren’t a reason to skip the upgrade.

Which features do I use?
grep -rnE "use server|use cache" app src 2>/dev/null     # Server Actions, Cache Components
grep -nE "cacheComponents" next.config.*                 # is Cache Components switched on?
grep -rnE "next/image|next/og|ImageResponse" app src 2>/dev/null

How I checked this site#

I wrote this the day I patched my own portfolio, so here is exactly what I found.

  • Before: Next.js 16.2.6, which is inside the affected range, with sharp 0.34.5, below the 0.35.5 workaround.
  • Features in use: the App Router, but no Server Actions and no use cache or Cache Components. By the advisories’ own conditions that rules out the typed-arrays RCE and the Server Actions DoS. I use next/image only with local files and unoptimized, and ImageResponse only for icons and share images built from text I wrote myself, never user input. I can’t see from outside exactly how my host serves the image endpoint, so I treated the image bug as possibly relevant.
  • After: Next.js 16.4.3, React 19.3.1 (up from 19.2.4) and sharp 0.35.5. The type-check, lint and production build passed, and every route and the contact API still responded as before.
  • One follow-up: the newer eslint-config-next flagged a window.location.assign in my command palette, and I swapped it for the router.

So I was probably not directly exposed, and I upgraded anyway. The announcement itself says to upgrade even if you don’t use the affected functions, and a version bump that costs an hour is cheaper than being wrong.

Lessons for developers#

My own take, not from the advisories.

  • Know which features you actually use. “Is my app affected?” took me a few minutes with three searches, because I could answer “do I use Server Actions?” with a command, not from memory.
  • Native dependencies are part of your surface. One of the critical bugs lives in an image library under Next.js, not in Next.js itself. Check the versions of packages you never installed on purpose.
  • Make security updates routine. Framework security releases arrive often. Automated pull requests for security fixes, and a habit of reading the announcement, turn a scramble into a chore. According to its release notes, Next.js 16.4 also added an experimental setting, agentUpgrade, that reminds you about upgrades fixing known vulnerabilities in your installed version.
  • Every environment counts. Preview and branch deployments run real code. If they’re public, they need the same patch as production.

Sources#

Keep reading

Esc