/

CVE-2026-40175

Severity:

CRITICAL RISK

(10.0)

Server-Side Request Forgery and HTTP Header Manipulation

CVE-2026-40175

Undergoing Analysis

Vulnerability type

Category:

Server-Side Request Forgery and HTTP Header Manipulation Gadget Chain

CWE:

CWE-113, CWE-444, CWE-918

Impact:

Remote Code Execution and Cloud Instance Compromise

Severity:

CRITICAL RISK

(10.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Axios, a popular HTTP client for browsers and Node.js, contains a gadget-style attack chain that allows existing Prototype Pollution bugs in third‑party dependencies to be escalated into powerful network‑level attacks.

When Axios is used in polluted runtime environments, crafted requests can be turned into Remote Code Execution or full cloud compromise via AWS IMDSv2 bypass.

Affected context

This vulnerability arises when Axios is used in environments where:

  • The JavaScript runtime or object prototypes can be polluted by another vulnerability
  • Axios is used on the server side (Node.js) to make outbound HTTP requests to internal or cloud metadata services
  • Application logic constructs requests dynamically from partially untrusted data (e.g., URLs, headers, or options coming from user-controllable sources)

The issue affects applications that treat Axios as a building block in larger systems; Axios itself acts as a gadget that can be driven by prior Prototype Pollution to reach sensitive internal services or inject crafted headers.

Exploit preconditions

  • Attack surface: Server-side Axios usage (Node.js services, backends, serverless functions, or microservices) that make HTTP(S) requests to internal services or cloud infrastructure endpoints.
  • Required access:
  • A separate Prototype Pollution vulnerability in the application or a dependency, allowing an attacker to corrupt global or shared objects used as Axios configuration sources.
  • Ability to influence request parameters (URL, headers, method, or config objects) that Axios consumes.
  • Trigger point: Any code path that:
  • Uses polluted objects or prototypes to build Axios request configuration, or
  • Relies on Axios' default behaviors that read from polluted structures when constructing headers or target URLs.
  • Why exploitation is possible: Axios' request handling and header construction can be coerced—via polluted prototypes—into:
  • Issuing SSRF requests to attacker-chosen internal targets, and
  • Manipulating headers in ways that bypass cloud metadata protections (e.g., IMDSv2) and potentially enable code execution on the instance.

Why this happens

The core issue is that Axios, like many HTTP abstraction libraries, assumes its configuration objects and environment are trustworthy and does not defend against Prototype Pollution by design.

In a polluted environment, inherited properties on configuration objects (e.g., Object.prototype) can be interpreted as legitimate Axios options, URLs, or headers.

This maps primarily to:

  • CWE-918: Server-Side Request Forgery (SSRF), as Axios can be driven to contact internal or metadata endpoints.
  • CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting'), due to unsafe use or interpretation of header values.
  • CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request Smuggling'), where crafted header and request combinations may be interpreted differently by intermediaries.

Axios effectively becomes a gadget that an attacker can chain after a Prototype Pollution flaw to escalate from data corruption to high‑impact network‑level compromise.

Potential impact

  • Remote Code Execution on cloud instances by abusing access to metadata services and credentials.
  • Full cloud account or role compromise via AWS IMDSv2 bypass and subsequent credential theft.
  • Server-Side Request Forgery against internal services, control planes, or management endpoints.
  • Exfiltration of sensitive configuration, tokens, and secrets reachable from the vulnerable service.
  • Pivoting within internal networks, enabling lateral movement and broader service compromise.
  • Abuse of internal-only APIs leading to data tampering, privilege escalation, or service disruption.

General mitigation guidance

Effective mitigation typically focuses on reducing Axios' exposure to polluted configuration and hardening its use as a network primitive, rather than relying on version-specific fixes:

  • Treat Axios configs as untrusted input:
  • Construct Axios configuration objects using fresh, plain objects rather than merging in global or shared structures.
  • Avoid Object.assign or spread operations with data that may originate from user input or third-party libraries.
  • Constrain outbound network access:
  • Enforce egress controls, such as network policies or firewall rules, to prevent Axios from reaching cloud metadata services and other sensitive internal endpoints.
  • Use explicit allowlists for hostnames or IP ranges that Axios is permitted to contact.
  • Harden header and URL handling:
  • Normalize and validate URLs, methods, and headers before passing them into Axios.
  • Reject or sanitize values that contain control characters, unsafe schemes, or internal-only hostnames when sourced from untrusted data.
  • Reduce trust in the runtime environment:
  • Limit or avoid libraries known for Prototype Pollution risk where possible; prefer well-maintained utilities that defend against polluted keys.
  • Run services with least privilege and short-lived credentials so that any SSRF-based credential theft is less impactful.
  • Defense-in-depth:
  • Apply metadata service protections at the cloud/platform level (IMDS configuration, hop limits, or complete disablement where feasible).
  • Separate roles and responsibilities so a single compromised service cannot directly administer your entire cloud environment.

How teams detect issues like this

Detecting this class of issue involves combining static analysis, code review, and runtime monitoring:

  • Static analysis and linters:
  • Flag patterns where Axios configuration objects are created by merging arbitrary objects (e.g., axios(configFromUser) or spreading request bodies/params into config).
  • Detect use of shared/global objects (including process.env or app-wide config) being mutated before being passed to Axios.
  • Identify calls that build URLs or headers directly from user-controllable data without validation.
  • Code review signals:
  • Usage of generic merge utilities (lodash.merge, deepMerge, custom mergeConfig) that can propagate polluted prototypes into Axios configs.
  • Axios calls targeting internal URLs (e.g., 169.254.169.254, metadata endpoints, admin services) without strict guardrails.
  • Patterns where the same object is reused across requests or modules, especially if it's enriched from request data.
  • Runtime and operational monitoring:
  • Monitor outbound traffic from services using Axios for anomalous destinations, particularly metadata endpoints and internal admin interfaces.
  • Use WAFs, service meshes, or egress proxies to log and optionally block suspicious SSRF-like traffic.
  • Automated review tools:
  • Incorporate SAST tools into CI that understand Prototype Pollution sinks and HTTP client gadget patterns.
  • Use dependency scanning and SBOM analysis to track libraries commonly associated with Prototype Pollution and ensure they're not feeding Axios configuration inadvertently.

Sources

SourceLink
github.comgithub.com/axios/axios/commit/03cdfc99e8db32a390e12128208b6778492cee9c
github.comgithub.com/axios/axios/commit/363185461b90b1b78845dc8a99a1f103d9b122a1
github.comgithub.com/axios/axios/pull/10660
github.comgithub.com/axios/axios/pull/10688
github.comgithub.com/axios/axios/releases/tag/v0.31.0
github.comgithub.com/axios/axios/releases/tag/v1.15.0
github.comgithub.com/axios/axios/security/advisories/GHSA-fvcv-3m26-pcqx
github.comgithub.com/axios/axios/pull/10660#issuecomment-4224168081

Frequently asked

questions

No. Axios acts as a gadget in a larger attack chain. Exploitation typically requires a separate Prototype Pollution vulnerability that allows an attacker to corrupt objects used as Axios configuration, which can then be leveraged for SSRF and further escalation.

An attacker generally needs the ability to influence request-related data or to trigger a Prototype Pollution issue in the application or its dependencies. With that, they can shape Axios' behavior to target internal services or metadata endpoints from the compromised service.

Architect your Axios usage so that it never consumes polluted or mixed-trust configuration: construct new, minimal config objects for each request, validate and normalize URLs and headers, and enforce strict allowlists for outbound destinations. Combine this with network-level controls that prevent access to metadata services and sensitive internal endpoints.

Systematically reduce trust in shared objects and global configuration, avoid merging untrusted data into client configs, and adopt dependency hygiene practices that minimize Prototype Pollution exposure. Enforce outbound network policies, use automated static analysis to catch dangerous HTTP client patterns, and design services so that a single HTTP client misuse cannot lead to full cloud compromise.

Find out what's already
exploitable in your codebase.