Skip to content

Axios patches a bug that leaks auth headers on redirect

A High-severity flaw in the Node HTTP adapter forwarded Authorization and Cookie headers to subdomains after a redirect. Axios ships over 141 million downloads a week.

Axios has patched a High-severity bug (CVSS 8.2) in its Node.js HTTP adapter: when a request carrying an Authorization or Cookie header gets redirected to a subdomain of the original host, on the same effective port and without an HTTPS downgrade, axios forwards those headers along with it. If an attacker controls or can observe that subdomain, your bearer token or session cookie goes with the redirect.

The bug sits in how the underlying follow-redirects dependency treats subdomains as credential-safe, which doesn’t match axios’s own origin-based comparisons for headers callers set explicitly. It affects the 1.x line from 1.0.0 up to 1.21.0, and the legacy 0.x line from 0.25.0 up to 0.35.0. Both are fixed: upgrade to 1.21.0 or 0.35.0. Axios had over 141 million weekly downloads on npm as of 2 December, so this touches a large share of everything written in Node that calls an external API.

Why it matters: if your app follows redirects and attaches auth headers, you’re exposed until you upgrade. There’s no CVE assigned yet, so dependency scanners that key off CVE IDs may miss it. Check your lockfile directly.

npm ls axios
npm install axios@^1.21.0

The caveat: you’re only exposed if you follow redirects on authenticated requests. Disabling maxRedirects on those calls is a workaround until you can upgrade.

Share

Related reading

More from The Wire

All briefs