Summary
Axios' Node.js HTTP adapter can inadvertently send proxy authentication headers to redirect targets when requests are made through an authenticated proxy with automatic redirects enabled.
This may leak proxy credentials to external servers whenever a redirected request is no longer routed via the original proxy but still carries a stale Proxy-Authorization header.
Affected context
The vulnerability occurs in Node.js environments using Axios' HTTP adapter with:
- Automatic redirect handling enabled, and
- An authenticated HTTP proxy configured.
It manifests when an initial request goes through the proxy (adding a Proxy-Authorization header), and Axios then follows an HTTP redirect where the subsequent request does not use that proxy but still includes the old Proxy-Authorization header.
Only Node.js adapters are affected; browser-based adapters are not impacted by this behavior.
Exploit preconditions
- Attack surface: Outbound HTTP requests from Node.js services using Axios through authenticated proxies.
- Required access: Ability to control or influence the redirect target (e.g., via a redirecting endpoint, misconfigured upstream, or compromised service).
- Trigger point: An Axios request that:
- Is sent via an authenticated proxy, and
- Receives a redirect response that Axios follows automatically, where
- The redirected request is no longer routed through that proxy.
- Why exploitation is possible: Axios fails to clear or scope the Proxy-Authorization header to proxy-only use, causing it to persist across redirects and be sent to unintended hosts.
Why this happens
The underlying bug is an information exposure issue where authentication metadata intended for an intermediary (the proxy) is not properly confined to that context.
Axios' Node.js HTTP adapter attaches a Proxy-Authorization header for proxy authentication but does not reliably remove or re-evaluate this header when handling redirects that bypass the proxy.
This maps to CWE-200: Information Exposure because sensitive credentials are unintentionally disclosed to redirect targets due to improper header handling and lack of separation between proxy authentication and end-target requests.
Potential impact
- Proxy credentials (usernames, passwords, tokens, or API keys) may be disclosed to redirect targets.
- Malicious or compromised redirect targets can reuse stolen proxy credentials to route traffic through the proxy.
- Attackers may gain access to internal networks reachable via the proxy, depending on the proxy's privileges.
- Logging systems at the redirect target may store exposed credentials, increasing long-term compromise risk.
General mitigation guidance
Mitigations generally focus on scoping sensitive headers and hardening redirect behavior:
- Ensure that headers used for proxy authentication are only attached to proxy connections and not propagated to origin servers or redirect targets.
- Implement logic that re-computes or strips Proxy-Authorization headers whenever a redirect occurs, especially if the subsequent request does not use the same proxy.
- Limit automatic redirect following for sensitive or privileged requests; consider explicitly controlling redirect behavior per request.
- Reduce the privileges of proxy accounts so that exposed credentials have minimal usable access.
- Centralize HTTP client configuration (including proxy and redirect policies) to enforce consistent, least-privilege patterns across services.
How teams detect issues like this
Detection efforts can combine configuration review and traffic inspection:
- Review code and configuration for Axios instances that:
- Use authenticated proxies, and
- Enable automatic redirects without header filtering.
- Use static analysis or linters to flag patterns where Proxy-Authorization (or similar headers) are set globally or on per-request basis without redirect-aware sanitization.
- Inspect outbound HTTP traffic (e.g., via proxy logs or network monitoring) for Proxy-Authorization headers being sent directly to non-proxy hosts.
- Enforce security policies in CI/CD that require sensitive headers to be bound to specific hosts, connection types, or adapters, and reject builds that violate these rules.

