A redirect can carry a credential header past follow-redirects
Technical analysis of A redirect can carry a credential header past follow-redirects.
edirect handling is a security boundary because a client can start on a trusted host and end on an attacker-controlled one. Libraries usually strip authorization and cookie headers when a redirect crosses origins or downgrades HTTPS to HTTP. follow-redirects added an option to name extra sensitive headers, but a regular-expression bug made the protection fail for some valid header names.
The issue is CVE-2026-111755, described in GHSA-8r9p-f939-6h3c. Version 1.16.0 introduced sensitiveHeaders; version 1.16.1 fixes the escaping error. The advisory rates the vulnerability 8.2 high and associates it with CWE-185 and CWE-200.
Metacharacters defeated the filter
escapeRegex left valid header-name metacharacters unescaped. If an application declared a sensitive header whose name contained ^ or |, the generated filter did not match the declared header name. On a cross-origin or HTTPS-to-HTTP redirect, the header could be forwarded to the redirect target.
The exact impact depends on the header and the application. An API key, bearer token, custom tenant credential, or service-to-service header can all become useful to an attacker who controls the redirect destination. The advisory notes that axios delegates redirect handling to follow-redirects, so applications using axios can inherit the issue where the option reaches the library.
The bug was introduced while fixing an earlier redirect issue. That history makes version review more important. A dependency that is recent enough to contain the new option is not automatically a fixed version. The vulnerable range is specifically 1.16.0 through the release before 1.16.1.
Find applications that customise sensitive headers
Start with a dependency inventory and identify applications that set sensitiveHeaders. Then inspect how header names are constructed. Standard headers such as Authorization and Cookie may be handled by defaults, while an organization-specific header such as X-Api-Key or a tenant header can follow the custom path.
Search for header names containing regular-expression metacharacters, but do not rely on a string search alone. A wrapper may compose a name at runtime or pass a configuration value. Review the HTTP client configuration and add a test that redirects from one origin to another and asserts that every sensitive header is absent.
Upgrade to 1.16.1 or later. If a downstream framework pins an older transitive version, resolve the lockfile and verify the final runtime package. Do not assume that upgrading axios alone changes the version used by every bundle; inspect the package manager's resolved dependency tree.
Test redirects by scheme and origin
Use four cases: same origin with HTTPS, cross-origin with HTTPS, same host with a downgrade from HTTPS to HTTP, and cross-origin with a downgrade. For each case, record which headers reach the destination. Test relative redirects, absolute redirects, and chained redirects because a later hop can change the origin after the first check.
Limit redirect following where the application does not need it. Allow only known destinations and protocols for webhook delivery, OAuth discovery, package fetching, and other outbound workflows. A redirect allowlist is not a substitute for stripping credentials, but it reduces the number of attacker-controlled endpoints that can receive them.
Review logs for outbound requests to unexpected hosts and for authentication failures that occur after a successful request to a different domain. Header leakage may not produce a local error, so server-side egress logs and the receiving service's access records are more useful than an application exception.
Rotate what may have crossed the boundary
If an affected application followed untrusted redirects, rotate credentials for every sensitive header that could have been forwarded. Check the scope and expiry of those credentials, revoke sessions or tokens issued to the destination, and review the egress logs for a second request using the same secret.
The patch is small, but the design lesson is larger. Redirect policy must be tested as executable security behavior, not as a documentation claim. Any header that grants authority needs a test proving it does not survive the redirect boundary.
References
Did you enjoy this article?
Recommend it — Standard Reader surfaces well-loved writing to more readers across the network.