CVE-2026-116689: follow-redirects: Cross-realm sensitiveHeaders arrays are discarded and custom credentials can follow redirects
follow-redirects 1.16.0 and 1.16.1 check the `sensitiveHeaders` option with `instanceof Array`. An array from another JavaScript realm, such as Node's `vm` module, fails that test and is replaced with an empty list, so custom credential headers are forwarded on cross-origin redirects. Upgrade to 1.16.2.
Published Oct 30, 2026 · Analysis Oct 31, 2026
What an attacker can do
The sensitiveHeaders option lists custom headers, such as an API key header, that must be stripped when a redirect leaves the original origin. The library tested it with instanceof Array. An array created in another realm does not pass that test, so the library silently swapped it for an empty list. The same file uses Array.isArray for the headers option, which handles cross-realm arrays correctly (CWE-201).
Three conditions must hold: the caller passes a cross-realm array, a custom credential is listed in that option, and the request meets a redirect to a different origin. Then the credential goes to the redirect target. An attacker who controls or compromises an endpoint that issues cross-origin redirects receives the API key or service token.
Built-in Authorization, Proxy-Authorization and Cookie protections still worked in testing. The advisory does not claim Axios is affected. It scores 5.9 in CVSS 3.1 and 8.2 in CVSS 4.0.
Who is affected
npm follow-redirects 1.16.0 through 1.16.1. Only code that passes sensitiveHeaders from another realm (for example, created inside a vm context) is exposed. Check, including transitive copies:
npm ls follow-redirectsfollow-redirects
- Ecosystem
- npm
- Affected
- >= 1.16.0, <= 1.16.1
- Fixed in
- 1.16.2
- Check
npm ls follow-redirects
How to fix it
Upgrade to 1.16.2.
npm install [email protected]For transitive dependencies, update the parent package or use an overrides entry in package.json. The advisory suggests Array.isArray plus validating each entry as a header-name string, and lists no other workaround.
How to tell if you were hit
Search your code for sensitiveHeaders passed to follow-redirects, directly or through a wrapper, and for use of vm contexts. Check outbound request logs for custom auth headers sent to hosts that are not the original target after a redirect. Rotate any custom credentials that might have followed a cross-origin redirect.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
follow-redirects 1.16.0 and 1.16.1 validate the documented sensitiveHeaders option with instanceof Array. An array created in another JavaScript realm is silently replaced with an empty list, so a caller-declared custom credential header can be forwarded to an attacker-controlled cross-origin redirect destination.
Details
Affected versions
The sensitiveHeaders option was introduced in 1.16.0. Published 1.16.0 and 1.16.1 both reproduced, giving a tested affected range of 1.16.0 through 1.16.1. The source checkout was pinned at revision 46301256333c90b7faac7aa126effe72ec16d16e; the exact npm 1.16.1 artifact reproduced independently.
Root cause
index.js resets options.sensitiveHeaders when its local isArray() helper returns false. That helper uses value instanceof Array, which depends on realm identity. The same file already uses Array.isArray(options.headers), which correctly recognizes arrays across realms.
Suggested remediation
Use Array.isArray(value) for sensitiveHeaders, then validate and normalize each member as a header-name string. Add same-realm and node:vm cross-realm tests for cross-origin redirects, including the array-form headers representation. Verify that custom sensitive names are removed while unrelated headers remain unchanged.
Duplicate review
The public advisory history contains other sensitive-header findings, including array-form headers and regular-expression handling, but focused repository searches found no report describing cross-realm validation as of 2026-10-25. A private or differently worded report may already exist.
Proof of concept
Start two loopback HTTP servers. The first returns a 302 redirect to the second. Send X-API-Key and list that name in sensitiveHeaders, then compare a normal array with a genuine cross-realm array created by:
const vm = require('node:vm');
const sensitiveHeaders = vm.runInNewContext(`['X-API-Key']`);Observed against both source and the exact npm 1.16.1 package:
- Same-realm ['X-API-Key']: the redirect target did not receive the key.
- Cross-realm ['X-API-Key']: Array.isArray(value) was true, value instanceof Array was false, and the redirect target received X-API-Key.
- An unrelated X-Harmless header remained present in both cases.
The complete 3.5 KB loopback-only harness and raw JSON output are available privately.
Impact
custom credential disclosure. Exploitation requires a direct caller or wrapper that preserves a cross-realm sensitiveHeaders array, a custom credential listed in that option, and an attacker-controlled or compromised endpoint that returns a cross-origin redirect. The directly demonstrated result is disclosure of the custom header value, potentially exposing an API key or service token until revocation.
Built-in Authorization, Proxy-Authorization, and Cookie protections remained effective. Exact Axios 1.20.0 with follow-redirects 1.16.1 did not reproduce because Axios normalized the array; this report does not claim that Axios is affected. No third-party service was tested.
Credited to burythevalley.
Questions
- Are the Authorization and Cookie headers leaked?
The advisory says the built-in
Authorization,Proxy-AuthorizationandCookieprotections remained effective in testing. The risk is for custom credential headers.- Does this affect Axios?
The advisory does not claim that Axios is affected.
- Which version fixes it?
follow-redirects 1.16.2. Versions 1.16.0 and 1.16.1 are affected.
References
Read for this analysis:
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 entriesCVE-2026-111755
follow-redirects sensitiveHeaders regex escaping can expose credential headers
high8.2Oct 20, 2026CVE-2026-111756
follow-redirects array-form headers bypass cross-origin credential stripping
high8.2Oct 20, 2026CVE-2026-40895
follow-redirects leaks Custom Authentication Headers to Cross-Domain Redirect Targets
medium6.9Apr 14, 2026CVE-2024-28849
follow-redirects' Proxy-Authorization header kept across hosts
medium6.5Mar 14, 2024CVE-2023-26159
Follow Redirects improperly handles URLs in the url.parse() function
medium6.1Jan 2, 2024
