CONTENTUM.COMA specialist. A plan. A result.

Vulnerabilities · 2026

CVE-2026-44496
Npm vulnerability

## Summary Axios versions before `0.32.0` on the `0.x` line and before `1.16.0` on the `1.x` line build a regular expression from the configured XSRF cookie name without escaping regex metacharacters. In standard browser environments, an attacker who can influence the cookie name passed to axios can cause expensive regex backtracking while axios reads `document.cookie`. The practical impact is client-side availability degradation, such as freezing the affected browser tab while axios prepares a request. The issue does not affect ordinary Node.js HTTP adapter usage, React Native, or web workers, where axios does not read `document.cookie`. ## Impact Applications are affected only when attacker-controlled data can reach the XSRF cookie name configuration or a direct/unsafe call to the internal cookie helper. This does not expose credentials, modify requests, or affect response integrity. The impact is availability only. ## Affected Functionality Affected code paths: - `lib/helpers/cookies.js` `read(name)` in standard browser environments. - `lib/helpers/resolveConfig.js` in `1.x`, when browser XHR/fetch adapters resolve XSRF config. - `lib/adapters/xhr.js` in `0.x`, when the XHR adapter reads the configured XSRF cookie. - Direct use of `axios/unsafe/helpers/cookies.js` in `1.x`, if callers pass attacker-controlled names. Unaffected code paths: - Default static `xsrfCookieName: 'XSRF-TOKEN'` when not attacker-controlled. - Requests with `xsrfCookieName: null`. - Node HTTP adapter usage without browser `document.cookie`. - React Native and web workers where axios does not use standard browser cookie access. ## Technical Details Affected versions interpolate the cookie name into a regex. ```js const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)')); ``` Because `name` is not escaped, regex metacharacters in the cookie name are interpreted as regex syntax. A payload such as `(.+)+$` can force catastrophic backtracking against `document.cookie`. The fix avoids dynamic regex construction and parses `document.cookie` by splitting on `;`, trimming leading whitespace, and comparing cookie names with exact string equality. ## Proof of Concept of Attack ```js function vulnerableRead(name, cookie) { const start = Date.now(); try { cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)')); } catch {} return Date.now() - start; } for (const n of [20, 22, 24, 26, 28]) { const cookie = 'x='.padEnd(n, 'a') + '!'; console.log(`${n}: ${vulnerableRead('(.+)+$', cookie)}ms`); } ``` Expected result: timings grow rapidly as the cookie string length increases. ## Workarounds Set `xsrfCookieName: null` if the application does not need axios to read an XSRF cookie. Do not derive `xsrfCookieName` from untrusted input. If a dynamic cookie name is unavoidable, validate it against a strict cookie-name allowlist before passing it to axios. Avoid calling `axios/unsafe/helpers/cookies.js` directly with untrusted names <details> <summary>Original Source</summary> # Regular Expression Denial of Service (ReDoS) via Cookie Name Injection ## 1. Title ReDoS via Unsanitized Cookie Name in Dynamic Regular Expression Construction ## 2. Affected Software and Version - **Software:** Axios - **Version:** 1.15.0 (and potentially earlier versions) - **Component:** `lib/helpers/cookies.js` - **Ecosystem:** npm (Node.js / Browser) ## 3. Vulnerability Type / CWE - **Type:** Regular Expression Denial of Service (ReDoS) - **CWE-1333:** Inefficient Regular Expression Complexity - **CWE-400:** Uncontrolled Resource Consumption ## 4. CVSS 3.1 Score **Score: 7.5 (High)** Vector: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H` | Metric | Value | |---|---| | Attack Vector | Network | | Attack Complexity | Low | | Privileges Required | None | | User Interaction | None | | Scope | Unchanged | | Confidentiality | None | | Integrity | None | | Availability | High | ## 5. Description The `cookies.read()` function in `lib/helpers/cookies.js` constructs a regular express

Affected products

Npm. The exact versions are in the references.

What to do now

  • Check your exposureFind out whether Npm runs anywhere in your environment, including systems of suppliers.
  • UpdateInstall the version in which the vendor fixed the vulnerability. The references lead to the advisory.
  • Limit access until thenIf you cannot update at once, take the system off the internet or restrict who can reach it.

References

Data: CVE list and the NVD. This product uses data from the NVD API but is not endorsed or certified by the NVD.