Back to Blog
high SEVERITY6 min read

How Denial of Service via Unbounded Data Size happens in Node.js (axios) and how to fix it

CVE-2025-58754 is a high-severity Denial of Service vulnerability in axios versions prior to 1.12.0, caused by a lack of data size validation on incoming responses. An attacker could send or trigger excessively large HTTP responses that exhaust the application's memory, crashing the Node.js process. The fix upgrades axios from 1.9.0 to 1.12.0, which introduces proper data size checks.

O
By Orbis AppSec
Published August 9, 2026Reviewed August 9, 2026

Answer Summary

CVE-2025-58754 is a Denial of Service (DoS) vulnerability in the axios HTTP client for Node.js (CWE-400: Uncontrolled Resource Consumption). Versions before 1.12.0 lack data size validation on HTTP responses, allowing attackers to exhaust server memory with oversized payloads. The fix is to upgrade axios to version 1.12.0 or later, which enforces response size limits.

Vulnerability at a Glance

cweCWE-400
fixUpgrade axios from 1.9.0 to 1.12.0, which adds data size validation
riskApplication crash and service unavailability through memory exhaustion
languageJavaScript (Node.js)
root causeaxios did not enforce maximum size limits on incoming HTTP response data
vulnerabilityDenial of Service (DoS) via unbounded data size

Introduction

In a Node.js application's package-lock.json, the dependency axios was pinned at version 1.9.0—a version now known to contain CVE-2025-58754, a high-severity Denial of Service vulnerability. The project declared "axios": "^1.4.0" in its package.json, which resolved to 1.9.0 at install time. This version of axios lacks proper data size validation on HTTP responses, meaning any endpoint the application calls (or any response an attacker can influence) could return an unbounded payload that exhausts the Node.js process's memory.

This matters for any developer using axios in server-side Node.js applications—especially those that make outbound HTTP requests to external services, APIs, or user-controlled URLs. If your application fetches data from sources you don't fully control, you're at risk.

The Vulnerability Explained

What's Missing: Data Size Checks

Axios is one of the most popular HTTP clients in the JavaScript ecosystem, used in millions of projects. When axios receives an HTTP response, it buffers the response body into memory. In versions prior to 1.12.0, this buffering happened without enforcing a maximum size limit at the transport layer.

Here's what the vulnerable dependency looked like in package-lock.json:

"node_modules/axios": {
  "version": "1.9.0",
  "resolved": "https://registry.npmmirror.com/axios/-/axios-1.9.0.tgz",
  "integrity": "sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==",
  "license": "MIT",
  "dependencies": {
    "follow-redirects": "^1.15.6",
    "form-data": "^4.0.0",
    "proxy-from-env": "^1.1.0"
  }
}

The Attack Scenario

Consider this application uses axios to fetch data from external APIs (common patterns include web scraping with cheerio, which is also a dependency in this project). An attacker could exploit this in several ways:

  1. Malicious API Response: If the application fetches data from a URL that an attacker can influence (e.g., a webhook URL, a user-provided feed URL, or a compromised API), the attacker returns a multi-gigabyte response body.

  2. Slowloris-style Memory Exhaustion: The attacker sends a response with a Content-Length header indicating a normal size but streams an enormous body, or omits the header entirely and streams indefinitely.

  3. Amplification via Redirects: Combined with follow-redirects (also a dependency), an attacker could chain redirects to a malicious endpoint that serves an unbounded payload.

In each case, axios in version 1.9.0 would attempt to buffer the entire response into memory without checking if it exceeds a safe threshold. The Node.js process's heap grows until it hits V8's memory limit (typically 1.5–4 GB depending on configuration), at which point the process crashes with an out-of-memory error.

Real-World Impact

For this specific application—which uses cheerio for HTML parsing, cron for scheduled tasks, and cors for cross-origin handling—the likely scenario is a scheduled job or API endpoint that fetches external content. If that content source is compromised or manipulated, a single malicious response could:

  • Crash the entire Node.js process
  • Cause cascading failures if running in a cluster
  • Create a persistent DoS if the cron job retries automatically
  • Consume all available memory on the host, affecting other services

The Fix

The fix upgrades axios from version 1.9.0 to 1.12.0, which introduces proper data size validation at the library level.

Before (Vulnerable)

In package.json:

"axios": "^1.4.0"

Resolved in package-lock.json to:

"version": "1.9.0"

After (Fixed)

In package.json:

"axios": "^1.12.0"

Resolved in package-lock.json to:

"node_modules/axios": {
  "version": "1.12.0",
  "resolved": "https://registry.npmjs.org/axios/-/axios-1.12.0.tgz",
  "integrity": "sha512-oXTDccv8PcfjZmPGlWsPSwtOJCZ/b6W5jAMCNcfwJbCzDckwG0jrYJFaWH1yvivfCXjVzV/SPDEhMB3Q+DSurg==",
  "license": "MIT",
  "dependencies": {
    "follow-redirects": "^1.15.6",
    "form-data": "^4.0.4",
    "proxy-from-env": "^1.1.0"
  }
}

What Changed

  1. package.json: The version constraint was tightened from ^1.4.0 to ^1.12.0, ensuring no future npm install can resolve to a vulnerable version.

  2. package-lock.json: The locked version moved from 1.9.0 to 1.12.0, and the form-data sub-dependency was also updated from ^4.0.0 to ^4.0.4 (addressing potential related issues in form data handling).

  3. Registry change: The resolved URLs switched from registry.npmmirror.com to registry.npmjs.org, ensuring packages are fetched from the canonical npm registry—a subtle but important supply chain hygiene improvement.

Axios 1.12.0 internally enforces size limits on response data by default, preventing unbounded memory allocation even when developers don't explicitly configure maxContentLength. This is a defense-in-depth improvement that protects all consumers of the library.

Key Takeaways

  • Axios 1.9.0 lacks transport-level data size enforcement, allowing a single malicious HTTP response to crash a Node.js process via memory exhaustion
  • The ^1.4.0 semver range was too permissive—it allowed resolution to any 1.x version ≥1.4.0, but didn't guarantee the security fix in 1.12.0 would be installed
  • Applications using cheerio + axios for web scraping are especially vulnerable, since they fetch content from potentially untrusted external sources
  • Switching from npmmirror.com to npmjs.org in the lock file is a supply chain hygiene improvement that reduces the risk of mirror-based attacks
  • Defense in depth matters: even with the library fix, explicitly configuring maxContentLength provides an additional safety net

How Orbis AppSec Detected This

  • Source: External HTTP responses received by the axios client when making outbound requests (e.g., API calls, web scraping via cheerio)
  • Sink: axios's internal response buffering mechanism in version 1.9.0, which accumulates response data in memory without size validation
  • Missing control: No maximum data size check on incoming HTTP response bodies at the transport layer
  • CWE: CWE-400 (Uncontrolled Resource Consumption)
  • Fix: Upgraded axios from 1.9.0 to 1.12.0, which adds built-in response data size validation to prevent memory exhaustion

Orbis AppSec automatically detected this vulnerability and opened a pull request with the fix. Try Orbis AppSec on your repositories to find and fix issues like this automatically.

Conclusion

CVE-2025-58754 is a reminder that even widely-used, well-maintained libraries like axios can have fundamental safety gaps. The lack of a data size check—something that seems obvious in hindsight—could allow a trivial attack to bring down production services. By upgrading to axios 1.12.0, tightening your semver constraints, and implementing defense-in-depth measures like explicit size limits and timeouts, you can protect your Node.js applications from this class of DoS attack.

Don't wait for an incident to audit your dependencies. Run npm audit today, and consider automated tools that continuously monitor your dependency tree for newly disclosed vulnerabilities.

Prevention and further reading

View the Security Fix

Check out the pull request that fixed this vulnerability

View PR #6

Related Articles

high

How Denial of Service via Infinite Loop Happens in JavaScript Dependencies and How to Fix It

CVE-2026-67213 is a high-severity denial of service vulnerability in nanoid before version 5.1.6 that triggers an infinite loop during random ID generation when processing specially crafted input. We upgraded nanoid across the entire dependency tree to patch this flaw and prevent attackers from freezing application threads. This fix ensures that ID generation remains resilient even when handling adversarial input patterns.

high

How Sensitive Data Exposure happens in Zotero plugins and how to fix it

A high-severity data exposure vulnerability in `Zotero.ts` automatically transmitted complete document metadata—including private notes, attachment paths, and tags—to external LLM services without user consent. The fix replaces broad `item.toJSON()` serialization with explicit field selection, sending only essential bibliographic data.

high

How missing dependency update cooldowns happen in GitHub Dependabot configurations and how to fix it

A semgrep scan flagged `.github/dependabot.yml` for lacking a cooldown period, meaning Dependabot would immediately propose updates to brand-new package versions across npm, Bundler, and Docker ecosystems. The fix adds a `cooldown: default-days: 7` block to every `package-ecosystem` entry, forcing a one-week waiting period before newly published releases are considered — reducing exposure to malicious or unstable package drops.

high

How Path Traversal Happens in TensorFlow's Data Service and How to Fix It

TensorFlow's data service dispatcher validated dataset IDs against forward-slash traversal attacks but overlooked backslash characters on non-Windows platforms, allowing attackers to escape the root directory. A targeted fix adds explicit backslash validation across all platforms, closing a high-severity path traversal vulnerability in the snapshot management system.

critical

How Unbounded WebSocket Message Handling Causes Resource Exhaustion in Node.js and How to Fix It

The WebSocketCrossServerAdapter class in a popular Node.js WebSocket library lacked any rate limiting on inbound messages, allowing attackers to flood Redis nodes and WebSocket servers with high-volume traffic. The fix introduces a configurable `rateLimit` option that caps messages per connection per second, preventing resource exhaustion while preserving legitimate functionality.

critical

How Remote Code Execution Happens in Handlebars Template Compilation and How to Fix It

CVE-2026-33937 is a critical remote code execution vulnerability in Handlebars.js that allows attackers to execute arbitrary code by passing maliciously crafted Abstract Syntax Tree (AST) objects to the compile() function. The vulnerability was patched in version 4.7.9, and we've upgraded to protect against this threat vector.