Back to Blog
high SEVERITY8 min read

How Denial of Service via __proto__ Key happens in Axios and how to fix it

A high-severity denial of service vulnerability (CVE-2026-25639) was discovered in Axios versions prior to 1.13.5, where the `mergeConfig` function failed to properly sanitize the `__proto__` key in configuration objects. This prototype pollution vulnerability could allow attackers to crash Node.js applications or cause unexpected behavior by manipulating JavaScript's prototype chain. The fix involved upgrading from Axios 1.13.2 to 1.18.0, which includes enhanced input validation in the configur

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

Answer Summary

CVE-2026-25639 is a prototype pollution denial of service vulnerability in Axios (CWE-1321) affecting versions before 1.13.5 and 0.30.3. The vulnerability exists in the `mergeConfig` function, which fails to sanitize the `__proto__` key when merging configuration objects, allowing attackers to pollute JavaScript's prototype chain and cause application crashes or unexpected behavior. The fix requires upgrading Axios from 1.13.2 to 1.18.0 (or 0.30.3 for the legacy branch), which implements proper prototype key filtering and adds the `https-proxy-agent` dependency for enhanced security controls.

Vulnerability at a Glance

cweCWE-1321 (Improperly Controlled Modification of Object Prototype Attributes)
fixUpgrade to Axios 1.18.0 with enhanced prototype key filtering
riskApplication crashes, memory exhaustion, or unexpected behavior through prototype chain manipulation
languageJavaScript/Node.js
root causeAxios mergeConfig function accepts __proto__ key without sanitization
vulnerabilityPrototype Pollution leading to Denial of Service

Introduction

In a Node.js application's package-lock.json, we discovered a high-severity prototype pollution vulnerability in Axios 1.13.2. The vulnerability, tracked as CVE-2026-25639, exists in Axios's mergeConfig function, which handles the merging of HTTP client configuration objects. When processing configuration objects containing the special __proto__ key, Axios fails to sanitize this dangerous property, allowing attackers to pollute JavaScript's prototype chain and trigger denial of service conditions.

This matters because Axios is one of the most widely used HTTP clients in the JavaScript ecosystem, with millions of downloads per week. Any application using Axios to make HTTP requests with user-influenced configuration—whether through API parameters, environment variables, or configuration files—could be vulnerable to this attack pattern.

The Vulnerability Explained

Prototype pollution is a JavaScript-specific vulnerability that exploits the language's prototype-based inheritance model. In JavaScript, nearly all objects inherit from Object.prototype, and modifying this prototype affects every object in the application.

The vulnerable code path exists in Axios's configuration merging logic. When Axios merges configuration objects (for example, combining default settings with request-specific options), it performs a recursive merge without properly filtering dangerous keys. Here's what happens:

// Vulnerable pattern in Axios 1.13.2 mergeConfig
function mergeConfig(config1, config2) {
  // Simplified representation of the vulnerable logic
  const result = {};
  for (const key in config2) {
    // No check for __proto__, constructor, or prototype
    result[key] = config2[key];
  }
  return result;
}

The specific problem is that when config2 contains a __proto__ key, this code inadvertently modifies the prototype chain rather than just setting a property on the result object. An attacker could exploit this by providing a malicious configuration object:

const maliciousConfig = {
  url: 'https://api.example.com',
  __proto__: {
    isAdmin: true,
    polluted: 'This affects all objects!'
  }
};

axios.request(maliciousConfig);
// Now ALL objects in the application inherit { isAdmin: true, polluted: '...' }

Real-World Attack Scenario

Consider an application that allows users to configure HTTP request settings through an API:

// Vulnerable application code using Axios 1.13.2
app.post('/api/fetch-data', async (req, res) => {
  const userConfig = req.body.requestConfig; // User-controlled input

  try {
    const response = await axios.request({
      baseURL: 'https://internal-api.example.com',
      ...userConfig  // Merges user configuration
    });
    res.json(response.data);
  } catch (error) {
    res.status(500).json({ error: error.message });
  }
});

An attacker could send a POST request with this payload:

{
  "requestConfig": {
    "timeout": 5000,
    "__proto__": {
      "isAdmin": true,
      "toString": null
    }
  }
}

This attack would:
1. Pollute the prototype chain: Every object in the application now has isAdmin: true
2. Break core functionality: Setting toString to null causes crashes when any code calls .toString() on objects
3. Cause denial of service: The application becomes unstable, with errors cascading through unrelated components
4. Persist across requests: In Node.js, the polluted prototype affects all subsequent requests until the process restarts

The impact is severe because the pollution affects the entire JavaScript runtime, not just the Axios configuration. This can lead to application crashes, memory leaks, authentication bypasses (if security checks rely on object properties), and complete service disruption.

The Fix

The fix involved upgrading Axios from version 1.13.2 to 1.18.0, which implements comprehensive prototype pollution protections. Let's examine the specific changes in package-lock.json:

Before (Vulnerable):

"node_modules/axios": {
  "version": "1.13.2",
  "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
  "integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==",
  "dependencies": {
    "follow-redirects": "^1.15.6",
    "form-data": "^4.0.4",
    "proxy-from-env": "^1.1.0"
  }
}

After (Patched):

"node_modules/axios": {
  "version": "1.18.0",
  "resolved": "https://registry.npmjs.org/axios/-/axios-1.18.0.tgz",
  "integrity": "sha512-E32NzpYKp++W7XRe52rHiXV2ehxmh3wbdgO7MHeFM+vqxLBYHzt0ElkiImtOBxtOmyp0yoC8C6uESVV84Y2/hw==",
  "license": "MIT",
  "dependencies": {
    "follow-redirects": "^1.16.0",
    "form-data": "^4.0.5",
    "https-proxy-agent": "^5.0.1",
    "proxy-from-env": "^2.1.0"
  }
}

Key Security Improvements

The upgrade to Axios 1.18.0 introduces several critical security enhancements:

  1. Prototype Key Filtering: The mergeConfig function now explicitly checks for and rejects dangerous keys like __proto__, constructor, and prototype before performing merges.

  2. Enhanced Dependency Security:
    - follow-redirects upgraded from 1.15.6 to 1.16.0 (includes security patches)
    - form-data upgraded from 4.0.4 to 4.0.5 (improved boundary handling)
    - proxy-from-env upgraded from 1.1.0 to 2.1.0 (better environment variable parsing)
    - New dependency https-proxy-agent 5.0.1 added (provides secure proxy handling with additional validation)

  3. Safe Object Creation: The patched version uses Object.create(null) for internal configuration objects, creating objects without a prototype chain that can't be polluted.

The addition of agent-base 6.0.2 and https-proxy-agent 5.0.1 as new dependencies provides an additional security layer. These packages implement secure proxy handling with built-in validation that prevents configuration injection attacks:

"node_modules/agent-base": {
  "version": "6.0.2",
  "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
  "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
  "license": "MIT",
  "dependencies": {
    "debug": "4"
  }
}

The fix is scoped to package.json and package-lock.json, ensuring that all instances of Axios in the dependency tree are upgraded. This approach prevents version conflicts and ensures comprehensive protection across the entire application.

How the Patched Code Prevents the Attack

In Axios 1.18.0, the mergeConfig function now includes explicit prototype pollution prevention:

// Patched mergeConfig in Axios 1.18.0 (conceptual representation)
function mergeConfig(config1, config2) {
  const result = Object.create(null); // No prototype chain

  for (const key in config2) {
    // Explicitly block dangerous keys
    if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
      continue; // Skip dangerous keys
    }
    result[key] = config2[key];
  }
  return result;
}

This change ensures that even if an attacker provides a malicious configuration object with __proto__ keys, those keys are filtered out before the merge operation, completely preventing prototype pollution.

Key Takeaways

  • Axios 1.13.2's mergeConfig function fails to sanitize __proto__ keys, allowing prototype chain pollution that affects all objects in the Node.js runtime
  • CVE-2026-25639 is exploitable through any code path that merges user-controlled data into Axios configuration objects, including API endpoints, environment variables, or configuration files
  • Upgrading to Axios 1.18.0 is essential as it implements explicit filtering of dangerous prototype keys (__proto__, constructor, prototype) in configuration merging logic
  • The fix includes critical dependency updates: follow-redirects 1.16.0, form-data 4.0.5, proxy-from-env 2.1.0, and adds https-proxy-agent 5.0.1 for enhanced security controls
  • Prototype pollution attacks can cause cascading failures across unrelated application components, making this vulnerability particularly dangerous in production environments where a single malicious request can crash the entire service

How Orbis AppSec Detected This

  • Source: User-controlled configuration objects merged into Axios request settings, potentially from HTTP request bodies, query parameters, or environment variables
  • Sink: axios.request() and related methods in application code that utilize the vulnerable mergeConfig function in Axios 1.13.2
  • Missing control: No sanitization of prototype pollution keys (__proto__, constructor, prototype) before configuration object merging; Axios 1.13.2 lacks built-in prototype key filtering
  • CWE: CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes)
  • Fix: Upgraded Axios from 1.13.2 to 1.18.0, which implements explicit prototype key filtering in mergeConfig and includes enhanced proxy handling via https-proxy-agent 5.0.1

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-2026-25639 demonstrates how seemingly innocuous configuration merging logic can create severe security vulnerabilities in widely-used libraries. The prototype pollution vulnerability in Axios 1.13.2 could allow attackers to trigger denial of service conditions by polluting JavaScript's prototype chain through the __proto__ key in configuration objects.

The fix—upgrading to Axios 1.18.0—is straightforward but critical. This version implements comprehensive prototype pollution protections, including explicit filtering of dangerous keys and enhanced dependency security. Beyond applying this specific patch, developers should adopt defensive coding practices: validate all user input before using it in object operations, use safe object creation patterns, keep dependencies updated, and implement multiple layers of security controls.

Prototype pollution vulnerabilities are particularly insidious because they can affect seemingly unrelated parts of an application, making them difficult to debug and potentially catastrophic in production. By understanding this attack pattern and implementing proper protections, you can build more resilient JavaScript applications that withstand sophisticated attacks.

Prevention and further reading

View the Security Fix

Check out the pull request that fixed this vulnerability

View PR #339

Related Articles

high

How Denial of Service via Prototype Pollution happens in Axios and how to fix it

Axios versions prior to 1.15.1 merged untrusted configuration objects without guarding against the `__proto__` key, letting attacker-controlled input pollute `Object.prototype` and crash or destabilize applications. Upgrading axios (and its transitive dependencies `form-data`, `follow-redirects`, `proxy-from-env`) closes this Denial of Service and prototype-pollution attack surface without changing any application code.

critical

How SSRF via Vulnerable Dependency Versions Happens in Node.js and How to Fix It

A permissive semver range in `package.json` allowed npm to install axios versions vulnerable to SSRF (CVE-2024-39338). By bumping the minimum version from `^1.6.0` to `^1.7.4`, all downstream consumers of this SDK are now protected from server-side request forgery attacks. This critical fix required changing just one line in the dependency manifest.

critical

How Server-Side Request Forgery happens in Node.js maintenance scripts and how to fix it

A critical Server-Side Request Forgery (SSRF) vulnerability was discovered in `maintenance/getImages.js`, where the `getImage()` function passed database-sourced URLs directly to `axios.get()` without any validation. An attacker who could modify the elements database could redirect these requests to internal network resources — including AWS cloud metadata endpoints — potentially exposing IAM credentials and other sensitive infrastructure data. The fix introduces a strict URL allowlist that limi

high

How SSRF and Credential Leakage happens in Node.js axios and how to fix it

CVE-2025-27152 is a high-severity vulnerability in axios versions prior to 1.8.2 that allows Server-Side Request Forgery (SSRF) and credential leakage when absolute URLs are passed in requests. By upgrading from the vulnerable `^1.7.4` range (which resolved to `1.7.9`) to the pinned `1.8.2`, the attack surface for intercepting or redirecting authenticated HTTP requests is eliminated. Any Node.js application that passes user-influenced URLs to axios is potentially affected.

high

How HTTP Transport Hijacking via Prototype Pollution happens in JavaScript and how to fix it

CVE-2026-42033 is a high-severity prototype pollution vulnerability in axios that allows attackers to hijack the HTTP transport layer used by the library. The deltamod project was running axios 1.14.0, which lacked the hardened transport configuration introduced in 1.18.0 — including an explicit `https-proxy-agent` dependency and an upgraded `follow-redirects` floor. Upgrading to axios 1.18.0 closes the attack surface by ensuring that object prototype manipulation cannot silently redirect or int

high

How Denial of Service via Unbounded Data Happens in JavaScript and how to fix it

CVE-2025-58754 is a high-severity Denial of Service vulnerability in the popular axios HTTP client library, caused by the absence of a data size check on incoming response or request payloads. An attacker who can influence the size of data processed by axios could exhaust server memory or CPU, bringing down dependent Node.js applications. The fix upgrades axios from version 1.8.4 to 1.18.0, closing the unbounded data processing path.