{"id":"GHSA-mrwp-f3q8-3g9p","summary":"follow-redirects: Cross-realm sensitiveHeaders arrays are discarded and custom credentials can follow redirects","details":"### Summary\n\nfollow-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.\n\n### Details\n\nAffected versions\n\nThe 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.\n\nRoot cause\n\nindex.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.\n\nSuggested remediation\n\nUse 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.\n\nDuplicate review\n\nThe 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.\n\n### Proof of concept\n\nStart 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:\n\n```js\nconst vm = require('node:vm');\nconst sensitiveHeaders = vm.runInNewContext(`['X-API-Key']`);\n```\n\nObserved against both source and the exact npm 1.16.1 package:\n\n- Same-realm ['X-API-Key']: the redirect target did not receive the key.\n- Cross-realm ['X-API-Key']: Array.isArray(value) was true, value instanceof Array was false, and the redirect target received X-API-Key.\n- An unrelated X-Harmless header remained present in both cases.\n\nThe complete 3.5 KB loopback-only harness and raw JSON output are available privately.\n\n### Impact\n\ncustom 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.\n\nBuilt-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.","aliases":["CVE-2026-116689"],"modified":"2026-10-30T23:15:06.315251750Z","published":"2026-10-30T22:59:33Z","database_specific":{"github_reviewed_at":"2026-10-30T22:59:33Z","nvd_published_at":"2026-10-27T20:17:14Z","cwe_ids":["CWE-201"],"severity":"HIGH","github_reviewed":true},"references":[{"type":"WEB","url":"https://github.com/follow-redirects/follow-redirects/security/advisories/GHSA-mrwp-f3q8-3g9p"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-116689"},{"type":"WEB","url":"https://github.com/follow-redirects/follow-redirects/commit/b0a7751e9cd64cd8eeb6ec67d2f206a9cc88d3f8"},{"type":"PACKAGE","url":"https://github.com/follow-redirects/follow-redirects"},{"type":"WEB","url":"https://github.com/follow-redirects/follow-redirects/releases/tag/v1.16.2"}],"affected":[{"package":{"name":"follow-redirects","ecosystem":"npm","purl":"pkg:npm/follow-redirects"},"ranges":[{"type":"SEMVER","events":[{"introduced":"1.16.0"},{"fixed":"1.16.2"}]}],"database_specific":{"last_known_affected_version_range":"\u003c= 1.16.1","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-mrwp-f3q8-3g9p/GHSA-mrwp-f3q8-3g9p.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"},{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"}]}