Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-42039 — axios

🟠 CVSS 7.5 — High ⚠️ Exploit Public CWE-674 OSV
7.5
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Axios: unbounded recursion in toFormData causes DoS via deeply nested request data

Summary

toFormData recursively walks nested objects with no depth limit, so a deeply nested value passed as request data crashes the Node.js process with a RangeError.

Details

lib/helpers/toFormData.js:210 defines an inner build(value, path) that recurses into every object/array child (line 225: build(el, path ? path.concat(key) : [key])). The only safeguard is a stack array used to detect circular references; there is no maximum depth and no try/catch around the recursion. Because build calls itself once per nesting level, a payload nested roughly 2000+ levels deep exhausts V8's call stack.

toFormData is the serializer behind FormData request bodies and AxiosURLSearchParams (used by buildURL when params is an object with URLSearchParams unavailable, see lib/helpers/buildURL.js:53 and lib/helpers/AxiosURLSearchParams.js:36). Any server-side code that forwards a client-supplied object into axios({ data, params }) therefore reaches the recursive walker with attacker-controlled depth.

The RangeError is thrown synchronously from inside forEach, escapes toFormData, and propagates out of the axios request call. In typical Express/Fastify request handlers this terminates the running request; in synchronous startup paths or worker threads it can crash the whole process.

PoC

```js

import toFormData from 'axios/lib/helpers/toFormData.js';

import FormData from 'form-data';

function nest(depth) {

let o = { leaf: 1 };

for (let i = 0; i < depth; i++) o = { a: o };

return o;

}

try {

toFormData(nest(2500), new FormData());

} catch (e) {

console.log(e.name + ': ' + e.message);

}

// RangeError: Maximum call stack size exceeded

```

Server-side reachability example:

```js

// vulnerable proxy pattern

app.post('/forward', async (req, res) => {

await axios.post('https://upstream/api', req.body); // req.body user-controlled

res.send('ok');

});

// attacker POST /forward with {"a":{"a":{"a":... 2500 deep ...}}}

// -> toFormData build() overflows -> request handler crashes

```

Verified on axios 1.15.0 (latest, 2026-04-10), Node.js 20, 3/3 PoC runs reproduce the RangeError at depth 2500.

Impact

A remote, unauthenticated attacker who can influence an object passed to axios as request data or params triggers an uncaught RangeError inside the synchronous recursive walker. In server-side applications that proxy or re-send client JSON through axios this crashes the request handler and, in worker/cluster setups, the process. Fix by bounding recursion depth in toFormData's build function (reject or throw on depths beyond a configurable limit, e.g. 100) or rewriting the walker iteratively.

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. Rated impact: confidentiality none, integrity none, availability low.

CVSS metrics in full

The score comes from this vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Attack requirements: None — no deployment-specific condition has to hold.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: None — nobody has to be tricked into anything.
  • Confidentiality impact: None.
  • Integrity impact: None.
  • Availability impact: Low — limited, and the attacker does not choose what is affected.

Weakness class

CVE-2026-42039 is classified as CWE-674: Uncontrolled Recursion. The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.

Affected software

CVE-2026-42039 is recorded against 1 package.

  • axios

Timeline and source

Published on 5 May 2026 and last revised on 19 August 2026. A public exploit is known to exist, which raises the urgency of patching considerably. Record sourced from OSV.

References

github.com (Web)
nvd.nist.gov (Advisory)
github.com (Web)
github.com (Package)
github.com (Web)

Other advisories for this package

axios has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-674: Uncontrolled Recursion) in other software:

CVE-2026-42039 on other distributions

Each distribution ships its own build and its own fixed version. Pick the one you run:

Details

Severity HIGH
CVSS Score 7.5
CVSS Vector CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N
CWE CWE-674
Public Exploit ⚠️ Yes
Source OSV
Published 2026-05-05
Updated 2026-08-20
Modified 2026-08-19
Fix URL N/A

Affected Packages

Software From version Fixed in
axios

Exploit Protection

Are you running axios?

CVE-2026-42039 carries CVSS 7.5 High rating and a public exploit already exists. BotEraser checks your installation against this and other known CVE records, and blocks IPs associated with exploit activity.

Check My Site For CVE-2026-42039 →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026