
Cloud Vulnerability DB
A community-led vulnerabilities database
Axios versions listed above can recurse without a depth limit while merging a plain-object params value. Method shortcuts such as axios.get() perform this merge before calling the public request() method. A sufficiently deep object therefore throws RangeError: Maximum call stack size exceeded before the shortcut returns a Promise. A remote attacker can cause a Node service outage if the service accepts a deeply nested object, forwards it as Axios params, and does not catch the synchronous exception. Other applications may experience only a failed request.
This is a runtime availability issue. In the tested Node HTTP handler, one unauthenticated request containing 30 KB of nested JSON caused an uncaught exception and process exit. An application or framework that catches the synchronous exception can keep the process running. A parser or schema that rejects excessive nesting also blocks the demonstrated input path. The error occurs during configuration merging, before the transport or serializer runs. The browser uses the shared merge code, but the demonstrated process-exit impact is specific to an uncaught exception in a Node service.
Plain-object params passed through Axios method shortcuts, including get() and other aliases that merge config before invoking request(), reach the vulnerable path. On 1.x, calling axios.request() directly returns a rejected Promise for the same input in my test; it still performs the unbounded merge. On 0.x, direct request() can also throw synchronously. The documented paramsSerializer.maxDepth limit does not protect this earlier merge step. Axios request configuration.
mergeConfig() deep-copies a plain-object params value. In utils.merge(), a nested plain object leads to another call to merge() with no depth bound. The method aliases call mergeConfig() before this.request(), so the async request() catch in modern 1.x cannot convert that alias-stage throw into a rejection. v1.19.0 merge configuration, merge helper, method aliases.
In a scratch directory with axios@1.19.0 installed, this local-only server parses attacker-supplied JSON and passes it to params. The stub adapter ensures no upstream network request occurs:
const http = require('http');
const axios = require('axios');
http.createServer((req, res) => {
let body = '';
req.on('data', chunk => { body += chunk; });
req.on('end', () => {
const params = JSON.parse(body);
axios.get('http://127.0.0.1/', {
params,
adapter: config => Promise.resolve({
data: 'ok', status: 200, statusText: 'OK', headers: {}, config
})
}).catch(() => res.end('caught-by-promise'));
});
}).listen(3000, '127.0.0.1');Send a 5,000-level JSON object to the loopback server:
python3 -c 'print("{\"x\":".repeat(5000) + "1" + "}".repeat(5000), end="")' |
curl --data-binary @- http://127.0.0.1:3000/The tested Node process exited with code 1 and a stack-overflow RangeError; caught-by-promise was not reached. The exact failing depth depends on the runtime stack size.
Reject excessive nesting in input before constructing Axios params. Also put a synchronous try/catch around affected method calls, or invoke them inside a Promise chain that catches synchronous throws. Error handling limits process-exit impact; input depth validation limits the underlying work. paramsSerializer.maxDepth alone is insufficient. <details> <summary><h3>Original report</h3></summary>
axios lets you send data with a request in an option called params. Before axios sends the request, it makes a copy of params. To copy it, axios goes into each layer of the object, one layer at a time. axios sets no limit on how many layers it will go into.
An attacker sends a params object with thousands of layers inside layers. axios keeps going deeper until it runs out of memory for this task. It then throws an error and stops.
The error happens before axios starts the network request. Because of this timing, the normal error handler (.catch()) never sees it. In Node.js, an error that nothing handles shuts down the whole program. So one small request from an unauthenticated user shuts down the server.
Every axios request starts by joining two settings objects into one. This step copies the params value with a helper function named merge.
merge copies an object by going into it layer by layer. For each object it finds inside, it calls itself again to copy that inner object. This repeat has no counter and no maximum depth. It continues until the program runs out of stack space. At that point Node.js throws:
RangeError: Maximum call stack size exceededWhere this is in the code (axios@1.19.0, lib/utils.js):
result[targetKey] = merge({}, val);merge then repeats for the next layer:
forEach(source, assignValue);Two facts make this a server shutdown, not a normal error:
params at the very start of axios.get(...), before it creates the promise. So the error is thrown straight out of axios.get(...). It is not turned into a failed promise. This is why a .catch() on the request cannot catch it.Environment: Node.js v24.18.0, axios@1.19.0 from npm. The result was the same in 5 of 5 runs.
npm init -y
npm pkg set type=module
npm install axios@1.19.0poc.mjsimport http from 'node:http';
import axios from 'axios';
function buildDeep(depth) {
const head = {};
let cur = head;
for (let i = 0; i < depth; i++) {
cur.x = {};
cur = cur.x;
}
return head;
}
// Realistic handler. It forwards user input as params.
// It relies on .catch(). No try/catch.
const server = http.createServer((req, res) => {
if (req.url.startsWith('/attack')) {
axios
.get('http://127.0.0.1:1/upstream', {
params: buildDeep(3000),
})
.then(() => res.end('ok'))
.catch(() => res.end('caught-by-promise')); // does not run
return;
}
res.end('alive');
});
server.listen(0, '127.0.0.1', () => {
console.log('port', server.address().port);
});node poc.mjsIt prints the port.curl http://127.0.0.1:<port>/healthThe server answers:alivecurl http://127.0.0.1:<port>/attackcurl http://127.0.0.1:<port>/healthThere is no answer. The connection is refused.The process stops with exit code 1 and prints an uncaught:
RangeError: Maximum call stack size exceededThe stack repeatedly contains:
merge → assignValue → merge → ...The .catch() handler does not run.
.catch() handler does not stop the error because the throw is synchronous.params is affected, for example:axios.get(url, { params: req.query });</details>
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."