CVE-2026-101906 — Axios: ReDoS (O(N²)) in axios — CVE Details
Axios: ReDoS (O(N²)) in shouldBypassProxy host normalization, reachable via untrusted redirect Location
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.55%). Schedule for your next planned update.
Does your project use an affected axios version?
Paste your package-lock.json to check it for CVE-2026-101906 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
Axios shouldBypassProxy() normalizes hostnames with hostname.replace(/\.+$/, ''). For a hostname shaped as many dots followed by a non-dot, the anchored regex can perform quadratic backtracking. Because axios re-evaluates proxy bypass rules for redirected requests, a malicious server can trigger this synchronous work through a crafted redirect Location.
The issue affects Node.js applications that use environment proxy variables with NO_PROXY and allow redirects.
Impact
An attacker-controlled server can return a redirect whose hostname causes the axios process to spend significant CPU time in synchronous hostname normalization. During this time, the Node.js event loop is blocked and the application cannot handle other work on that thread.
This is an availability-only issue. It does not disclose request data or modify requests.
Affected Functionality
Affected:
- Node.js HTTP adapter.
- Environment proxy handling through
HTTP_PROXYorHTTPS_PROXY. NO_PROXYorno_proxyset to a non-empty value.- Redirects followed by axios or
follow-redirects.
Not affected:
- Browser adapters.
- Requests with
proxy: false. - Requests with no
NO_PROXYvalue. - Requests with
maxRedirects: 0, unless application code manually follows the malicious redirect and re-enters axios.
Technical Details
lib/helpers/shouldBypassProxy.js contains:
return unmapIPv4MappedIPv6(hostname.replace(/\.+$/, ''));
When the hostname is "." * n + "a", the $ anchor causes the regex engine to retry the dot run from many positions before it fails. setProxy() invokes shouldBypassProxy(location) after getProxyForUrl(location) returns a proxy, including on redirect hops via beforeRedirects.proxy.
Local timing on axios 1.18.1 showed increasing cost for crafted hostnames: about 1 ms at 1000 dots, 6.9 ms at 3000 dots, and 34.5 ms at 6000 dots. The growth is consistent with the submitted quadratic claim while avoiding long-running payloads.
Proof of Concept of Attack
Constrained helper-level demonstration:
import shouldBypassProxy from 'axios/lib/helpers/shouldBypassProxy.js';
process.env.NO_PROXY = 'example.com';
shouldBypassProxy('http://' + '.'.repeat(6000) + 'a/');
In the full adapter path, a malicious server can return that hostname in a 302 Location header while the client has proxy environment variables and NO_PROXY configured.
Workarounds
Disable automatic redirects for requests to untrusted servers, or avoid environment proxy handling for those requests with proxy: false when appropriate. Operators can also avoid broad untrusted redirect-following in services where event-loop availability is critical.
Summary
shouldBypassProxy normalizes a host with hostname.replace(/.+$/, ''). On a host of the shape (e.g. "." × 40000 + "a"), this anchored regex backtracks quadratically (O(N²)), synchronously starving the Node.js event loop. Because axios re-evaluates the proxy on every redirect using the new Location host, a malicious server can return a crafted 302 Location and freeze the client's event loop for seconds per redirect — a denial of service.
Details
- Affected code: lib/helpers/shouldBypassProxy.js → normalizeNoProxyHost: hostname.replace(/.+$/, '') (one pass in 1.18.1). The open PR #11029 adds a second /.+$/ pass in normalizeIPAddress, doubling the cost (not the origin).
- Root cause: /.+$/ is O(N²) on a long run of dots that is not at the end of the string — the $ anchor forces the engine to backtrack the entire dot-run from every start position.
- Trust boundary (per THREATMODEL): the redirect Location is untrusted (T-2: "axios to network … redirect Location … untrusted"). The caller requests a benign URL; the malicious host arrives via the server's 302. This is not the T-1 caller-supplied-URL non-goal.
- Call chain: setProxy(options, configProxy, location, isRedirect, …) (lib/adapters/http.js) → env-proxy branch → getProxyForUrl(location) returns a proxy → if (!shouldBypassProxy(location)) → normalizeNoProxyHost(parsed.hostname.toLowerCase()) runs /.+$/. setProxy is re-invoked on the redirect hop with the untrusted Location; new URL() retains the long dot-run in .hostname.
- Preconditions: proxy configured via environment (HTTP_PROXY/HTTPS_PROXY, trusted per THREATMODEL T-3, common in CI/containers/enterprise) + NO_PROXY set + redirects followed (default maxRedirects: 5).
PoC
Self-contained, no network — imports axios's own helper:
// node poc.mjs (run next to an axios install)
import sbp from './node_modules/axios/lib/helpers/shouldBypassProxy.js';
process.env.NO_PROXY = 'example.com';
for (const n of [5000, 10000, 20000, 40000]) {
const url = 'http://' + '.'.repeat(n) + 'a/'; // arrives as an untrusted 302 Location host
const t0 = process.hrtime.bigint();
sbp(url); // returns false (correct no-bypass) — but O(N^2) slow
console.log(N=${n}: ${(Number(process.hrtime.bigint()-t0)/1e6)|0} ms);
}
// Measured on 1.18.1: N=5000 ~43ms, 10000 ~160ms, 20000 ~618ms, 40000 ~2499ms; benign host ~0.05ms.
Driven through the real http-adapter __setProxy on the redirect path (setProxy(…, isRedirect=true)), a 10 ms timer fires 0 times during the ~2.4 s block at N=40000 — full event-loop starvation.
Impact
Denial of service (event-loop starvation) on any axios client that uses an environment proxy with NO_PROXY set and follows redirects, when a server it contacts returns a crafted redirect Location. No data exposure or RCE. Same impact class as the accepted DoS advisories GHSA-62hf-57xw-28j9 (toFormData recursion) and the maxContentLength response-size DoS.
Suggested fix
Replace the regex trailing-dot strip with a linear trim: let end = hostname.length; while (end > 0 && hostname.charCodeAt(end - 1) === 46 /* '.' */) end--; hostname = hostname.slice(0, end); Also drop the redundant second /.+$/ pass in PR #11029's normalizeIPAddress.
Advisory Timeline
- First published September 30, 2026 (57 days ago).
- Last revised September 30, 2026 — 0 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
npm install axios@1.20.0
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: npm (1).
| Package | Fixed In |
|---|---|
| axios npm · Affected: All versions | 1.20.0 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-1333
- CWE-400Uncontrolled Resource ConsumptionMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 7.0 score means for each attack dimension.
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
References
- https://github.com/axios/axios/security/advisories/GHSA-mghh-pgcx-3jjjWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-101906ADVISORY
- https://github.com/axios/axios/pull/11141WEB
- https://github.com/axios/axios/commit/d19040bda7a8be2f82c3c6e1a5bc03917daee39aWEB
- https://github.com/axios/axiosPACKAGE
- https://github.com/axios/axios/releases/tag/v1.20.0WEB
Frequently Asked Questions
- What is CVE-2026-101906?
- Axios: ReDoS (O(N²)) in shouldBypassProxy host normalization, reachable via untrusted redirect Location. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.0/10).
- How do I check if my project is affected by CVE-2026-101906?
- CVE-2026-101906 affects axios. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-101906 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is a below-median EPSS score — only 39.6% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-101901HIGH
Axios: Denial of Service via Unhandled 'error' Event in HTTP/2 ClientHttp2Session Initialization
- CVE-2026-42035HIGH
Axios: Header Injection via Prototype Pollution
- CVE-2026-101909HIGH
Axios: Prototype Pollution Gadget in axios toFormData Options
- CVE-2026-42034MEDIUM
Axios' HTTP adapter-streamed uploads bypass maxBodyLength when maxRedirects: 0
- CVE-2026-42039MEDIUM
Axios: unbounded recursion in toFormData causes DoS via deeply nested request data
- CVE-2026-101908MEDIUM
Axios: Prototype pollution gadget in fetch adapter can alter outbound requests
- CVE-2026-42041MEDIUM
Axios: Authentication Bypass via Prototype Pollution Gadget in `validateStatus` Merge Strategy
- CVE-2023-45857MEDIUM
Axios Cross-Site Request Forgery Vulnerability