GHSA-r4q5-vmmm-2653: Follow redirects Follow-redirects Leaks Custom Authentication Headers Vulnerability
MODERATEGHSA-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.
GHSA-r4q5-vmmm-2653 at a Glance
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.
npm install follow-redirects@1.16.0
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
GHSA-r4q5-vmmm-2653 Affected Follow redirects Versions
1 component(s)| 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?
Which Follow redirects versions are affected?
What version fixes GHSA-r4q5-vmmm-2653?
Is follow-redirects affected?
What CWE is associated with GHSA-r4q5-vmmm-2653?
How can I check npm dependencies for GHSA-r4q5-vmmm-2653?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}