NodeJS/follow-redirects/1.12.1
HTTP and HTTPS modules that follow redirects.
https://www.npmjs.com/package/follow-redirects
MIT
5 Security Vulnerabilities
Exposure of sensitive information in follow-redirects
- https://nvd.nist.gov/vuln/detail/CVE-2022-0155
- https://github.com/follow-redirects/follow-redirects/commit/8b347cbcef7c7b72a6e9be20f5710c17d6163c22
- https://huntr.dev/bounties/fc524e4b-ebb6-427d-ab67-a64181020406
- https://github.com/advisories/GHSA-74fj-2j2h-c42q
- https://cert-portal.siemens.com/productcert/pdf/ssa-637483.pdf
follow-redirects is vulnerable to Exposure of Private Personal Information to an Unauthorized Actor
follow-redirects' Proxy-Authorization header kept across hosts
- https://github.com/follow-redirects/follow-redirects/security/advisories/GHSA-cxjh-pqwp-8mfp
- https://github.com/follow-redirects/follow-redirects/commit/c4f847f85176991f95ab9c88af63b1294de8649b
- https://fetch.spec.whatwg.org/#authentication-entries
- https://github.com/advisories/GHSA-cxjh-pqwp-8mfp
- https://nvd.nist.gov/vuln/detail/CVE-2024-28849
- https://github.com/psf/requests/issues/1885
- https://hackerone.com/reports/2390009
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VOIF4EPQUCKDBEVTGRQDZ3CGTYQHPO7Z
When using axios, its dependency follow-redirects only clears authorization header during cross-domain redirect, but allows the proxy-authentication header which contains credentials too.
Steps To Reproduce & PoC
Test code:
const axios = require('axios');
axios.get('http://127.0.0.1:10081/', {
headers: {
'AuThorization': 'Rear Test',
'ProXy-AuthoriZation': 'Rear Test',
'coOkie': 't=1'
}
})
.then((response) => {
console.log(response);
})
When I meet the cross-domain redirect, the sensitive headers like authorization and cookie are cleared, but proxy-authentication header is kept.
Impact
This vulnerability may lead to credentials leak.
Recommendations
Remove proxy-authentication header during cross-domain redirect
Recommended Patch
- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
+ removeMatchingHeaders(/^(?:authorization|proxy-authorization|cookie)$/i, this._options.headers);
Follow Redirects improperly handles URLs in the url.parse() function
- https://nvd.nist.gov/vuln/detail/CVE-2023-26159
- https://github.com/follow-redirects/follow-redirects/issues/235
- https://github.com/follow-redirects/follow-redirects/pull/236
- https://security.snyk.io/vuln/SNYK-JS-FOLLOWREDIRECTS-6141137
- https://github.com/follow-redirects/follow-redirects/commit/7a6567e16dfa9ad18a70bfe91784c28653fbf19d
- https://github.com/advisories/GHSA-jchw-25xp-jwwc
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZZ425BFKNBQ6AK7I5SAM56TWON5OF2XM/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZZ425BFKNBQ6AK7I5SAM56TWON5OF2XM
- https://security.netapp.com/advisory/ntap-20241108-0002
Versions of the package follow-redirects before 1.15.4 are vulnerable to Improper Input Validation due to the improper handling of URLs by the url.parse() function. When new URL() throws an error, it can be manipulated to misinterpret the hostname. An attacker could exploit this weakness to redirect traffic to a malicious site, potentially leading to information disclosure, phishing attacks, or other security breaches.
Exposure of Sensitive Information to an Unauthorized Actor in follow-redirects
Exposure of Sensitive Information to an Unauthorized Actor in NPM follow-redirects prior to 1.14.8.
follow-redirects leaks Custom Authentication Headers to Cross-Domain Redirect Targets
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
- App uses axios with custom auth header:
headers: { 'X-API-Key': 'sk-live-secret123' } - Server returns
302 Location: https://evil.com/steal - follow-redirects sends
X-API-Key: sk-live-secret123toevil.com - 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.
72 Other Versions
| Version | License | Security | Released | |
|---|---|---|---|---|
| 1.16.1 | MIT | 2026-10-01 - 13:52 | 4 days | |
| 1.16.0 | MIT | 2026-04-13 - 11:03 | 6 months | |
| 1.15.11 | MIT | 1 | 2025-07-31 - 12:54 | about 1 year |
| 1.15.10 | MIT | 1 | 2025-07-31 - 07:49 | about 1 year |
| 1.15.9 | MIT | 1 | 2024-09-06 - 08:56 | about 2 years |
| 1.15.8 | MIT | 1 | 2024-09-03 - 21:44 | about 2 years |
| 1.15.7 | MIT | 1 | 2024-09-03 - 19:28 | about 2 years |
| 1.15.6 | MIT | 1 | 2024-03-14 - 16:37 | over 2 years |
| 1.15.5 | MIT | 2 | 2024-01-12 - 08:41 | over 2 years |
| 1.15.4 | MIT | 2 | 2023-12-30 - 17:28 | almost 3 years |
| 1.15.3 | MIT | 3 | 2023-09-19 - 18:51 | about 3 years |
| 1.15.2 | MIT | 3 | 2022-09-13 - 15:04 | about 4 years |
| 1.15.1 | MIT | 3 | 2022-05-26 - 23:23 | over 4 years |
| 1.15.0 | MIT | 3 | 2022-05-03 - 21:30 | over 4 years |
| 1.14.9 | MIT | 3 | 2022-02-18 - 09:27 | over 4 years |
| 1.14.8 | MIT | 3 | 2022-02-08 - 11:04 | over 4 years |
| 1.14.7 | MIT | 4 | 2022-01-10 - 16:58 | over 4 years |
| 1.14.6 | MIT | 5 | 2021-12-08 - 18:18 | almost 5 years |
| 1.14.5 | MIT | 5 | 2021-10-30 - 18:29 | almost 5 years |
| 1.14.4 | MIT | 5 | 2021-09-14 - 12:21 | about 5 years |
| 1.14.3 | MIT | 5 | 2021-09-02 - 14:06 | about 5 years |
| 1.14.2 | MIT | 5 | 2021-08-18 - 12:06 | about 5 years |
| 1.14.1 | MIT | 5 | 2021-05-09 - 10:13 | over 5 years |
| 1.14.0 | MIT | 5 | 2021-04-25 - 16:35 | over 5 years |
| 1.13.3 | MIT | 5 | 2021-02-27 - 14:41 | over 5 years |
| 1.13.2 | MIT | 5 | 2021-01-25 - 20:31 | over 5 years |
| 1.13.1 | MIT | 5 | 2020-12-13 - 16:04 | almost 6 years |
| 1.13.0 | MIT | 5 | 2020-08-10 - 11:41 | about 6 years |
| 1.12.1 | MIT | 5 | 2020-06-18 - 22:37 | over 6 years |
| 1.12.0 | MIT | 5 | 2020-06-16 - 20:37 | over 6 years |
| 1.11.0 | MIT | 5 | 2020-03-29 - 10:54 | over 6 years |
| 1.10.0 | MIT | 5 | 2020-01-26 - 23:35 | over 6 years |
| 1.9.1 | MIT | 5 | 2020-01-25 - 23:54 | over 6 years |
| 1.9.0 | MIT | 5 | 2019-09-06 - 13:12 | about 7 years |
| 1.8.1 | MIT | 5 | 2019-08-27 - 17:37 | about 7 years |
| 1.8.0 | MIT | 5 | 2019-08-27 - 11:10 | about 7 years |
| 1.7.0 | MIT | 5 | 2019-02-13 - 21:40 | over 7 years |
| 1.6.1 | MIT | 5 | 2019-01-03 - 10:24 | almost 8 years |
| 1.6.0 | MIT | 5 | 2018-12-25 - 22:27 | almost 8 years |
| 1.5.10 | MIT | 5 | 2018-11-19 - 21:25 | almost 8 years |
| 1.5.9 | MIT | 5 | 2018-10-09 - 16:01 | almost 8 years |
| 1.5.8 | MIT | 5 | 2018-09-11 - 19:25 | about 8 years |
| 1.5.7 | MIT | 5 | 2018-08-22 - 18:02 | about 8 years |
| 1.5.6 | MIT | 5 | 2018-08-21 - 01:44 | about 8 years |
| 1.5.5 | MIT | 5 | 2018-08-13 - 18:02 | about 8 years |
| 1.5.4 | MIT | 5 | 2018-08-13 - 13:18 | about 8 years |
| 1.5.3 | MIT | 5 | 2018-08-13 - 11:15 | about 8 years |
| 1.5.2 | MIT | 5 | 2018-08-01 - 18:34 | about 8 years |
| 1.5.1 | MIT | 5 | 2018-07-05 - 20:44 | over 8 years |
| 1.5.0 | MIT | 5 | 2018-05-19 - 16:17 | over 8 years |
