DEV Community

CVE Reports
CVE Reports

Posted on Originally published at cvereports.com

CVE-2026-119351: CVE-2026-119351: Cross-Context Cache Leak via Delayed Inner Stream Metadata in Next.js

CVE-2026-119351: Cross-Context Cache Leak via Delayed Inner Stream Metadata in Next.js

Vulnerability ID: CVE-2026-119351
CVSS Score: 6.3
Published: 2026-11-17

A race condition and improper synchronization vulnerability (CWE-362) exists in Next.js versions 16.2.0 prior to 16.4.5 when Cache Components ('use cache' directive) are enabled. When an outer cached function calls a nested cached function that reads dynamic root parameters via 'next/root-params' and returns an object containing pending promises, React Flight can resolve and deliver the ready portion of the payload before the inner cache finishes publishing its root parameter dependencies. Consequently, the outer cache entry finalizes and persists under a cache key that omits the root parameter dependencies, causing the first written cache entry to be served across requests with different root parameter values and bypassing nested cache invalidation rules.

TL;DR

Next.js applications using nested 'use cache' directives and 'next/root-params' can experience cross-request cache leakage if the inner cached function returns pending promises. The outer cache finalizes its cache key before the inner stream publishes its root parameter metadata, persisting a root-parameter-agnostic cache entry that serves data from the initial invocation to subsequent requests across different locales, tenants, or route segments.


⚠️ Exploit Status: POC

Technical Details

  • Vulnerability ID: CVE-2026-119351 / GHSA-vc7v-qv4w-wrv8
  • Weakness Class: CWE-362 (Race Condition / Improper Synchronization)
  • CVSS v4.0 Score: 6.3 MEDIUM (CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N)
  • EPSS Score: 0.24% (15.28th Percentile)
  • Attack Vector: Network (Unauthenticated HTTP requests)
  • Primary Impact: Cross-context cache leakage and bypassed nested cache tag invalidation
  • Affected Versions: Next.js >= 16.2.0, < 16.4.5
  • Patched Version: Next.js 16.4.5

Affected Systems

  • Vercel Next.js (npm:next)
  • Next.js: >= 16.2.0, < 16.4.5 (Fixed in: 16.4.5)

Code Analysis

Commit: 80c96ed

[lts-active] Fix outer ''use cache'' entries reused across root param values (#276)

--- a/packages/next/src/server/app-render/work-unit-async-storage.external.ts
+++ b/packages/next/src/server/app-render/work-unit-async-storage.external.ts
@@ -343,6 +343,11 @@ export interface CommonUseCacheStore extends CommonCacheStore, RevalidateStore {
   readonly serverComponentsHmrCache: ServerComponentsHmrCache | undefined
   readonly forceRevalidate: boolean
   readonly outerOwnerStack: string | undefined
+  /**
+   * Entry collection waits for these promises before it reads metadata from
+   * this store.
+   */
+  readonly pendingNestedCacheMetadata: Set<Promise<unknown>>
 }
--- a/packages/next/src/server/use-cache/use-cache-wrapper.ts
+++ b/packages/next/src/server/use-cache/use-cache-wrapper.ts
@@ -668,6 +668,14 @@ async function collectResult(
   const collectedMetadata: CacheEntryMetadata = innerCacheStore

+  // Wait for nested metadata before collecting this entry's metadata. React
+  // Flight can resolve a nested root model while its referenced promises remain
+  // pending. The outer function can omit those promises from its result. Its
+  // stream can then finish before the nested metadata propagates. The loop
+  // includes promises registered while it waits.
+  while (innerCacheStore.pendingNestedCacheMetadata.size > 0) {
+    await Promise.allSettled(innerCacheStore.pendingNestedCacheMetadata)
+  }
+
   propagateCacheEntryMetadata(cacheContext, collectedMetadata)
Enter fullscreen mode Exit fullscreen mode

Mitigation Strategies

  • Upgrade Next.js to version 16.4.5 or later to ensure outer cache collection awaits all nested metadata promises.
  • Avoid returning unawaited promises (streaming Flight tails) from inner 'use cache' functions that are consumed by outer 'use cache' functions.
  • Explicitly read required root parameters via 'next/root-params' inside the outer 'use cache' function or pass them as explicit arguments to force outer cache key differentiation.

Remediation Steps:

  1. Audit application dependencies (package.json and lockfiles) to identify Next.js versions in the range >= 16.2.0, < 16.4.5.
  2. Update the next dependency to 16.4.5 or higher using npm install next@16.4.5, pnpm update next@16.4.5, or yarn upgrade next@16.4.5.
  3. Redeploy the application and purge existing persistent caches (such as Redis or CDN/ISR cache stores) to remove any previously persisted improperly keyed outer cache entries.

References


Read the full report for CVE-2026-119351 on our website for more details including interactive diagrams and full exploit analysis.

Top comments (0)