High

follow-redirects: Cross-realm sensitiveHeaders arrays are discarded and custom credentials can follow redirects

  • Disclosed: 30.10.2026
  • Updated: 08.11.2026 10:00

Summary

follow-redirects 1.16.0 and 1.16.1 validate the documented sensitiveHeaders option using instanceof Array. An array created in another JavaScript realm is silently replaced with an empty list, allowing a caller-declared custom credential header to 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 the issue, establishing 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

In index.js, options.sensitiveHeaders is reset when its local isArray() helper returns false. This helper checks value instanceof Array, which relies on realm identity. However, the same file already uses Array.isArray(options.headers), which properly recognizes arrays across different realms.

Suggested remediation

Use Array.isArray(value) for sensitiveHeaders, then validate and normalize each element as a header-name string. Implement same-realm and node:vm cross-realm tests for cross-origin redirects, including array-form header representations. Ensure that custom sensitive headers are stripped while unrelated headers remain untouched.

Duplicate review

While public advisory history includes other sensitive-header reports (such as array-form headers and regular-expression handling), repository searches revealed no prior report addressing cross-realm validation as of 2026-10-25. A private or differently phrased report may exist.

Proof of Concept

Set up two loopback HTTP servers where the first issues a 302 redirect to the second. Send X-API-Key and specify that name within sensitiveHeaders, comparing a standard array to a cross-realm array generated via:

js
const vm = require('node:vm');
const sensitiveHeaders = vm.runInNewContext(`['X-API-Key']`);

Observations against both source and the exact npm 1.16.1 package:

  • Same-realm ['X-API-Key']: the redirect destination did not receive the header.
  • Cross-realm ['X-API-Key']: Array.isArray(value) evaluated to true, value instanceof Array evaluated to false, and the redirect destination received the X-API-Key header.
  • An unrelated X-Harmless header was preserved in both scenarios.

The complete 3.5 KB loopback-only test harness and raw JSON output are available privately.

Impact

Custom credential disclosure. Exploitation requires:

  1. A direct caller or wrapper that retains a cross-realm sensitiveHeaders array.
  2. A custom credential specified in that option.
  3. An attacker-controlled or compromised endpoint returning a cross-origin redirect.

The demonstrated impact is the leakage of custom header values, potentially exposing an API key or service token until revoked.

Built-in protections for Authorization, Proxy-Authorization, and Cookie remain effective. Axios 1.20.0 using follow-redirects 1.16.1 did not reproduce the issue because Axios normalizes the array; this report does not claim Axios is affected. No third-party services were tested.

What to do

Upgrade follow-redirects to version 1.16.2 or later.

For custom implementations or patches, replace instanceof Array checks with Array.isArray(value) when validating sensitiveHeaders, normalize each member as a header-name string, and verify behavior with cross-realm tests.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package follow-redirects >= 1.16.0, < 1.16.2 1.16.2

References

CVSS score 5.9/10
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness (CWE)
CWE-201
Platform
npm
Package
follow-redirects
Disclosed
30.10.2026
Updated
08.11.2026 10:00

Sources and licenses · Edited or translated by DockRay; source rights and applicable licenses are retained.

OSV / GitHub Advisory Database - GHSA-mrwp-f3q8-3g9p - CC BY 4.0

Vulnerability history: follow-redirects

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
6
First → latest
01.2022 10.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • High 2
  • Medium 4

Disclosures per year

  1. 2022: 2
  2. 2023: 0
  3. 2024: 2
  4. 2025: 0
  5. 2026: 2
  1. follow-redirects: Cross-realm sensitiveHeaders arrays are discarded and custom credentials can follow redirects this entry
    High · 5.9 CVE-2026-116689 >= 1.16.0, < 1.16.2 1.16.2
  2. Medium · 6.5 CVE-2024-28849 < 1.15.6 1.15.6
  3. Medium · 6.1 CVE-2023-26159 < 1.15.4 1.15.4
  4. High · 8.0 CVE-2022-0155 < 1.14.7 1.14.7

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.