CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-42042

CVE-2026-42042: XSRF Token Cross-Origin Leakage via Prototype Pollution in Axios

Amit Schendel
Amit Schendel
Senior Security Researcher

May 5, 2026·6 min read·97 visits

Executive Summary (TL;DR)

A vulnerability in Axios allows XSRF tokens to leak to cross-origin servers. This occurs when loose boolean evaluation in the configuration logic is bypassed via an external Prototype Pollution gadget.

Axios, a widely used JavaScript HTTP client, contains a vulnerability where loose truthiness checks on the `withXSRFToken` configuration property permit Cross-Site Request Forgery (XSRF) token leakage. This occurs when an application is vulnerable to Prototype Pollution, allowing attackers to short-circuit same-origin validation checks and extract anti-CSRF tokens to cross-origin servers.

Vulnerability Overview

Axios serves as a foundational HTTP client in modern web and Node.js ecosystems, responsible for managing requests, responses, and security headers. A core security feature provided by Axios is automatic Cross-Site Request Forgery (CSRF/XSRF) token management, which extracts tokens from cookies and attaches them to outgoing request headers. This feature is intended to operate under strict same-origin policies to prevent token leakage.

CVE-2026-42042 exposes a flaw in how Axios validates the target origin before attaching these sensitive tokens. The vulnerability resides in the configuration resolution logic, specifically within the evaluation of the withXSRFToken property. A design flaw utilizing loose truthiness semantics enables an environment-level manipulation to bypass security constraints.

When combined with a separate Prototype Pollution vulnerability within the hosting application, attackers can manipulate the global object prototype chain. This manipulation injects a truthy, non-boolean value into the Axios configuration resolution process. The resulting logical short-circuit overrides the same-origin validation, causing Axios to append the XSRF token to requests destined for attacker-controlled infrastructure.

Root Cause Analysis

The root cause of this vulnerability stems from unsafe type coercion within JavaScript's logical operators. The configuration resolution logic within lib/helpers/resolveConfig.js relies on a conditional statement to determine if an XSRF token should be appended to the current request. This condition evaluates the withXSRFToken property using a standard logical OR (||) operator.

The specific vulnerable construct is if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))). In JavaScript, the || operator short-circuits if the left-hand operand evaluates to any truthy value. Because the code does not enforce strict boolean typing, values such as the integer 1, strings, or objects evaluate as true.

When the left-hand side evaluates to true, the right-hand side of the expression is ignored entirely. Consequently, the critical isURLSameOrigin(newConfig.url) function is never executed. The logic implicitly trusts the truthy value and proceeds to attach the XSRF token to the request headers, completely disregarding the destination URL.

Code Analysis

Analyzing the configuration resolution logic reveals exactly how the validation failure manifests. The application attempts to support both explicit configuration and automatic same-origin detection. This dual-purpose design introduces the logic gap when combined with polluted prototypes.

// Vulnerable code in lib/helpers/resolveConfig.js
// Evaluates to true for any truthy value (e.g., 1, "true", {})
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
  // Token extraction and header attachment logic
}

In the presence of prototype pollution, withXSRFToken is inherited from Object.prototype. If Object.prototype.withXSRFToken = 1, the first condition passes, and origin validation is skipped. The patched versions (1.15.1 and 0.31.1) correct this logic by enforcing strict equality checks and utilizing nullish semantics. This ensures only an explicitly defined boolean true bypasses the same-origin verification.

// Fixed code logic
// Requires strict boolean true to force cross-origin token transmission
const requiresToken = withXSRFToken === true || 
                      (withXSRFToken == null && isURLSameOrigin(newConfig.url));
 
if (requiresToken) {
  // Token extraction and header attachment logic
}

By requiring withXSRFToken === true, injected prototype properties like 1 or "true" fail the strict equality check. The fallback logic then properly executes isURLSameOrigin because the inherited property does not equal null or undefined.

Exploitation Methodology

Exploitation of CVE-2026-42042 requires the presence of an independent Prototype Pollution vulnerability within the application or its dependency tree. The attacker must first leverage this separate flaw to pollute the global Object.prototype. The objective is to establish the specific gadget required by the Axios logic flaw.

The attacker injects a payload that sets a non-boolean truthy value onto the prototype chain. A typical payload achieves Object.prototype.withXSRFToken = 1. Once established, any standard JavaScript object created without an explicit withXSRFToken property inherits this value during property lookup.

The victim application then initializes an Axios request to a cross-origin resource controlled by the attacker. During request configuration, Axios reads newConfig.withXSRFToken. Since the configuration object lacks this key, the JavaScript engine traverses the prototype chain and returns the polluted value 1.

The Axios logic interprets the inherited 1 as truthy, bypasses the isURLSameOrigin check, and appends the X-XSRF-TOKEN to the outgoing request headers. The attacker monitors the receiving server logs and captures the leaked credential.

Impact Assessment

The direct security impact of this vulnerability is the compromise of anti-CSRF tokens. These tokens are generated by backend services to cryptographically bind state-changing requests to the authenticated user's session. When these tokens are leaked to an external party, the primary defense against Cross-Site Request Forgery is neutralized.

With the extracted XSRF token, an attacker constructs malicious cross-origin requests that the backend service authenticates and authorizes. This enables the attacker to perform state-changing actions on behalf of the victim, such as modifying account details, initiating unauthorized transactions, or elevating privileges within the context of the vulnerable application.

The vulnerability scores a CVSS of 5.4, reflecting a Medium severity. The score accounts for the network attack vector and low complexity, but is constrained by the requirement for user interaction and the specific precondition of an existing Prototype Pollution flaw. The EPSS score remains low at 0.00035, indicating limited active exploitation in the wild.

Mitigation and Remediation

The definitive remediation for CVE-2026-42042 is updating the Axios library to a patched release. Development teams must upgrade their dependencies to version 1.15.1 or version 0.31.1, depending on the major version branch currently in use. This update replaces the vulnerable loose truthiness checks with strict boolean evaluation.

In environments where immediate patching is not feasible, defensive programming practices mitigate the underlying prototype pollution vector. Implementing Object.freeze(Object.prototype) prevents unauthorized modification of the global prototype chain, neutralizing the gadget required for this Axios vulnerability.

Applications parsing untrusted user input should transition to using Map objects or Object.create(null) for dictionary storage. These structures do not inherit from Object.prototype, rendering them immune to prototype pollution injection techniques. Security teams verify dependency trees using software composition analysis tools to identify indirect inclusions of vulnerable Axios versions.

Technical Appendix

CVSS Score
5.4/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
EPSS Probability
0.03%
Top 90% most exploited

Affected Systems

Node.js applications utilizing AxiosWeb applications bundling AxiosApplications with untrusted input parsing leading to Prototype Pollution

Affected Versions Detail

Product
Affected Versions
Fixed Version
axios
axios
>= 1.0.0, < 1.15.11.15.1
axios
axios
< 0.31.10.31.1
AttributeDetail
CWE IDCWE-697
Attack VectorNetwork
CVSS v3.15.4
EPSS Score0.00035
ImpactXSRF Token Leakage
Exploit Statuspoc

MITRE ATT&CK Mapping

T1557Adversary-in-the-Middle
Collection
T1539Steal Web Session Cookie
Credential Access
T1592.002Gather Victim Network Information: Domain Properties
Reconnaissance
CWE-697
Incorrect Comparison

The software evaluates a condition using an incorrect or unsafe comparison mechanism, relying on loose truthiness rather than strict boolean equality.

Vulnerability Timeline

Fixes implemented in Axios repository
2026-04-07
Official CVE-2026-42042 published
2026-04-24
CVE record updated with additional CWE and CVSS data
2026-04-27

References & Sources

  • [1]Official Advisory
  • [2]CVE Record
  • [3]NVD Entry
  • [4]Wiz Vulnerability Database

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•14 minutes ago•CVE-2026-114151
8.8

CVE-2026-114151: Remote Code Execution via Stack-Based Buffer Overflow in Microsoft Visual Studio and .NET Symbol Reader

CVE-2026-114151 is a high-severity remote code execution vulnerability affecting Microsoft Visual Studio 2026 and multiple supported versions of the Microsoft .NET runtime on Windows. The flaw resides in the native Debug Information Access (DIA) symbol reader component, Microsoft.DiaSymReader.Native. When parsing Program Database (.pdb) files, the component fails to validate the length of serialized numeric records (specifically LF_DECIMAL structures) before unpacking them into a fixed-size stack buffer. An attacker who convinces a user or automated diagnostic process to load a crafted .pdb file can trigger a stack-based buffer overflow, resulting in arbitrary code execution within the context of the host process.

Alon Barad
Alon Barad
0 views•9 min read
•about 1 hour ago•GHSA-6856-87HX-P5X7
7.5

CVE-2026-105544: Local Elevation of Privilege in .NET Test Platform CLI

CVE-2026-105544 is a high-severity local elevation of privilege vulnerability in Microsoft .NET and Microsoft.TestPlatform.CLI. Improper access control on local inter-process communication mechanisms and execution brokers allows an authorized local attacker to cross security boundaries and execute arbitrary code in the context of a higher-privileged user running a test execution cycle.

Amit Schendel
Amit Schendel
3 views•9 min read
•about 3 hours ago•CVE-2026-114152
8.8

CVE-2026-114152: Stack-Based Buffer Overflow and Untrusted Pointer Dereference in Microsoft DiaSymReader.Native

CVE-2026-114152 is a high-severity remote code execution vulnerability affecting Microsoft Visual Studio 2026 and multiple servicing branches of the Microsoft .NET runtime (.NET 8.0, 9.0, 10.0, and 11.0) on Windows platforms. The vulnerability exists within the native symbol reader library, Microsoft.DiaSymReader.Native, specifically inside the DiaObjectFile::ApplyFixup method during the processing of Common Object File Format (COFF) relocation records. By supplying a malformed object file or Program Database (PDB) symbol file containing out-of-bounds relocation offsets or invalid symbol table indices, an unauthenticated attacker can trigger an untrusted pointer dereference (CWE-822) and a stack-based buffer overflow (CWE-121). Successful exploitation occurs when a victim opens, compiles, or debugs a malicious project or symbol artifact, leading to arbitrary code execution within the security context of the active developer environment or build process.

Amit Schendel
Amit Schendel
5 views•11 min read
•about 4 hours ago•CVE-2026-118745
8.8

CVE-2026-118745: Remote Code Execution via Heap-Based Buffer Overflow in Microsoft Visual Studio and .NET DiaSymReader

CVE-2026-118745 is a high-severity remote code execution vulnerability affecting Microsoft Visual Studio 2026 and multiple supported versions of the .NET runtime (8.0, 9.0, 10.0, and 11.0) on Windows systems. The flaw is a heap-based buffer overflow (CWE-122) located within the native symbol reading library, Microsoft.DiaSymReader.Native, specifically in the routines responsible for extracting and parsing Program Database (.pdb) line number metadata. An attacker can exploit this vulnerability by supplying a crafted .pdb file alongside a repository, project, or compiled binary. When a developer or automated diagnostic process parses the malformed debug symbols, an out-of-bounds heap write occurs, permitting arbitrary code execution within the security context of the active user process.

Amit Schendel
Amit Schendel
7 views•10 min read
•about 5 hours ago•CVE-2026-109481
7.5

CVE-2026-109481: Cross-Site Request Forgery Leading to Elevation of Privilege in ASP.NET Core

CVE-2026-109481 is a high-severity Cross-Site Request Forgery (CSRF) vulnerability in the ASP.NET Core Blazor Server and interactive component architecture. The flaw exists within the internal circuit state synchronization endpoint (`/_blazor/refresh`), which fails to enforce antiforgery token validation or verify cross-origin request headers. By inducing an authenticated victim to issue a cross-site request targeting a pre-allocated circuit identifier, an unauthenticated attacker can bind the victim's security principal to the attacker's active SignalR circuit, resulting in full privilege elevation within the application scope.

Amit Schendel
Amit Schendel
6 views•9 min read
•about 6 hours ago•CVE-2026-126187
9.5

CVE-2026-126187: Unauthenticated Remote Code Execution in React Server Components

A critical deserialization vulnerability exists in React Server Components (RSC) packages (`react-server-dom-webpack`, `react-server-dom-parcel`, and `react-server-dom-turbopack`) across versions 19.0.0 through 19.3.0. The flaw occurs during the processing of React Flight protocol streams when handling multiple typed arrays sharing a backing ArrayBuffer alongside attacker-controlled inputs. By combining byte-stream buffer detachment semantics with unvalidated thenable invocation and exposed internal response states, an unauthenticated attacker can achieve remote code execution on server runtimes supporting React Server Components.

Alon Barad
Alon Barad
24 views•11 min read