NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

CVE-2026-109829: undici vulnerable to cache poisoning and cross-user disclosure via cross-origin redirects

highCVSS 3.1 7.4GHSA-4w7w-5xrc-9h26

undici 7.x and 8.x can store a cross-origin redirect response under the original URL's cache key. This happens when an originless `Agent` uses `compose(redirect(), cache())` with a shared cache. An attacker who controls a redirect target can poison a trusted URL, and private responses can leak to later callers. Fixed in undici 7.30.1 and 8.12.2.

Published Oct 27, 2026 · Analysis Nov 1, 2026

What an attacker can do

The cache interceptor builds its key from the original request URL, before the redirect handler changes the origin. The final response, which may come from another origin, is then saved under the original key.

Two outcomes follow. First, if an attacker controls the target of a redirect from a trusted URL, their body is cached under the trusted URL. Later callers get it from the shared cache with no request to either origin, so the poisoning persists. Second, when an authenticated request gets a private, no-store redirect to a user-specific resource, the final response is stored under the original URL. A later unauthenticated caller can receive it.

Exposure needs three things together: an originless Agent, a shared MemoryCacheStore or SqliteCacheStore with type: 'shared', and the order compose(redirect(), cache()). The CVSS vector sets attack complexity high for that reason. Origin-bound Client and Pool dispatchers are not affected, nor is the reverse order.

Who is affected

undici from 7.0.0 before 7.30.1 and from 8.0.0 before 8.12.2. The cache interceptor arrived in 7.0.0, so 6.x is not affected by this issue. Check the version:

npm ls undici

Then search your code for compose(redirect(), cache()) combined with type: 'shared'. If your code uses compose(cache(), redirect()) or per-origin dispatchers, it is outside the affected setup.

undici

Ecosystem
npm
Affected
>= 7.0.0, < 7.30.1
Fixed in
7.30.1
Check
npm ls undici

undici

Ecosystem
npm
Affected
>= 8.0.0, < 8.12.2
Fixed in
8.12.2
Check
npm ls undici

How to fix it

Upgrade to undici 7.30.1 or 8.12.2:

npm install [email protected]

Before storing a response, undici now checks that the origin that produced it matches the cache key. It also keeps each redirect hop's cache-control policy, so cross-origin and no-store or private hops are not cached under the original key.

Workarounds from the advisory: compose as compose(cache(), redirect()), use per-origin dispatchers and cache stores, or disable shared caching on redirect-capable requests.

How to tell if you were hit

No indicators are published. Stale or wrong content returned for a trusted URL without any outbound request to its origin is the symptom. In a SqliteCacheStore, inspect cached entries for URLs whose stored response came from a redirect. For a MemoryCacheStore, restart the process to clear it after patching. Review code for the vulnerable composition and a shared cache.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

When an originless Agent composes the redirect and cache interceptors as compose(redirect(), cache()) with a shared cache (type: 'shared'), the cache builds its key from the original request URL before the redirect handler changes the origin. The response produced after a redirect is then stored under the original key, even when the redirect crossed to a different origin.

An attacker who controls the target of a redirect from a trusted URL can have their response cached under that trusted URL. A later caller requesting the trusted URL receives the attacker's body from the shared cache without either origin being contacted, allowing persistent cache poisoning. The same key confusion also discloses private data: when an authenticated request returns a private, no-store redirect to a user-specific resource, the final response is stored under the original URL and can be served to a later unauthenticated caller.

The cache interceptor was introduced in undici 7.0.0, and all 7.x and 8.x releases before the patched versions are affected. Applications are affected only when an originless Agent, a shared MemoryCacheStore or SqliteCacheStore, and the composition compose(redirect(), cache()) are all used. Origin-bound Client and Pool dispatchers, and the reverse composition compose(cache(), redirect()), are not affected.

Patches

Upgrade to 7.30.1 or 8.12.2. Before storing a response, undici now verifies that the origin that produced it still matches the cache key, and preserves each redirect hop's cache-control policy, so cross-origin redirect responses and responses behind a no-store or private hop are no longer cached under the original key.

Workarounds

Compose the interceptors as compose(cache(), redirect()), use per-origin dispatchers and cache stores, or disable shared caching on redirect-capable requests.

Credited to Kushalkhemka, mayank-jangid-moon, skigeek16, opensec-intelligence, bengsky13, mcollina, UlisesGascon.

Questions

Does using undici's fetch alone expose me?

Not by itself. The advisory requires an originless Agent, a shared MemoryCacheStore or SqliteCacheStore, and the composition compose(redirect(), cache()) all at once.

Is undici 6.x affected by CVE-2026-109829?

No. The cache interceptor was introduced in 7.0.0, and the affected ranges are 7.0.0 up to 7.30.1 and 8.0.0 up to 8.12.2.

Is there a workaround if I cannot upgrade?

Yes. Compose the interceptors as compose(cache(), redirect()), use per-origin dispatchers and cache stores, or disable shared caching on redirect-capable requests.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More npm vulnerabilities

All npm entries