The Axios project has released a security advisory for a newly discovered vulnerability affecting its popular promise-based HTTP client for Node.js and browsers. Tracked as CVE-2025-58754 with a CVSS score of 7.5, the flaw could allow attackers to crash Node.js processes by abusing the way Axios handles data: URLs.
According to the advisory, “When Axios runs on Node.js and is given a URL with the data: scheme, it does not perform HTTP. Instead, its Node http adapter decodes the entire payload into memory (Buffer/Blob) and returns a synthetic 200 response.”
Unlike normal HTTP responses, which are subject to safeguards like maxContentLength or maxBodyLength, Axios ignores these limits for data: URIs. As the advisory explains: “An attacker can supply a very large data: URI and cause the process to allocate unbounded memory and crash (DoS), even if the caller requested responseType: ‘stream’.”
The issue lies in the fromDataURI function, which decodes the entire Base64 payload into a Buffer without size checks. This means that even if developers configure Axios with size limits, those protections only apply to HTTP streams — not to data: URIs.
In comparison, Axios’s HTTP adapter properly monitors response size and rejects oversized payloads. With data: URIs, however, “a data: URI of arbitrary size can cause the Node process to allocate the entire content into memory.”
A proof-of-concept exploit has already been published, demonstrating how a malicious actor could trigger an out-of-memory crash with a single crafted request.
The affected and patched versions
- Affected: Axios versions <1.11.0
- Patched: Axios 1.12.0
Users are strongly encouraged to upgrade immediately.
The Axios team has provided guidance on remediation strategies:
- Enforce size limits – Inspect the length of Base64 payloads before decoding, and reject any that exceed configured limits.
- Stream decoding – Instead of decoding an entire payload at once, use a streaming Base64 decoder to process chunks incrementally, allowing early aborts if the data grows too large.
Until a patch can be applied, developers should avoid processing untrusted data: URIs and ensure that Axios is not exposed to attacker-controlled input in sensitive environments.