Todos los artículos

Three critical RCE flaws in Next.js and the patched releases

The Next.js repository's security page currently lists 72 advisories, and the top three are critical remote code execution flaws. None of them needs authentication, and each scores 9.5 on CVSS v4. Add a denial of service through Server Actions and an SSRF in Image Optimization, and moving to 15.5.28 or 16.4.1 jumps to the top of this week's to-do list.

The version ranges below come from the GitHub advisory pages. Do not read on without checking your own version first. Run npm ls next sharp.

1. Unauthenticated RCE in Image Optimization (GHSA-2464-fhr4-w9xw)

The upstream library behind image optimization (sharp) has a memory bug. When Next.js runs on glibc-based Linux, that bug can lead to remote code execution. It is CVE-2026-96889 with a score of 9.5.

Affected versions are 10.0.0 through 15.5.27 and 16.0.0 through 16.4.0. The patched releases are 15.5.28 and 16.4.1.

The advisory's workaround is to make sure the sharp that Next.js uses is 0.35.5 or later. Fresh installs already get a fixed sharp. Upgrading Next.js to a patched version also guarantees the package manager brings in the fixed sharp.

2. Unauthenticated RCE in use cache functions (GHSA-673q-mjm6-r5xr)

In apps that use the App Router with Cache Components, a use cache function that returns multiple typed arrays can lead to remote code execution. The affected range is 16.0.0 through 16.4.0 and the patched release is 16.4.1.

There is no known workaround. The advisory tells you to upgrade right away even if your app has no such function.

3. RCE in next/og ImageResponse (GHSA-vcvr-r3jv-pc5j)

The Node.js implementation of ImageResponse is affected by an upstream vulnerability. If an attacker-controlled value reaches SVG content, an attribute or a style, it can lead to remote code execution. The affected range is 16.2.0 through 16.3.5 and the patched release is 16.3.6.

The advisory's example puts a query parameter into a <title> inside an <svg>.

import { ImageResponse } from 'next/og'

// Vulnerable: a value from the request ends up in SVG content
export async function GET(request: Request) {
  const value = new URL(request.url).searchParams.get('value') ?? ''
  return new ImageResponse(
    <svg width="1200" height="630"><title>{value}</title></svg>
  )
}

If you use the Edge ImageResponse, or never put attacker values into SVG, you are not affected. If you cannot upgrade yet, the workaround is this. Pick from a fixed list of page names and never write the raw request value into SVG.

const TITLES = { home: 'Home', blog: 'Blog' } as const

export async function GET(request: Request) {
  const key = new URL(request.url).searchParams.get('page') ?? 'home'
  const title = TITLES[key as keyof typeof TITLES] ?? TITLES.home
  return new ImageResponse(<div style={{ fontSize: 64 }}>{title}</div>)
}

Two more on the same list

DoS through Server Actions (GHSA-p3m5-59mp-jv5r, score 8.2). Crafted requests can drive CPU usage up in an App Router app with at least one Server Action and block the other requests handled by the same process. The affected ranges are 13.0.0 through 15.5.27 and 16.0.0 through 16.4.0. There is no workaround, so upgrade. If you use the Pages Router or have no Server Actions, you are not affected.

SSRF in Image Optimization (GHSA-cjq9-62q9-8jv4, CVE-2026-94483, score 8.3). If the DNS record of an allow-listed remote host can point at private IPs, an attacker can make the server send requests into your internal network. If you have no images.remotePatterns, you are not affected. The affected range is 16.0.0 through 16.3.7 and the patched release is 16.3.8. Moving to 16.4.1 covers this one too.

The list also holds two cache poisoning advisories, a leak of Draft Mode content, and a low-severity information disclosure in the dev server's MCP endpoint. There is also a use cache cache leak specific to 16.3.0, fixed in 16.3.8.

What to do

npm ls next sharp
npm install next@16.4.1      # if you are on 16.x
npm install next@15.5.28     # if you stay on 15.x
npm ls sharp                 # is it 0.35.5 or later

Commit the lockfile too. With Docker, rebuild the image, because the patched next and sharp only come in with a fresh npm ci. If you run Alpine (musl), the glibc condition in the image optimization advisory may not apply to you, but the other two advisories state no such condition. So do not skip the update on Alpine.

Then go through your ImageResponse usage and make sure no value from the request reaches SVG. In next.config, review images.remotePatterns and remove hosts whose DNS you do not trust.

If you subscribe to the repository's Security tab you will see new advisories from day one. Note also that these three RCEs closed in different releases. The threshold is 16.3.6 for next/og and 16.4.1 for use cache. Pinning a version and leaving it alone for a long time can get expensive for that reason.

Sources

Related posts

Written by sheduxdev.

Three critical RCE flaws in Next.js and the patched releases | TurkishPvP LLC