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

Published date: 2022-01-12T22:46:26Z
CVE: CVE-2022-0155
Links:

follow-redirects is vulnerable to Exposure of Private Personal Information to an Unauthorized Actor

Affected versions: ["1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0", "1.13.3", "1.13.2", "1.13.1", "1.13.0", "1.12.1", "1.12.0", "1.11.0", "1.10.0", "1.9.1", "1.9.0", "1.8.1", "1.8.0", "1.7.0", "1.6.1", "1.6.0", "1.5.10", "1.5.9", "1.5.8", "1.5.7", "1.5.6", "1.5.5", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.4.1", "1.4.0", "1.3.0", "1.2.6", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.1", "1.2.0", "1.1.0", "1.0.0", "0.3.0", "0.2.0", "0.1.0", "0.0.7", "0.0.6", "0.0.5", "0.0.4", "0.0.3", "0.0.2", "0.0.1"]
Secure versions: [1.16.0, 1.16.1]
Recommendation: Update to version 1.16.1.

follow-redirects' Proxy-Authorization header kept across hosts

Published date: 2024-03-14T17:19:42Z
CVE: CVE-2024-28849
Links:

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

follow-redirects/index.js:464

- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
+ removeMatchingHeaders(/^(?:authorization|proxy-authorization|cookie)$/i, this._options.headers);

Affected versions: ["1.15.5", "1.15.4", "1.15.3", "1.15.2", "1.15.1", "1.15.0", "1.14.9", "1.14.8", "1.14.7", "1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0", "1.13.3", "1.13.2", "1.13.1", "1.13.0", "1.12.1", "1.12.0", "1.11.0", "1.10.0", "1.9.1", "1.9.0", "1.8.1", "1.8.0", "1.7.0", "1.6.1", "1.6.0", "1.5.10", "1.5.9", "1.5.8", "1.5.7", "1.5.6", "1.5.5", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.4.1", "1.4.0", "1.3.0", "1.2.6", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.1", "1.2.0", "1.1.0", "1.0.0", "0.3.0", "0.2.0", "0.1.0", "0.0.7", "0.0.6", "0.0.5", "0.0.4", "0.0.3", "0.0.2", "0.0.1"]
Secure versions: [1.16.0, 1.16.1]
Recommendation: Update to version 1.16.1.

Follow Redirects improperly handles URLs in the url.parse() function

Published date: 2024-01-02T06:30:30Z
CVE: CVE-2023-26159
Links:

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.

Affected versions: ["1.15.3", "1.15.2", "1.15.1", "1.15.0", "1.14.9", "1.14.8", "1.14.7", "1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0", "1.13.3", "1.13.2", "1.13.1", "1.13.0", "1.12.1", "1.12.0", "1.11.0", "1.10.0", "1.9.1", "1.9.0", "1.8.1", "1.8.0", "1.7.0", "1.6.1", "1.6.0", "1.5.10", "1.5.9", "1.5.8", "1.5.7", "1.5.6", "1.5.5", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.4.1", "1.4.0", "1.3.0", "1.2.6", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.1", "1.2.0", "1.1.0", "1.0.0", "0.3.0", "0.2.0", "0.1.0", "0.0.7", "0.0.6", "0.0.5", "0.0.4", "0.0.3", "0.0.2", "0.0.1"]
Secure versions: [1.16.0, 1.16.1]
Recommendation: Update to version 1.16.1.

Exposure of Sensitive Information to an Unauthorized Actor in follow-redirects

Published date: 2022-02-10T00:00:31Z
CVE: CVE-2022-0536
Links:

Exposure of Sensitive Information to an Unauthorized Actor in NPM follow-redirects prior to 1.14.8.

Affected versions: ["1.14.7", "1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0", "1.13.3", "1.13.2", "1.13.1", "1.13.0", "1.12.1", "1.12.0", "1.11.0", "1.10.0", "1.9.1", "1.9.0", "1.8.1", "1.8.0", "1.7.0", "1.6.1", "1.6.0", "1.5.10", "1.5.9", "1.5.8", "1.5.7", "1.5.6", "1.5.5", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.4.1", "1.4.0", "1.3.0", "1.2.6", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.1", "1.2.0", "1.1.0", "1.0.0", "0.3.0", "0.2.0", "0.1.0", "0.0.7", "0.0.6", "0.0.5", "0.0.4", "0.0.3", "0.0.2", "0.0.1"]
Secure versions: [1.16.0, 1.16.1]
Recommendation: Update to version 1.16.1.

follow-redirects leaks Custom Authentication Headers to Cross-Domain Redirect Targets

Published date: 2026-04-14T01:11:11Z
Links:

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.

Affected versions: ["1.15.11", "1.15.10", "1.15.9", "1.15.8", "1.15.7", "1.15.6", "1.15.5", "1.15.4", "1.15.3", "1.15.2", "1.15.1", "1.15.0", "1.14.9", "1.14.8", "1.14.7", "1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0", "1.13.3", "1.13.2", "1.13.1", "1.13.0", "1.12.1", "1.12.0", "1.11.0", "1.10.0", "1.9.1", "1.9.0", "1.8.1", "1.8.0", "1.7.0", "1.6.1", "1.6.0", "1.5.10", "1.5.9", "1.5.8", "1.5.7", "1.5.6", "1.5.5", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.4.1", "1.4.0", "1.3.0", "1.2.6", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.1", "1.2.0", "1.1.0", "1.0.0", "0.3.0", "0.2.0", "0.1.0", "0.0.7", "0.0.6", "0.0.5", "0.0.4", "0.0.3", "0.0.2", "0.0.1"]
Secure versions: [1.16.0, 1.16.1]
Recommendation: Update to version 1.16.1.

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