CVE-2026-40895
JSON

6.9medium

follow-redirects: Custom Authentication Headers Leaked to Cross-Domain Redirect Targets

Severity
6.9medium CVSS:4.0 by GitHub_M
Exploit likelihood
0.64% (higher than 52% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-r4q5-vmmm-2653

Description

follow-redirects is an open source, drop-in replacement for Node's `http` and `https` modules that automatically follows redirects. Prior to 1.16.0, when an HTTP request follows a cross-domain redirect (301/302/307/308), follow-redirects only strips authorization, proxy-authorization, and cookie headers (matched by regex at index.js). Any custom authentication header (e.g., X-API-Key, X-Auth-Token, Api-Key, Token) is forwarded verbatim to the redirect target. This vulnerability is fixed in 1.16.0.

Affected

Product or packageVersionsReported by
follow-redirects follow-redirects< 1.16.0CVE List
cryostat/cryostat-openshift-console-plugin-rhel9Not specified
Not affected: from 4.2.0-9 before *
CVE List
cluster-observability-operator/distributed-tracing-console-plugin-pf4-rhel9Not specified
Not affected: from 1781116645 before *
CVE List
cluster-observability-operator/distributed-tracing-console-plugin-pf5-rhel9Not specified
Not affected: from 1781116658 before *
CVE List
cluster-observability-operator/distributed-tracing-console-plugin-pf6-rhel9Not specified
Not affected: from 1781116387 before *
CVE List
cluster-observability-operator/distributed-tracing-console-plugin-rhel9Not specified
Not affected: from 1781116392 before *
CVE List
multicluster-engine/console-mce-rhel9Not specified
Not affected: from 1780917531 before *, from 1780910888 before *, from 1778511348 before *, from 1778383863 before *, from 1778532610 before *
CVE List
network-observability/network-observability-console-plugin-compat-rhel9Not specified
Not affected: from 1778508956 before *
CVE List
network-observability/network-observability-console-plugin-rhel9Not specified
Not affected: from 1778510461 before *
CVE List
rhacm2/console-rhel9Not specified
Not affected: from 1783451729 before *, from 1780876734 before *, from 1780600823 before *
CVE List
advanced-cluster-security/rhacs-main-rhel8Not specified
Not affected: from 1779371594 before *, from 1779293013 before *
CVE List
ansible-automation-platform-25/lightspeed-rhel8Not specified
Not affected: from 1780082949 before *
CVE List

All scores

GitHub_M6.9medium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
redhat-SADP7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Classification

CWE-200CWE-212

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

follow-redirects is an open source, drop-in replacement for Node's `http` and `https` modules that automatically follows redirects. Prior to 1.16.0, when an HTTP request follows a cross-domain redirect (301/302/307/308), follow-redirects only strips authorization, proxy-authorization, and cookie headers (matched by regex at index.js). Any custom authentication header (e.g., X-API-Key, X-Auth-Token, Api-Key, Token) is forwarded verbatim to the redirect target. This vulnerability is fixed in 1.16.0.

GitHub Advisory Database

Summary

When an HTTP request follows a cross-domain redirect (301/302/307/308), follow-redirects only strips authorization, proxy-authorization, and cookie headers (matched by regex at index.js:469-476). Any custom authentication header (e.g., X-API-Key, X-Auth-Token, Api-Key, Token) is forwarded verbatim to the redirect target.

Since follow-redirects is the redirect-handling dependency for axios (105K+ stars), this vulnerability affects the entire axios ecosystem.

Affected Code

index.js, lines 469-476:

if (redirectUrl.protocol !== currentUrlParts.protocol &&
   redirectUrl.protocol !== "https:" ||
   redirectUrl.host !== currentHost &&
   !isSubdomain(redirectUrl.host, currentHost)) {
  removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
}

The regex only matches authorization, proxy-authorization, and cookie. Custom headers like X-API-Key are not matched.

Attack Scenario

  1. App uses axios with custom auth header: headers: { 'X-API-Key': 'sk-live-secret123' }
  2. Server returns 302 Location: https://evil.com/steal
  3. follow-redirects sends X-API-Key: sk-live-secret123 to evil.com
  4. Attacker captures the API key

Impact

Any custom auth header set via axios leaks on cross-domain redirect. Extremely common pattern. Affects all axios users in Node.js.

Suggested Fix

Add a sensitiveHeaders option that users can extend, or strip ALL non-standard headers on cross-domain redirect.

Disclosure

Source code review, manually verified. Found 2026-03-20.

NVD (es)

follow-redirects es un reemplazo directo de código abierto para los módulos ’http’ y ’https’ de Node que sigue automáticamente las redirecciones. Antes de la versión 1.16.0, cuando una solicitud HTTP sigue una redirección entre dominios (301/302/307/308), follow-redirects solo elimina los encabezados de autorización, proxy-authorization y cookie (coincidencia por regex en index.js). Cualquier encabezado de autenticación personalizado (por ejemplo, X-API-Key, X-Auth-Token, Api-Key, Token) se reenvía textualmente al destino de la redirección. Esta vulnerabilidad está corregida en la versión 1.16.0.

References

https://github.com/follow-redirects/follow-redirects/security/advisories/GHSA-r4q5-vmmm-2653mitigation, vendor-advisory, web
https://github.com/follow-redirects/follow-redirects/commit/844c4d302ac963d29bdb5dc1754ec7df3d70d7f9web
https://access.redhat.com/security/cve/CVE-2026-40895vdb-entry
https://bugzilla.redhat.com/show_bug.cgi?id=2460297issue-tracking
https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40895.json
https://access.redhat.com/errata/RHSA-2026:17789vendor-advisory
https://access.redhat.com/errata/RHSA-2026:26010vendor-advisory
https://access.redhat.com/errata/RHSA-2026:16874vendor-advisory
https://access.redhat.com/errata/RHSA-2026:36882vendor-advisory
https://access.redhat.com/errata/RHSA-2026:24539vendor-advisory
https://access.redhat.com/errata/RHSA-2026:25273vendor-advisory
https://access.redhat.com/errata/RHSA-2026:20938vendor-advisory

Sources

SourceRecordLicence
CVE ListCVE-2026-40895 changed 2026-11-02CVE Terms of Use
GitHub Advisory DatabaseGHSA-r4q5-vmmm-2653 changed 2026-11-02CC-BY-4.0
NVDCVE-2026-40895 changed 2026-11-11Public domain