Junglewise Threat Intelligence

Axios prototype pollution in Basic auth subfields

Severity: medium · CVSS 4 · Published 2026-08-01

Executive brief

Axios, a popular HTTP client library used in Node.js and browser applications, contains a prototype pollution gadget in its Basic authentication handling. If an application using axios is already vulnerable to prototype pollution from another source, attackers can hijack authentication credentials on outbound requests by polluting Object.prototype properties. This allows an attacker to inject fake credentials into requests, intercept and modify Authorization headers, or cause authentication failures on downstream services. While axios itself does not create the prototype pollution, it amplifies the impact when combined with other vulnerabilities in the application.

Technical details

The vulnerability is a prototype-pollution read-side gadget in lib/adapters/http.js and lib/helpers/resolveConfig.js. When an application already affected by prototype pollution makes an axios request with an incomplete auth object (e.g., auth: {} or auth: {username: 'user'} without password), axios reads configAuth.username and configAuth.password directly without using hasOwnProp() guards, causing the reads to walk the prototype chain and pick up polluted Object.prototype values. The attacker-controlled values are then Base64-encoded and sent as an 'Authorization: Basic ...' header in the outbound HTTP request. This requires two conditions: (1) the host application must have a separate prototype-pollution primitive, and (2) the axios call must pass an incomplete own auth object. The fix applies hasOwnProp() guards to username and password subfield reads, matching the pattern already used for proxy authentication.

Affected products

  • npm axios >=1.15.2, <1.18.0

Timeline

  • 2026-08-01: disclosed: Advisory GHSA-38gx-cfqf-f652 published (marked as duplicate of GHSA-xj6q-8x83-jv6g)
  • 2026: patched: Fixed in axios >= 1.18.0

References