Vulnerability DatabaseGHSA-w7cm-vp9h-3qp4

GHSA-w7cm-vp9h-3qp4: 
JavaScript vulnerability analysis and mitigation

Summary

In Axios 1.12.2 through 1.20.0, the fetch adapter can read an inherited fetch value from a polluted Object.prototype when no own env.fetch is configured. An application also needs a separate prototype-pollution source. A truthy non-function value prevents fetch-adapter requests; a callable value can replace the transport if the pollution source can install one.

Impact

Data-only pollution of Object.prototype.fetch with a truthy string causes affected requests to fail with ERR_NOT_SUPPORT. This affects explicit adapter: 'fetch' use and runtimes where Axios selects fetch because the earlier adapters are unavailable. A callable polluted value can observe request headers and return a fabricated response, but the report has not shown an attacker-reachable way to supply that callable. The default Node HTTP path and browser XHR path do not use this gadget. The issue is in runtime request dispatch, not package installation or build tooling.

Affected Functionality

Axios requests using the fetch adapter without an own env.fetch are affected. Axios’s default adapter order is ['xhr', 'http', 'fetch']; fetch-only environments can therefore reach this path by default. Supplying an own env.fetch value prevents the inherited value from being selected. Adapter defaults, selection code.

Technical Details

utils.merge() creates an ordinary object. The fetch adapter seeds own Request and Response properties, but no own fetch, then destructures fetch from that object. getFetch() also destructures fetch from env without an own-property check. An inherited truthy non-function makes the adapter report itself unsupported; an inherited function becomes _fetch and handles the request. Merge implementation, fetch adapter reads, transport selection, cache-key read.

Proof of Concept of Attack

This local demonstration uses a data: URL and dummy credentials. Assignments to Object.prototype simulate a separate pollution primitive; they are not themselves a remote exploit.

import axios from 'axios';
const url = 'data:text/plain,original';
Object.prototype.fetch = 'polluted';
try {
  await axios.get(url, {adapter: 'fetch'});
} catch (error) {
  console.log(error.code); // ERR_NOT_SUPPORT
} finally {
  delete Object.prototype.fetch;
}
Object.prototype.fetch = async request => {
  console.log(request.headers.get('authorization')); // Bearer demo
  return new Response('forged');
};
try {
  const response = await axios.get(url, {
    adapter: 'fetch',
    headers: {Authorization: 'Bearer demo'}
  });
  console.log(response.data); // forged
} finally {
  delete Object.prototype.fetch;
}

The second half demonstrates what a function-valued pollution source could do; the advisory does not establish such a source.

Workarounds

Where native fetch is available, set an own env.fetch: null on the Axios instance or affected requests so Axios uses native fetch. I verified this on v1.12.2 and v1.20.0. Environments using a custom fetch implementation can supply that trusted function as an own env.fetch value. <details> <summary><h3>Original report</h3></summary>

Summary

axios's fetch adapter contains a residual prototype-pollution gadget of exactly the class that THREATMODEL.md T-R4b declares in scope and that multiple prior GHSAs fixed: an unguarded destructure from a merged env object picks up Object.prototype.fetch when no own fetch property exists (the default). The polluted function is then adopted as the actual transport for every request that goes through the fetch adapter — explicit adapter: 'fetch', or the automatic choice in environments without XHR and without the Node http adapter (Cloudflare Workers, service workers, edge runtimes). An attacker function receives every request including credential headers (Authorization, Cookie, X-Api-Key) and its return value is treated as the server response: a full request/response MITM. T-R4b's residual-risk note literally requires that "destructures from a merged config must use a hasOwnProp guard" — this is the one spot where that rule is not followed.

Details

The flaw. In factory(), the env object is built with utils.merge seeding only own keys Request and Response — fetch is never seeded (lib/adapters/fetch.js#L85-L94). The subsequent destructure reads through the prototype chain (lib/adapters/fetch.js#L96): const { fetch: envFetch, Request, Response } = env; so when config.env has no own fetch (default configuration), envFetch resolves to a polluted Object.prototype.fetch. That value becomes the actual send/receive implementation via let _fetch = envFetch || fetch (lib/adapters/fetch.js#L228). This is the only unguarded read of its kind left. The same codebase neutralizes every other gadget enumerated by T-R4b: mergeConfig.js per-prop hasOwnProp guards and mergeDirectKeys (fix for GHSA-w9j2-pvgh-6h63), defaults/index.js own() wrapper (fix for GHSA-3w6x-2g7m-8v23), http.js hasOwnProp reads for transport/httpAgent/lookup (fix for the GHSA-pf86-5x62-jrwf gadget set, and the high-severity GHSA-q8qp-cvcw-x6jj), resolveConfig.js withXSRFToken strict check (fix for GHSA-xx6v-rp6x-q39c), regression tests in tests/unit/prototypePollution.test.js. Even within the same file, later config reads use an own() hasOwnProp wrapper (lib/adapters/fetch.js#L226), and adapters.js installs null-prototype name descriptors specifically so a polluted Object.prototype.get cannot subvert adapter selection (lib/adapters/adapters.js#L28-L30). The env destructure is the single spot where the documented guard rule is missing. Threat model. T-R4b (THREATMODEL.md#L136-L144) enumerates gadget classes including "transport / httpAgent / lookup (MITM / intercept)" with self-assessed impact "High … credential leakage", and states the likelihood as "Low to Medium (requires a polluted prototype somewhere in the process, historically common)". The non-goal for monkey-patched runtime APIs (THREATMODEL.md#L241-L242) does not apply: the polluted value arrives through Object.prototype from a different library in the dependency tree — precisely the scenario axios commits to defending. Reachability. The gadget fires whenever the fetch adapter handles a request: explicit adapter: 'fetch' (a documented configuration), or by default in runtimes where XMLHttpRequest and the Node http adapter are both unavailable — service workers, Cloudflare Workers and other edge runtimes (knownAdapters selection, lib/adapters/adapters.js#L16-L22). The default http adapter path is not affected (verified as a control group in the PoC).

PoC

The PoC (full source in the first comment below) imports the in-tree axios source, simulates the documented T-R4b precondition (Object.prototype.fetch polluted by an unrelated dependency), and issues one axios.get with adapter: 'fetch' carrying Authorization: Bearer SECRET-TOKEN-123 and X-Api-Key. Observed: --- polluted fetch observed the request --- url : https://api.internal.example/v1/account method : GET headers: { authorization: 'Bearer SECRET-TOKEN-123', 'x-api-key': 'KEY-XYZ', ... } --- caller received the forged response --- data : { balance: 0, isAdmin: true, note: 'forged by Object.prototype.fetch' } VULNERABLE (credentials intercepted): true VULNERABLE (response forged) : true The attacker function sees the full request (URL, method, every credential header) and its fabricated Response is returned to the application — e.g. { isAdmin: true } driving an authorization bypass at the business layer. Run: npm ci --ignore-scripts at the repo root, then node report/fetch-adapter-prototype-pollution-mitm/poc/poc.mjs. A control run without adapter: 'fetch' (default Node http adapter) is unaffected.

Impact

  • Type: prototype-pollution read-side gadget (CWE-1321) in the fetch adapter → request/response MITM.
  • Who is impacted: applications using adapter: 'fetch' explicitly, or running axios in fetch-only runtimes (service workers, Cloudflare Workers, edge), when any dependency in the process has a prototype-pollution primitive — the historically common precondition T-R4b assumes.
  • Effect: the attacker intercepts every request through the fetch adapter — credential headers (Authorization, Cookie, X-Api-Key) and request bodies are exfiltrated — and forges every response, enabling arbitrary business-logic manipulation (auth bypass, data tampering) in the application's own origin/trust domain.
  • Constraints: requires a pre-existing pollution source elsewhere in the process (AC:H); the Node http default path is unaffected.
  • Suggested fix: guard the destructure per the T-R4b residual-risk rule — e.g. seed fetch: globalObject.fetch alongside Request/Response in the merge, or read envFetch via utils.hasOwnProp(env, 'fetch') ? env.fetch : undefined; add a regression test mirroring tests/unit/prototypePollution.test.js for the fetch-adapter env path.

</details>


Source: NVD

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-j7r2-xppq-m353HIGH7.5
  • JavaScript logoJavaScript
  • websocket-driver
NoYesNov 28, 2026
GHSA-w7cm-vp9h-3qp4MEDIUM6.3
  • JavaScript logoJavaScript
  • axios
NoYesNov 28, 2026
GHSA-mw39-9473-h7mrMEDIUM6.3
  • JavaScript logoJavaScript
  • axios
NoYesNov 28, 2026
GHSA-v2qg-6486-r9rfLOW2.3
  • JavaScript logoJavaScript
  • axios
NoYesNov 28, 2026
GHSA-jm66-q5wm-qf72MEDIUMN/A
  • JavaScript logoJavaScript
  • orbitdb-relay
NoNoNov 28, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management