←All posts

Next.js 16.4.5 Patches Cross-Tenant Cache Leaks: How to Audit Your use cache Functions

The November 2026 Next.js security release fixes seven advisories, and three of them are about one thing: cached output reaching the wrong tenant or user. Here's what was affected, who needs to care, and a practical audit for every use cache function in a multi-tenant app.

Next.js 16.4.5 Patches Cross-Tenant Cache Leaks: How to Audit Your use cache Functions

Caching is the fastest way to make a Next.js app feel instant, and the fastest way to show one customer another customer's data. On November 3, 2026, the Next.js team published its November 2026 security release, shipping v16.4.5 (Active LTS) and v15.5.29 (Maintenance LTS) with fixes for seven advisories. Hosting providers such as Netlify flagged it the same day.

Most of the headlines focus on the count. The more useful observation is the pattern: three of the seven advisories describe cached output being served across a boundary the app relied on — a tenant, a root parameter, or a user. If you run a multi-tenant SaaS on Cache Components, this is the release to read carefully, and the right time to audit how your cache keys are built.

Step one: patch

There is no clever workaround that beats upgrading. The release notes list the commands:

npm install [email protected]    # 16.x
npm install [email protected]   # 15.5.x

Then confirm what actually resolved, since a lockfile or a monorepo package can quietly pin an older copy:

npm ls next

The rest of this post is about understanding why these bugs existed, because the same class of mistake can live in your own code even on a patched framework.

The three cache-boundary advisories

1. unstable_cache + use cache: cross-tenant disclosure (High)

The most serious advisory, GHSA-mfr8-8qww-v76h, affects apps with Cache Components enabled where the same public use cache function is called both directly and from inside unstable_cache, and that function reads a root parameter such as a tenant identifier.

During a cold cache fill, a concurrent unstable_cache call could receive another request's result without the root parameters being checked. That result could then be stored and served to later callers with the same arguments until it was revalidated or evicted. In plain terms: tenant A warms the cache, tenant B gets tenant A's page.

This is exactly the kind of setup that appears during an incremental migration — older code still wraps data access in unstable_cache, newer code uses use cache, and both end up calling the same helper.

2. Nested use cache functions: cross-root-parameter disclosure (Medium)

GHSA-vc7v-qv4w-wrv8 covers nested public use cache functions where the inner function reads a root parameter and returns an early value plus a slower async value, and the outer function completes without waiting for the slower part. The outer entry could be stored before the inner function's root-parameter dependencies were recorded, so content for one root-parameter value could be served for another.

3. Binary arguments: cross-user disclosure and poisoning (Medium)

GHSA-rhh4-g77r-r9qj applies when distinct binary arguments to a use cache function produce the same cache identity, the app uses those arguments to separate users or accounts, and entries are shared across callers. Two different inputs, one cache slot.

The other four, briefly

The release also fixes shared fallback-shell cache poisoning in self-hosted next start deployments using Cache Components without Partial Prefetching; response injection through stale compressed-response framing behind certain HTTP/1.1 pipelining proxies; cookie values (including HttpOnly ones) leaking via the internal x-middleware-set-cookie header in Edge route handlers that use NextResponse.cookies.set(); and an SVG-rejection bypass in Image Optimization where an image classified as AVIF could slip past dangerouslyAllowSVG: false. The release post lists the exact conditions for each.

Why this keeps happening: implicit cache identity

The use cache directive builds a cache key from the function's identity and its inputs — the serialized arguments and any values it closes over. That is convenient, but it means the boundary between tenants is only as strong as whatever ends up in that key. When tenant identity arrives implicitly — through a root parameter, a nested call, or a binary blob — you are trusting the framework to track it perfectly through every code path, concurrent fill and migration shim.

The advisories above are the framework getting that tracking wrong in edge cases. The patches fix those cases. The durable defence is to stop depending on implicit tracking for anything that separates customers.

An audit you can run this week

Make tenant identity an explicit argument

If a cached function returns tenant-scoped data, pass the tenant ID in as a plain string argument, even if the function could read it from elsewhere. Arguments are part of the cache key by design, so the boundary is visible in the signature and in code review.

// lib/data.ts
import { cacheTag } from 'next/cache';

// Before: tenant derived inside the cached function
// export async function getDashboard() { 'use cache'; const tenant = await currentTenant(); ... }

// After: tenant is an explicit, string-typed input to the cache key
export async function getDashboard(tenantId: string) {
  'use cache';
  cacheTag(`tenant:${tenantId}:dashboard`);
  return db.dashboard.findMany({ where: { tenantId } });
}

Call sites resolve the tenant outside the cache boundary and pass it in. Reading cookies or headers inside a use cache function isn't allowed anyway, so this usually matches how request-time data already has to flow.

Don't mix unstable_cache and use cache on the same helper

Search for functions reachable from both:

grep -rn "unstable_cache" app lib src
grep -rln "'use cache'" app lib src

Any helper that shows up on both sides of a migration is a candidate for the first advisory's pattern. Finish the migration for that helper, or keep a single caching layer around it.

Normalise binary inputs into string keys

If a cached function accepts a Uint8Array, ArrayBuffer or similar and that input distinguishes users, derive an explicit string key (for example a hex digest) and pass that alongside or instead. A string you control is far easier to reason about than the serialization of an opaque buffer.

Await everything a cached function depends on

For nested cached functions, avoid returning a mix of resolved values and un-awaited promises that carry tenant-specific data from an inner cached call. Make the outer function await what it returns, so its cache entry is only written once its full set of inputs is known.

Add a cross-tenant regression test

Ask the question in code: warm the cache as tenant A, request as tenant B, and assert B never sees A's markers. Run requests concurrently to approximate a cold fill. A test like this would have caught the observable symptom of all three advisories, regardless of the root cause.

For self-hosted deployments

If you run next start behind your own reverse proxy, review the self-hosting advisories specifically: check whether your proxy pipelines HTTP/1.1 requests onto shared backend connections, whether any route handler returns a fetched Response unchanged, and whether Edge handlers set sensitive cookies via NextResponse.cookies.set().

Takeaways

  • Upgrade now to [email protected] or [email protected], and verify the resolved version with npm ls next.
  • Treat tenant and user identity as explicit cache-key inputs, passed as string arguments, never inferred inside a cached function.
  • Finish unstable_cache → use cache migrations per helper, rather than layering both caches on the same function.
  • Write one cross-tenant cache test that runs concurrently. It is cheap and it guards against the next edge case too.

Caching bugs rarely look like security bugs until they do. If your product serves more than one customer from one deployment, the cache key is your tenancy model — so make it something you can read.

←Back to all posts
Next step

Need help shipping software?

Tell us what you're trying to build. A discovery call, a one-page summary within 48 hours, a proposal within a week.

Response · 48h·NDA on request·US contracts only