Back to Blog
high SEVERITY7 min read

How prototype pollution happens in Node.js HTTP clients and how to fix it

A prototype pollution vulnerability in Axios 1.15.1 could allow attackers to manipulate HTTP requests and disclose sensitive information. This vulnerability affects the Node.js sandbox environment used by the agent and was fixed by upgrading to Axios 1.15.2. The fix prevents attackers from poisoning object prototypes to intercept or modify request behavior.

O
By Orbis AppSec
Published July 29, 2026Reviewed July 29, 2026

Answer Summary

CVE-2026-42264 is a prototype pollution vulnerability in Axios (a popular Node.js HTTP client) that allows attackers to manipulate HTTP request objects and access sensitive information through prototype chain pollution. The vulnerability exists in Axios versions prior to 1.15.2 and affects any application making HTTP requests with user-influenced data. The fix involves upgrading Axios from 1.15.1 to 1.15.2, which patches the prototype pollution flaw in the request handling logic. This is a critical update for production systems using Axios to make external API calls.

Vulnerability at a Glance

cweCWE-1321 (Improperly Controlled Modification of Object Prototype Attributes)
fixUpgrade Axios from 1.15.1 to 1.15.2
riskInformation disclosure, request manipulation, potential authentication bypass
languageNode.js / JavaScript
root causeUnsafe object property assignment in Axios request configuration merging logic
vulnerabilityPrototype Pollution in Axios HTTP Client

How Prototype Pollution Happens in Node.js HTTP Clients and How to Fix It

Introduction

In the agent sandbox environment, a critical prototype pollution vulnerability was discovered in Axios 1.15.1—a widely-used HTTP client for Node.js. The vulnerability exists in how Axios merges request configuration objects, allowing attackers to inject malicious properties into the prototype chain. This affects agent/sandbox/sandbox_base_image/nodejs/package-lock.json, which is production code responsible for making external HTTP requests from the sandbox environment.

Because this sandbox handles user-influenced input and makes HTTP requests to external services, a prototype pollution attack could allow remote attackers to:
- Intercept and manipulate HTTP request headers
- Inject authentication tokens or credentials
- Access sensitive data from request configurations
- Bypass security controls in request validation

The vulnerability was patched by upgrading Axios from 1.15.1 to 1.15.2, which implements proper prototype chain protection in the request configuration merging logic.


The Vulnerability Explained

What is Prototype Pollution?

Prototype pollution is a JavaScript-specific vulnerability where an attacker modifies the prototype of built-in objects (like Object, Array, or custom classes) to inject properties that affect all instances of that object type. In the context of Axios, this becomes dangerous because HTTP request configuration objects inherit from Object.prototype.

The Attack Vector in Axios 1.15.1

Axios uses object merging to combine default request configurations with user-provided options. In vulnerable versions, the merging logic didn't properly validate property names, allowing special keys like __proto__, constructor, and prototype to be processed:

// Vulnerable pattern in Axios 1.15.1
// When merging config objects:
const config = { timeout: 5000 };
const userInput = { "__proto__": { timeout: 99999 } };

// Unsafe merge without prototype checks
Object.assign(config, userInput);
// Result: All future objects inherit timeout: 99999

An attacker could craft a malicious payload like:

{
  "__proto__": {
    "headers": {
      "Authorization": "Bearer attacker-token"
    }
  }
}

When this payload is merged into Axios's request configuration, every subsequent HTTP request made by the application would inherit the poisoned headers object, potentially:
- Sending attacker-controlled authentication headers
- Leaking sensitive request data through modified headers
- Redirecting requests to attacker-controlled endpoints

Real-World Impact for This Codebase

The agent sandbox uses Axios to make HTTP requests for various operations. If an attacker could control the request configuration (through API parameters, configuration files, or environment variables), they could:

  1. Information Disclosure: Access or modify headers containing API keys, session tokens, or internal service credentials
  2. Request Manipulation: Redirect requests to attacker-controlled servers or modify request bodies
  3. Privilege Escalation: Inject headers that bypass authentication or authorization checks in downstream services

Example attack scenario:

Attacker submits: { "url": "https://api.service.com/data", "__proto__": { "headers": { "X-Admin": "true" } } }
↓
Axios merges this into config without sanitizing __proto__
↓
All subsequent requests inherit X-Admin: true header
↓
Backend service sees X-Admin header and grants admin privileges

The Fix

What Changed

The fix involved upgrading Axios from version 1.15.1 to 1.15.2 across two files:

File 1: agent/sandbox/sandbox_base_image/nodejs/package.json

  "dependencies": {
-   "axios": "^1.15.1"
+   "axios": "^1.15.2"
  }

File 2: agent/sandbox/sandbox_base_image/nodejs/package-lock.json

  "node_modules/axios": {
-   "version": "1.15.1",
-   "resolved": "https://registry.npmjs.org/axios/-/axios-1.15.1.tgz",
-   "integrity": "sha512-WOG+Jj8ZOvR0a3rAn+Tuf1UQJRxw5venr6DgdbJzngJE3qG7X0kL83CZGpdHMxEm+ZK3seAbvFsw4FfOfP9vxg==",
+   "version": "1.15.2",
+   "resolved": "https://registry.npmjs.org/axios/-/axios-1.15.2.tgz",
+   "integrity": "sha512-wLrXxPtcrPTsNlJmKjkPnNPK2Ihe0hn0wGSaTEiHRPxwjvJwT3hKmXF4dpqxmPO9SoNb2FsYXj/xEo0gHN+D5A==",

How This Fixes the Vulnerability

Axios 1.15.2 patches the prototype pollution vulnerability by implementing proper prototype chain checks in its object merging logic. The patch adds validation to prevent special prototype-related keys from being processed:

// Fixed pattern in Axios 1.15.2
// Proper prototype pollution prevention
function mergeConfig(target, source) {
  // Skip prototype pollution keys
  const PROTOTYPE_POLLUTION_KEYS = ['__proto__', 'constructor', 'prototype'];

  for (const key in source) {
    if (PROTOTYPE_POLLUTION_KEYS.includes(key)) {
      continue; // Skip dangerous keys
    }
    target[key] = source[key];
  }
  return target;
}

Security Improvements

  1. Prototype Chain Protection: The new version prevents attackers from modifying Object.prototype, Array.prototype, or custom class prototypes through configuration merging
  2. Request Configuration Isolation: Each request's configuration is now properly isolated, preventing cross-request pollution
  3. Backward Compatibility: The fix maintains full API compatibility—existing code continues to work without modification

The integrity hash change (sha512-WOG+...sha512-wLrX...) confirms that the package contents have been updated with the security patch.


Prevention & Best Practices

Immediate Actions

  1. Update Axios immediately to 1.15.2 or later in all projects using vulnerable versions
  2. Scan your dependencies using tools like npm audit, snyk, or trivy to identify other prototype pollution vulnerabilities
  3. Review request configuration code to identify places where user input is merged into request objects

Long-Term Security Practices

1. Validate and Sanitize Configuration Sources

// ✓ GOOD: Whitelist allowed configuration keys
const ALLOWED_KEYS = ['timeout', 'method', 'params', 'data'];
const sanitizedConfig = {};
for (const key of ALLOWED_KEYS) {
  if (key in userInput) {
    sanitizedConfig[key] = userInput[key];
  }
}

2. Use Object.create(null) for Configuration Objects

// ✓ GOOD: Create objects without prototype chain
const config = Object.create(null);
config.timeout = 5000;
// Prototype pollution attempts will fail

3. Implement Strict Property Checking

// ✓ GOOD: Check for dangerous keys before merging
function safeObjectMerge(target, source) {
  const dangerousKeys = ['__proto__', 'constructor', 'prototype'];
  for (const key in source) {
    if (!dangerousKeys.includes(key) && 
        Object.prototype.hasOwnProperty.call(source, key)) {
      target[key] = source[key];
    }
  }
  return target;
}

4. Keep Dependencies Updated
- Use npm audit regularly to identify vulnerable packages
- Enable automated dependency updates with Dependabot or similar tools
- Test updates in CI/CD before deploying to production

5. Use Security Linters
- Configure ESLint with security plugins to catch unsafe patterns
- Use Semgrep rules to detect prototype pollution patterns
- Integrate static analysis into your CI/CD pipeline

Detection Tools

  • Trivy: Container and dependency vulnerability scanner (detected this vulnerability)
  • Semgrep: Static analysis tool with prototype pollution detection rules
  • npm audit: Built-in npm vulnerability scanner
  • Snyk: Comprehensive dependency security platform
  • OWASP Dependency-Check: Open-source dependency vulnerability scanner

Key Takeaways

  • Prototype pollution in Axios 1.15.1 could allow attackers to inject malicious properties into all HTTP requests made by the sandbox environment
  • The vulnerability exists in object merging logic that doesn't validate prototype-related keys (__proto__, constructor, prototype)
  • Upgrading to Axios 1.15.2 implements proper prototype chain protection and is fully backward compatible
  • Whitelist configuration keys rather than blacklisting dangerous ones—this prevents similar vulnerabilities from being introduced
  • Use Object.create(null) for configuration objects to eliminate prototype chain inheritance entirely
  • Static analysis tools like Trivy can automatically detect vulnerable dependency versions in your supply chain

How Orbis AppSec Detected This

Source: HTTP request configuration in agent/sandbox/sandbox_base_image/nodejs/ that processes user-influenced input

Sink: Axios request configuration merging in version 1.15.1's object property assignment logic

Missing control: Axios 1.15.1 lacks validation for prototype pollution keys (__proto__, constructor, prototype) in its configuration merge function

CWE: CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes)

Fix: Upgrade Axios from 1.15.1 to 1.15.2, which implements proper prototype chain validation in object merging

Orbis AppSec automatically detected this vulnerability through static analysis and opened a pull request with the fix. The vulnerability was confirmed by Trivy's CVE-2026-42264 rule, and the fix was verified to maintain backward compatibility while eliminating the attack surface. Try Orbis AppSec on your repositories to find and fix issues like this automatically.


Conclusion

Prototype pollution vulnerabilities in HTTP clients like Axios can have serious consequences for applications that make external API calls or handle user-influenced request configurations. The upgrade from Axios 1.15.1 to 1.15.2 eliminates this specific vulnerability by implementing proper prototype chain protection in the request configuration merging logic.

This fix demonstrates the importance of:
- Staying current with security patches for critical dependencies
- Implementing defense-in-depth with input validation and property whitelisting
- Using automated security scanning to detect vulnerable dependency versions before they reach production

By following the prevention practices outlined in this post and maintaining up-to-date dependencies, you can significantly reduce the risk of prototype pollution and similar supply chain vulnerabilities in your Node.js applications.


References

Frequently Asked Questions

What is prototype pollution?

Prototype pollution is a vulnerability where an attacker modifies JavaScript object prototypes to inject malicious properties that affect all objects in the application. In Axios, this could allow attackers to poison the request configuration object, affecting all subsequent HTTP requests.

How do you prevent prototype pollution in Node.js?

Validate and sanitize all user input before using it in object operations, use `Object.create(null)` to create objects without prototypes, implement strict property whitelisting, and keep dependencies like Axios updated to the latest patched versions.

What CWE is prototype pollution?

Prototype pollution is classified under CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes) and related to CWE-94 (Improper Control of Generation of Code).

Is input validation enough to prevent prototype pollution in Axios?

Input validation alone is insufficient; the fix requires patching Axios itself. However, validating that user input doesn't contain prototype pollution payloads (like `__proto__`, `constructor`, or `prototype` keys) provides defense-in-depth.

Can static analysis detect prototype pollution?

Yes, modern static analysis tools like Semgrep and Trivy can detect prototype pollution patterns by identifying unsafe object merging operations and flagging vulnerable dependency versions, as Trivy did in this case.

View the Security Fix

Check out the pull request that fixed this vulnerability

View PR #17508

Related Articles

high

How HTTP Transport Hijacking via Prototype Pollution happens in Node.js axios and how to fix it

A high-severity vulnerability (CVE-2026-42033) in axios 1.13.6 allowed attackers to hijack HTTP transport behavior through prototype pollution, potentially redirecting sensitive requests to attacker-controlled servers. The fix upgrades axios to 1.15.1 and proxy-from-env to 2.1.0 in a Node.js sandbox base image used in production, eliminating the attack vector.

high

How HTTP Transport Hijacking via Prototype Pollution happens in Node.js axios and how to fix it

CVE-2026-42033 is a high-severity prototype pollution vulnerability in axios versions prior to 1.15.1 that could allow attackers to hijack HTTP transport configuration through malicious input. This vulnerability affects any Node.js application using vulnerable axios versions to make HTTP requests. The fix involves upgrading axios to version 1.15.1, which patches the prototype pollution flaw and prevents transport layer attacks.

critical

How JSON request validation bypass happens in Node.js API handlers and how to fix it

A critical validation bypass in the `/api/agents/jobs` endpoint allowed attackers to send malformed JSON with arbitrary properties that could trigger prototype pollution or unexpected behavior. The fix added comprehensive validation checks including array detection and property existence verification to prevent malicious payloads from reaching downstream processing logic.

high

How prototype pollution via `__proto__` key happens in Node.js defu and how to fix it

A high-severity prototype pollution vulnerability (CVE-2026-35209) was discovered in the `defu` package version 6.1.4, which allowed attackers to inject properties into JavaScript's `Object.prototype` via the `__proto__` key in defaults arguments. The fix upgrades `defu` to version 6.1.5 in the frontend's dependency tree, protecting downstream consumers like `c12` and `dotenv` configuration loaders from malicious property injection.

high

Prototype Pollution in defu's Defaults Argument via `__proto__` Key (CVE-2026-35209)

CVE-2026-35209 is a high-severity prototype pollution vulnerability in the `defu` JavaScript library (versions prior to 6.1.5) that allows attackers to inject arbitrary properties onto `Object.prototype` by passing a `__proto__` key in the defaults argument. The vulnerability was present in the `blog-site` project's dependency tree and was resolved by upgrading `defu` to 6.1.5 and adding an explicit `overrides` entry to prevent transitive re-introduction of the vulnerable version.

high

How broken access control via supply chain dependency poisoning happens in TYPO3 with Dependabot and how to fix it

A missing cooldown configuration in Dependabot allowed the automatic proposal of newly published (and potentially malicious) package versions, creating a supply chain attack vector that could have facilitated the exploitation of CVE-2026-47343 — a broken access control vulnerability in TYPO3's File Abstraction Layer. The fix adds a 7-day cooldown period to all package ecosystem entries in `.github/dependabot.yml`, ensuring newly published packages are vetted by the community before being propose