# GHSA-HX5C-5PJJ-2548: undici vulnerable to cross-user cache disclosure via Vary added on background 304 revalidation

- Database: GitHub
- Severity: CVSS 5.9 (Medium)
- Published: 2026-12-04
- Modified: 2026-12-04

## Tracked as

- [CVE-2026-139839](https://cve.now/CVE-2026-139839.md): undici cross-user information disclosure in HTTP cache

## Affected versions

- undici (npm): from 8.0.0, fixed in 8.14.1
- undici (npm): from 7.17.0, fixed in 7.30.4

## Description

### Impact

When a shared cache (`interceptors.cache({ type: 'shared' })` with `MemoryCacheStore`) holds a stale entry inside its `stale-while-revalidate` window, undici serves it and revalidates in the background. If the background revalidation receives a `304 Not Modified` that adds a `Vary` field the stored response did not have (for example `Vary: x-tenant`), undici does not treat the representation as changed. It re-stores the old, unvaried body under the background caller's value of that header and marks it fresh for the 304's lifetime. Later callers with that header value are then served a body that was generated for a different request, possibly for another user or tenant, without the origin being contacted.

The synchronous revalidation path is not affected by this issue. Applications are affected only when they use a shared cache, the origin first returns a cacheable response without `Vary` and with `stale-while-revalidate`, and a later background `304` introduces `Vary`. The affected path is present from undici 7.17.0 through the patched versions.

### Patches

Upgrade to `7.30.4` or `8.14.1`. A background revalidation `304` that changes the stored response's `Vary` set, or whose final target is not the cached URL, now removes the stored entry instead of refreshing it.

### Workarounds

Use a private cache (`type: 'private'`), disable `stale-while-revalidate` reuse for per-user resources, or make sure the origin sends the final `Vary` on the initial response.

## References

- https://github.com/nodejs/undici/security/advisories/GHSA-hx5c-5pjj-2548

Page: https://cve.now/GHSA-HX5C-5PJJ-2548

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
