chore(deps): update dependency axios to v1.15.2 [security]#312
Open
renovate[bot] wants to merge 1 commit intomasterfrom
Open
chore(deps): update dependency axios to v1.15.2 [security]#312renovate[bot] wants to merge 1 commit intomasterfrom
renovate[bot] wants to merge 1 commit intomasterfrom
Conversation
5510323 to
7f36d11
Compare
7f36d11 to
9f016f7
Compare
73f0c62 to
194ac42
Compare
194ac42 to
e7e5933
Compare
e7e5933 to
a23160a
Compare
a23160a to
965074c
Compare
b7da973 to
346608c
Compare
346608c to
1fb9157
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.12.2→1.15.2Axios is Vulnerable to Denial of Service via proto Key in mergeConfig
CVE-2026-25639 / GHSA-43fc-jf86-j433
More information
Details
Denial of Service via proto Key in mergeConfig
Summary
The
mergeConfigfunction in axios crashes with a TypeError when processing configuration objects containing__proto__as an own property. An attacker can trigger this by providing a malicious configuration object created viaJSON.parse(), causing complete denial of service.Details
The vulnerability exists in
lib/core/mergeConfig.jsat lines 98-101:When
propis'__proto__':JSON.parse('{"__proto__": {...}}')creates an object with__proto__as an own enumerable propertyObject.keys()includes'__proto__'in the iterationmergeMap['__proto__']performs prototype chain lookup, returningObject.prototype(truthy object)mergeMap[prop] || mergeDeepPropertiesevaluates toObject.prototypeObject.prototype(...)throwsTypeError: merge is not a functionThe
mergeConfigfunction is called by:Axios._request()atlib/core/Axios.js:75Axios.getUri()atlib/core/Axios.js:201get,post, etc.) atlib/core/Axios.js:211,224PoC
Reproduction steps:
npm install axiospoc.mjswith the code abovenode poc.mjsVerified output (axios 1.13.4):
Control tests performed:
{"timeout": 5000}JSON.parse('{"__proto__": {"x": 1}}'){"headers": {"X-Test": "value"}}Attack scenario:
An application that accepts user input, parses it with
JSON.parse(), and passes it to axios configuration will crash when receiving the payload{"__proto__": {"x": 1}}.Impact
Denial of Service - Any application using axios that processes user-controlled JSON and passes it to axios configuration methods is vulnerable. The application will crash when processing the malicious payload.
Affected environments:
This is NOT prototype pollution - the application crashes before any assignment occurs.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios has Unrestricted Cloud Metadata Exfiltration via Header Injection Chain
CVE-2026-40175 / GHSA-fvcv-3m26-pcqx
More information
Details
Vulnerability Disclosure: Unrestricted Cloud Metadata Exfiltration via Header Injection Chain
Summary
The Axios library is vulnerable to a specific "Gadget" attack chain that allows Prototype Pollution in any third-party dependency to be escalated into Remote Code Execution (RCE) or Full Cloud Compromise (via AWS IMDSv2 bypass).
While Axios patches exist for preventing check pollution, the library remains vulnerable to being used as a gadget when pollution occurs elsewhere. This is due to a lack of HTTP Header Sanitization (CWE-113) combined with default SSRF capabilities.
Severity: Critical (CVSS 9.9)
Affected Versions: All versions (v0.x - v1.x)
Vulnerable Component:
lib/adapters/http.js(Header Processing)Usage of "Helper" Vulnerabilities
This vulnerability is unique because it requires Zero Direct User Input.
If an attacker can pollute
Object.prototypevia any other library in the stack (e.g.,qs,minimist,ini,body-parser), Axios will automatically pick up the polluted properties during its config merge.Because Axios does not sanitise these merged header values for CRLF (
\r\n) characters, the polluted property becomes a Request Smuggling payload.Proof of Concept
1. The Setup (Simulated Pollution)
Imagine a scenario where a known vulnerability exists in a query parser. The attacker sends a payload that sets:
2. The Gadget Trigger (Safe Code)
The application makes a completely safe, hardcoded request:
3. The Execution
Axios merges the prototype property
x-amz-targetinto the request headers. It then writes the header value directly to the socket without validation.Resulting HTTP traffic:
4. The Impact (IMDSv2 Bypass)
The "Smuggled" second request is a valid
PUTrequest to the AWS Metadata Service. It includes the requiredX-aws-ec2-metadata-token-ttl-secondsheader (which a normal SSRF cannot send).The Metadata Service returns a session token, allowing the attacker to steal IAM credentials and compromise the cloud account.
Impact Analysis
Cookie,Authorization) to pivot into internal administrative panels.Hostheaders to poison shared caches.Recommended Fix
Validate all header values in
lib/adapters/http.jsandxhr.jsbefore passing them to the underlying request function.Patch Suggestion:
References
This report was generated as part of a security audit of the Axios library.
Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios has a NO_PROXY Hostname Normalization Bypass that Leads to SSRF
CVE-2025-62718 / GHSA-3p68-rc4w-qgx5
More information
Details
Axios does not correctly handle hostname normalization when checking
NO_PROXYrules.Requests to loopback addresses like
localhost.(with a trailing dot) or[::1](IPv6 literal) skipNO_PROXYmatching and go through the configured proxy.This goes against what developers expect and lets attackers force requests through a proxy, even if
NO_PROXYis set up to protect loopback or internal services.According to RFC 1034 §3.1 and RFC 3986 §3.2.2, a hostname can have a trailing dot to show it is a fully qualified domain name (FQDN). At the DNS level,
localhost.is the same aslocalhost.However, Axios does a literal string comparison instead of normalizing hostnames before checking
NO_PROXY. This causes requests likehttp://localhost.:8080/andhttp://[::1]:8080/to be incorrectly proxied.This issue leads to the possibility of proxy bypass and SSRF vulnerabilities allowing attackers to reach sensitive loopback or internal services despite the configured protections.
PoC
Expected: Requests bypass the proxy (direct to loopback).
Actual: Proxy logs requests for
localhost.and[::1].Impact
Applications that rely on
NO_PROXY=localhost,127.0.0.1,::1for protecting loopback/internal access are vulnerable.Attackers controlling request URLs can:
Affected Versions
NO_PROXYevaluation.Remediation
Axios should normalize hostnames before evaluating
NO_PROXY, including:Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:L/SI:L/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios: Header Injection via Prototype Pollution
CVE-2026-42035 / GHSA-6chq-wfr3-2hj9
More information
Details
Summary
A prototype pollution gadget exists in the Axios HTTP adapter (lib/adapters/http.js) that allows an attacker to inject arbitrary HTTP headers into outgoing requests. The vulnerability exploits duck-type checking of the data payload, where if Object.prototype is polluted with getHeaders, append, pipe, on, once, and Symbol.toStringTag, Axios misidentifies any plain object payload as a FormData instance and calls the attacker-controlled getHeaders() function, merging the returned headers into the outgoing request.
The vulnerable code resides exclusively in lib/adapters/http.js. The prototype pollution source does not need to originate from Axios itself — any prototype pollution primitive in any dependency in the application's dependency tree is sufficient to trigger this gadget.
Prerequisites:
A prototype pollution primitive must exist somewhere in the application's dependency chain (e.g., via lodash.merge, qs, JSON5, or any deep-merge utility processing attacker-controlled input). The pollution source is not required to be in Axios.
The application must use Axios to make HTTP requests with a data payload (POST, PUT, PATCH).
Details
The vulnerability is in
lib/adapters/http.js, in the data serialization pipeline:Axios uses two sequential duck-type checks, both of which can be satisfied via prototype pollution:
1.
utils.isFormData(data)—lib/utils.js2.
utils.isFunction(data.getHeaders)— Duck-type forform-datanpm packagePoC
Impact
Note on Scope: There is an argument to promote this from S:U to S:C (Scope: Changed), which would raise the score to 10.0. In some architectures, Axios is commonly used for service to service communication where downstream services trust identity headers (
Authorization,X-Role,X-User-ID,X-Tenant-ID) forwarded from upstream API gateways. In this scenario, the vulnerable component (Axios in Service A) and the impacted component (Service B, which acts on the injected identity) are under different security authorities. The injected headers cross a trust boundary, meaning the impact extends beyond the security scope of the vulnerable component, the CVSS v3.1 definition of a Scope Change. We conservatively score S:U here, but maintainers should evaluate which one applies better here.Recommended Fix
Add an explicit own-property check in
lib/adapters/http.js:Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios: Invisible JSON Response Tampering via Prototype Pollution Gadget in
parseReviverCVE-2026-42044 / GHSA-3w6x-2g7m-8v23
More information
Details
Vulnerability Disclosure: Invisible JSON Response Tampering via Prototype Pollution Gadget in
parseReviverSummary
The Axios library is vulnerable to a Prototype Pollution "Gadget" attack that allows any
Object.prototypepollution in the application's dependency tree to be escalated into surgical, invisible modification of all JSON API responses — including privilege escalation, balance manipulation, and authorization bypass.The default
transformResponsefunction atlib/defaults/index.js:124callsJSON.parse(data, this.parseReviver), wherethisis the merged config object. BecauseparseReviveris not present in Axios defaults, not validated byassertOptions, and not subject to any constraints, a pollutedObject.prototype.parseReviverfunction is called for every key-value pair in every JSON response, allowing the attacker to selectively modify individual values while leaving the rest of the response intact.This is strictly more powerful than the
transformResponsegadget because:Severity: Critical (CVSS 9.1)
Affected Versions: All versions (v0.x - v1.x including v1.15.0)
Vulnerable Component:
lib/defaults/index.js:124(JSON.parse with prototype-inherited reviver)CWE
CVSS 3.1
Score: 9.1 (Critical)
Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:NapiKey: "sk-secret-internal-key"is capturedisAdmin: false → true,role: "viewer" → "admin",balance: 100 → 999999. The response looks completely normal except for the surgically altered valuesComparison with All Known Axios PP Gadgets
Object.prototype['header']Object.prototype.transformResponseObject.prototype.proxyObject.prototype.parseRevivertruetruetrue(obvious)this.auth+ raw responseassertOptionsvalidatesUsage of "Helper" Vulnerabilities
This vulnerability requires Zero Direct User Input.
If an attacker can pollute
Object.prototypevia any other library in the stack (e.g.,qs,minimist,lodash,body-parser), the pollutedparseReviverfunction is automatically used by every Axios request that receives a JSON response. The developer's code is completely safe — no configuration errors needed.Root Cause Analysis
The Attack Path
Why
parseReviverBypasses ALL Existing ProtectionsNot in defaults (
lib/defaults/index.js):parseReviveris not defined in the defaults object, somergeConfig'sObject.keys({...defaults, ...userConfig})iteration never encounters it. The merged config has no ownparseReviverproperty.Not in assertOptions schema (
lib/core/Axios.js:135-142): The schema only contains{baseUrl, withXsrfToken}.parseReviveris not validated.No type check: The
JSON.parseAPI accepts any function as a reviver. There is no check thatthis.parseReviveris intentionally set.Works INSIDE the default transform: Unlike
transformResponsepollution (which replaces the entire transform and is caught byassertOptions),parseReviverpollution injects into the DEFAULTtransformResponsefunction'sJSON.parsecall. The default function itself is not replaced, soassertOptionshas nothing to catch.Vulnerable Code
File:
lib/defaults/index.js, line 124Proof of Concept
Verified PoC Output
Impact Analysis
1. Authorization / Privilege Escalation
2. Financial Manipulation
3. Security Control Bypass
4. Silent Data Exfiltration
The reviver function receives the original value before modification. The attacker can silently capture all API keys, tokens, internal data, and PII from every JSON response while the application continues to function normally.
5. Universal and Invisible
Recommended Fix
Fix 1: Use
hasOwnPropertycheck before usingparseReviverFix 2: Use null-prototype config object
Fix 3: Validate
parseRevivertype and sourceRelationship to Other Reported Gadgets
This vulnerability shares the same root cause class — unsafe prototype chain traversal on the merged config object — with two other reported gadgets:
transformResponsemergeConfig.js:49(defaultToConfig2)mergeConfig.jstrueproxyhttp.js:670(direct property access)http.jsparseReviverdefaults/index.js:124(this.parseReviver)defaults/index.jsWhy These Are Distinct Vulnerabilities
Object.prototypekey.transformResponseenters viamergeConfig;proxyis read directly byhttp.js;parseReviveris read inside the defaulttransformResponsefunction'sJSON.parsecall.mergeConfig.js(axios_26) does NOT fixdefaults/index.js:124(this vulnerability). Fixinghttp.js:670(axios_30) does NOT fix this either. Each requires a separate patch.transformResponseis constrained to returntrue;proxyrequires a proxy server;parseReviverenables constraint-free selective value modification.Comprehensive Fix
While each vulnerability requires a location-specific patch, the comprehensive fix is to use null-prototype objects (
Object.create(null)) for the merged config inmergeConfig.js, which would eliminate prototype chain traversal for all config property accesses and address all three gadgets at once. The maintainer may choose to assign a single CVE covering the root cause or separate CVEs for each distinct exploitation path — we defer to the maintainer's judgment on this.Resources
Timeline
Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios: Null Byte Injection via Reverse-Encoding in AxiosURLSearchParams
CVE-2026-42040 / GHSA-xhjh-pmcv-23jw
More information
Details
Vulnerability Disclosure: Null Byte Injection via Reverse-Encoding in AxiosURLSearchParams
Summary
The
encode()function inlib/helpers/AxiosURLSearchParams.jscontains a character mapping (charMap) at line 21 that reverses the safe percent-encoding of null bytes. AfterencodeURIComponent('\x00')correctly produces the safe sequence%00, the charMap entry'%00': '\x00'converts it back to a raw null byte.This is a clear encoding defect: every other charMap entry encodes in the safe direction (literal → percent-encoded), while this single entry decodes in the opposite (dangerous) direction.
Severity: Low (CVSS 3.7)
Affected Versions: All versions containing this charMap entry
Vulnerable Component:
lib/helpers/AxiosURLSearchParams.js:21CWE
CVSS 3.1
Score: 3.7 (Low)
Vector:
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:NbuildURL) uses its ownencodefunction which does NOT have this bug. Only triggered via directAxiosURLSearchParams.toString()without an encoder, or via customparamsSerializerdelegationVulnerable Code
File:
lib/helpers/AxiosURLSearchParams.js, lines 13-26Why the Standard Flow Is NOT Affected
Proof of Concept
Verified PoC Output
Impact Analysis
Primary impact is limited because the standard axios request flow is not affected. However:
AxiosURLSearchParamsdirectly for custom serialization are affectedparamsSerializer.encodethat delegates to the internal encoder triggers the bugIf null bytes reach a downstream C-based parser, impacts include URL truncation, WAF bypass, and log injection.
Recommended Fix
Remove the
%00entry from charMap and update the regex:Resources
Timeline
Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios: HTTP adapter streamed responses bypass maxContentLength
CVE-2026-42036 / GHSA-vf2m-468p-8v99
More information
Details
Summary
When responseType: 'stream' is used, Axios returns the response stream without enforcing maxContentLength. This bypasses configured response-size limits and allows unbounded downstream consumption.
Details
In lib/adapters/http.js:
So callers may set maxContentLength and still receive/read arbitrarily large streamed responses.
PoC
Environment:
Steps:
Observed:
Control check:
Impact
Type: DoS / unbounded response processing.
Impacted: Node.js applications relying on maxContentLength as a safety boundary while using streamed Axios responses.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios: Prototype Pollution Gadgets - Response Tampering, Data Exfiltration, and Request Hijacking
CVE-2026-42033 / GHSA-pf86-5x62-jrwf
More information
Details
Summary
When
Object.prototypehas been polluted by any co-dependency with keys that axios reads without ahasOwnPropertyguard, an attacker can (a) silently intercept and modify every JSON response before the application sees it, or (b) fully hijack the underlying HTTP transport, gaining access to request credentials, headers, and body. The precondition is prototype pollution from a separate source in the same process -- lodash < 4.17.21, or any of several other common npm packages with known PP vectors. The two gadgets confirmed here work independently.Background: how mergeConfig builds the config object
Every axios request goes through
Axios._requestinlib/core/Axios.js#L76:Inside
mergeConfig, the merged config is built as a plain{}object (lib/core/mergeConfig.js#L20):A plain
{}inherits fromObject.prototype.mergeConfigonly iteratesObject.keys({ ...config1, ...config2 })(line 99), which is a spread of own properties. Any key that is absent from boththis.defaultsand the per-request config will never be set as an own property on the merged config. Reading that key later on the merged config falls through toObject.prototype. That is the root mechanism behind all gadgets below.Gadget 1: parseReviver -- response tampering and exfiltration
Introduced in: v1.12.0 (commit 2a97634, PR #5926)
Affected range: >= 1.12.0, <= 1.13.6
Root cause
The default
transformResponsefunction callsJSON.parse(data, this.parseReviver):thisis the merged config.parseReviveris not present indefaultsand is not in themergeMapinsidemergeConfig. It is never set as an own property on the merged config. Accessingthis.parseRevivertherefore walks the prototype chain.The call fires by default on every string response body because
lib/defaults/transitional.js#L5sets:which activates the JSON parse path unconditionally when
responseTypeis unset.JSON.parse(text, reviver)calls the reviver for every key-value pair in the parsed result, bottom-up. The reviver's return value is what the caller receives. An attacker-controlled reviver can both observe every key-value pair and silently replace values.There is no interaction with
assertOptionshere. TheassertOptionscall inAxios._request(line 119) iteratesObject.keys(config), and sinceparseReviverwas never set as an own property, it is not in that list. Nothing validates or invokes the polluted function beforetransformResponsedoes.Verification: own-property check
Proof of concept
Two terminals. The server simulates a legitimate API endpoint. The client simulates a Node.js application whose process has been affected by prototype pollution from a co-dependency.
Terminal 1 -- server (
server_gadget1.mjs):Terminal 2 -- client (
poc_parsereviver.mjs):The server sent
role: user. The application receivedrole: admin. The response is silently modified in place; no error is thrown, no log entry is produced.Gadget 2: transport -- full HTTP request hijacking with credentials
Introduced in: early adapter refactor, present across 0.x and 1.x
Affected range: >= 0.19.0, <= 1.13.6 (Node.js http adapter only)
Root cause
Inside the Node.js http adapter at
lib/adapters/http.js#L676:transportis listed inmergeMapinsidemergeConfig(line 88):but it is not present in
lib/defaults/index.jsat all.mergeConfigiteratesObject.keys({ ...config1, ...config2 })(line 99). Sinceconfig1(the defaults) has notransportkey and a typical per-request config has none either, the key never enters the loop. It is never set as an own property on the merged config. The read at line 676 falls through toObject.prototype.The fix in v1.13.5 (PR #7369) added a
hasOwnPropcheck formergeMapaccess, but the iteration set itself is the issue --transportsimply never enters it. The fix does not address this.The transport interface is
{ request(options, handleResponseCallback) }. The options object passed totransport.requestat adapter runtime contains:options.hostname,options.port,options.path-- full target URLoptions.auth-- basic auth credentials in"username:password"form (set at line 606)options.headers-- all request headers as a plain objectProof of concept
Two terminals. The server is a legitimate API endpoint that processes the request normally. The client's process has been affected by prototype pollution.
Terminal 1 -- server (
server_gadget2.mjs):Terminal 2 -- client (
poc_transport.mjs):The basic auth credentials are fully visible to the attacker's transport function. The request completes normally from the caller's perspective.
Additional gadget: transformRequest / transformResponse
Separately,
mergeConfigreadsconfig2[prop]at line 102 without ahasOwnPropertyguard. For keys liketransformRequestandtransformResponsethat are present indefaults(and therefore processed by the mergeMap loop), ifObject.prototype.transformRequestis polluted before the request,config2["transformRequest"]inherits the polluted value anddefaultToConfig2replaces the safe default transforms with the attacker's function.This one requires a discriminator because
assertOptionsinAxios._request(line 119) readsschema[opt]for every key in the merged config's own keys, andschema["transformRequest"]also inherits fromObject.prototype, causing it to call the polluted value as a validator. The gadget function needs to returntruewhen its first argument is a function (the assertOptions call) and perform the attack when its first argument is data (thetransformDatacall).Both
transformRequest(fires with request body) andtransformResponse(fires with response body) are confirmed affected. Range: >= 0.19.0, <= 1.13.6.Why the existing fix does not cover these
PR #7369 / CVE-2026-25639 (fixed in v1.13.5) addressed a separate class: passing
{"__proto__": {"x": 1}}as the config object, which causedmergeMap['__proto__']to resolve toObject.prototype(a non-function), crashing axios. The fix added an explicit block on__proto__,constructor, andprototypeas config keys, and changedmergeMap[prop]to `utils.hasOwnProp(mergeMap,