# CVE-2026-40895: follow-redirects: Custom Authentication Headers Leaked to Cross-Domain Redirect Targets

> Attackers can steal custom authentication headers from Node.js applications when they follow cross-domain redirects, exposing sensitive API keys or tokens.

- **Severity:** Medium 6.9 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Apr 2026
- **Updated:** 10 Sep 2026
- **Also known as:** CLEANSTART-2026-NO27854, CLSA-2026-1777163888, CLSA-2026-1778805975, CLSA-2026-1782262689, CLSA-2026-1782262694, CLSA-2026-1787663318, CLSA-2026-1787664257, DEBIAN-CVE-2026-40895, ECHO-87ff-1faa-6dfd, GHSA-r4q5-vmmm-2653, MINI-3j4w-63wq-gxrc, MINI-44g5-97r9-93wp, MINI-46r2-9928-hjr5, MINI-4jq5-jfg2-r694, MINI-4mp2-7773-xvr7, MINI-4w36-jfrg-m2gv, MINI-5h3c-prx7-2889, MINI-6xf7-v6mf-x78m, MINI-9f49-rfhm-8rwx, MINI-9j5j-96cw-hpph, MINI-f7qg-f4q4-cwhr, MINI-fc73-3qqm-3x34, MINI-fmf6-rx6c-v4q6, MINI-g7r7-v5fj-m9gf, MINI-gw95-rrg8-qr27, MINI-hwwp-4p4r-px6g, MINI-j6jm-m3xm-jqx7, MINI-jrrg-9p9q-xmc4, MINI-q377-x3mm-m65c, MINI-q6vc-2xr9-x899, MINI-qjvg-cmjr-jj5m, MINI-qvwf-mchc-g85g, MINI-w7fg-j6x9-66h5, MINI-wc8m-4hr6-7xjj, MINI-wg3p-prv4-8pmj, ROOT-APP-NPM-GHSA-r4q5-vmmm-2653, UBUNTU-CVE-2026-40895, USN-8632-1

## What is CVE-2026-40895?

CVE-2026-40895 is a medium-severity vulnerability in follow-redirects, published on 21 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official 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.

Weakness: CWE-212 (Improper Removal of Sensitive Information Before Storage or Transfer), CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor)

## Which versions are affected by CVE-2026-40895?

2 open source packages ship an affected version, including follow-redirects. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `follow-redirects` | npm | All versions | 1.16.0 |
| `follow-redirects` | npm | All versions | 1.16.0 |

Products: Follow-Redirects Project Follow-Redirects.

## How do I fix CVE-2026-40895?

Upgrade follow-redirects to 1.16.0 or later.

## Is CVE-2026-40895 being exploited?

There is no known exploitation of CVE-2026-40895 in the wild and no public exploit code.

## Other vulnerabilities in follow-redirects

- [CVE-2022-0155](https://insights.sbomify.com/CVE-2022-0155/): Exposure of Private Personal Information to an Unauthorized Actor in follow-redirects/follow-redirects (high 8.0)
- [CVE-2024-28849](https://insights.sbomify.com/CVE-2024-28849/): Proxy-Authorization header kept across hosts in follow-redirects (medium 6.5)
- [CVE-2022-0536](https://insights.sbomify.com/CVE-2022-0536/): Improper Removal of Sensitive Information Before Storage or Transfer in follow-redirects/follow-redirects (low 2.6)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-40895 and fix it if it is affected.

What it is: CVE-2026-40895 is a medium-severity vulnerability in follow-redirects, published on 21 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-40895 in the wild and no public exploit code.

Affected packages and fixed versions:
- follow-redirects (npm): affected all versions; fixed in 1.16.0
- follow-redirects (npm): affected all versions; fixed in 1.16.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-40895/ (Markdown: https://insights.sbomify.com/CVE-2026-40895/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-40895
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-40895
- OSV: https://osv.dev/vulnerability/CVE-2026-40895

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-40895/
Summaries are generated and may contain mistakes; the official description above is the record.
