CVE-2026-67312 — Vulnerability in axios — CVE Details
Axios: Deep formToJSON Key Recursion Can Cause Denial of Service
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.52%). 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-67312 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 versions starting with 0.28.0 contain uncontrolled recursion in formDataToJSON, which is exposed as axios.formToJSON() and used internally when axios serialises FormData with Content-Type: application/json.
If an application passes attacker-controlled FormData field names to this functionality, a field name with thousands of nested bracket segments can exhaust the JavaScript call stack and cause denial of service for that request or, in applications without appropriate error handling, process termination.
Impact
Applications are affected only when untrusted users can control FormData key names that are converted through axios.
Affected paths include direct use of axios.formToJSON() on untrusted FormData and axios requests in which attacker-controlled FormData is sent with Content-Type: application/json.
The observed failure is RangeError: Maximum call stack size exceeded. In local testing, this error is catchable, so process-wide crash depends on the consuming application's error handling and runtime behaviour.
Affected Functionality
Affected functionality:
axios.formToJSON(formData)- Named ESM export
formToJSON - Default
transformRequestbehaviour forFormDatawhenContent-Typecontainsapplication/json
Unaffected functionality:
- Normal multipart
FormDatasubmission without JSON serialisation toFormData, which already enforces amaxDepthguard- Axios versions
<=0.27.2, whereformDataToJSONwas not present
Technical Details
The vulnerable code is in lib/helpers/formDataToJSON.js.
parsePropPath() splits a field name such as a[x][x][x] into path segments. buildPath() then recursively processes one segment per call without enforcing a maximum depth:
const result = buildPath(path, value, target[name], index);
A key with thousands of bracket-delimited segments causes thousands of recursive calls and can exceed the JavaScript engine's call stack limit.
Relevant source locations:
lib/helpers/formDataToJSON.jscontains the unbounded recursivebuildPath().lib/axios.jsexposes the helper asaxios.formToJSON.index.jsexposesformToJSONas a named export.index.d.tsandindex.d.ctsdeclare the public API.lib/defaults/index.jscallsformDataToJSON(data)when JSON-serializingFormData.
The inverse helper, toFormData, already enforces maxDepth and throws AxiosError with ERR_FORM_DATA_DEPTH_EXCEEDED, but formDataToJSON does not have an equivalent guard.
Proof of Concept of Attack
import axios from 'axios';
const fd = new FormData();
fd.append('a' + '[x]'.repeat(15000), 'value');
try {
axios.formToJSON(fd);
console.log('not vulnerable');
} catch (e) {
console.log(`${e.constructor.name}: ${e.message}`);
}
Expected result on affected versions:
RangeError: Maximum call stack size exceeded
The same condition can be reached via an axios request transformation when attacker-controlled FormData is sent with Content-Type: application/json.
Workarounds
Applications can reject or normalise untrusted form field names before calling axios.formToJSON().
Applications can avoid sending untrusted FormData through axios as JSON unless JSON conversion is required.
Applications should catch errors around formToJSON() or axios requests that transform untrusted FormData.
Summary
An uncontrolled recursion vulnerability in formDataToJSON allows any user who controls FormData input to crash a Node.js process with a single request. The function recurses once per bracket-delimited segment in a FormData key name with no depth limit, so a key like a[x][x][x]... with 15,000+ segments exhausts the call stack. This is a denial-of-service that kills the process via an unrecoverable RangeError. The inverse function toFormData already enforces a maxDepth limit (default 100) for exactly this reason — formDataToJSON lacks the equivalent guard.
Details
Vulnerable function: buildPath in lib/helpers/formDataToJSON.js, lines 50–82.
buildPath(path, value, target, index) is called recursively — once per segment in the parsed property path — with no depth check:
// lib/helpers/formDataToJSON.js, lines 50–82
function buildPath(path, value, target, index) {
let name = path[index++]; // advance one level
if (name === '__proto__') return true;
// ...
if (!isLast) {
// ...
const result = buildPath(path, value, target[name], index); // recurse — NO depth guard
// ...
}
}
The key is first split into segments by parsePropPath (line 17), which extracts every [segment] via regex. A key with 15,000 bracket pairs produces a 15,001-element array, causing 15,001 recursive calls — well beyond the V8 default stack limit (~10,000–15,000 frames).
formDataToJSON is a public API consumed two ways:
-
Directly by consumers — exported as
axios.formToJSON()(lib/axios.js:80), with TypeScript declarations in bothindex.d.ts:699andindex.d.cts:708, and documented in the API reference in four languages (docs/pages/advanced/api-reference.md). -
Internally by
transformRequest— called atlib/defaults/index.js:56when the request body isFormDataandContent-Typecontainsapplication/json:return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
Contrast with toFormData: The inverse function (lib/helpers/toFormData.js:118) enforces maxDepth (default 100) and throws AxiosError with code ERR_FORM_DATA_DEPTH_EXCEEDED when exceeded. formDataToJSON has no equivalent protection.
PoC
Requires only Node.js and an unmodified axios v1.x install:
import formDataToJSON from 'axios/lib/helpers/formDataToJSON.js';
// Build a FormData with a single key containing 15,000 nested bracket segments
const fd = new FormData();
const key = "a" + "[x]".repeat(15000);
fd.append(key, "value");
try {
formDataToJSON(fd);
console.log("Not vulnerable");
} catch (e) {
console.log(e.constructor.name + ": " + e.message);
// RangeError: Maximum call stack size exceeded
}
Verified output on Node.js 22.22.3 against axios v1.16.1 (current v1.x HEAD):
RangeError: Maximum call stack size exceeded
The process crashes. In a server context (e.g., Express middleware calling axios.formToJSON() on an uploaded form), a single crafted request terminates the process.
Impact
Denial of Service (process crash). Any unauthenticated user who can submit FormData to a Node.js application that passes it through axios.formToJSON() — or that sends it as a JSON-serialized FormData body via axios — can crash the server process with a single request. The RangeError from stack exhaustion is unrecoverable in many contexts (it cannot be reliably caught when the stack is already full). No authentication or special privileges are required; the attacker only needs to control a FormData key name.
Advisory Timeline
- First published July 20, 2026 (129 days ago).
- Last revised September 10, 2026 — 51 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
npm install axios@0.33.0
npm install axios@1.18.0
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (2)
Affects 1 ecosystem: npm (1).
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 4.8 score means for each attack dimension.
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N
References
- https://github.com/axios/axios/security/advisories/GHSA-pmv8-rq9r-6j72WEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-67312ADVISORY
- https://nvd.nist.gov/vuln/detail/CVE-2026-68941ADVISORY
- https://github.com/axios/axios/pull/11000WEB
- https://github.com/axios/axios/pull/11001WEB
- https://github.com/axios/axios/commit/1417285c69344bbcc6420a021f67dee0c6fedb2dWEB
- https://github.com/axios/axios/commit/32fc489632377d214db55bfa4e2c48486a7d7ce2WEB
- https://github.com/axios/axiosPACKAGE
- https://github.com/axios/axios/releases/tag/v0.33.0WEB
- https://github.com/axios/axios/releases/tag/v1.18.0WEB
- https://www.vulncheck.com/advisories/axios-before-denial-of-service-via-formtojsonWEB
Frequently Asked Questions
- What is CVE-2026-67312?
- Axios: Deep formToJSON Key Recursion Can Cause Denial of Service. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 4.8/10).
- How do I check if my project is affected by CVE-2026-67312?
- CVE-2026-67312 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-67312 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 37.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-42035HIGH
Axios: Header Injection via Prototype Pollution
- CVE-2026-44488HIGH
Allocation of Resources Without Limits or Throttling in Axios
- CVE-2026-101909HIGH
Axios: Prototype Pollution Gadget in axios toFormData Options
- CVE-2026-42039MEDIUM
Axios: unbounded recursion in toFormData causes DoS via deeply nested request data
- CVE-2026-67319MEDIUM
Axios: Nested axios option objects can consume polluted prototype values
- CVE-2023-45857MEDIUM
Axios Cross-Site Request Forgery Vulnerability
- CVE-2026-67314MEDIUM
Axios: Prototype pollution auth subfields can inject Basic auth
- CVE-2026-42040LOW
Axios: Null Byte Injection via Reverse-Encoding in AxiosURLSearchParams