Repository navigation
chore(deps): update dependency axios@>=1.0.0 <1.13.5 to v1.20.0 [security] - #6435
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
|
✅ Meticulous spotted 0 visual differences across 32 screens tested: view results. Meticulous evaluated ~4 hours of user flows against your PR. Expected differences? Click here. Last updated for commit |
renovate
Bot
force-pushed
the
renovate/npm-axios-=1.0.0-1.13.5-vulnerability
branch
from
October 25, 2026 04:40
53c31bf to
5f393c8
Compare
renovate
Bot
force-pushed
the
renovate/npm-axios-=1.0.0-1.13.5-vulnerability
branch
from
October 25, 2026 10:07
5f393c8 to
e09386e
Compare
renovate
Bot
force-pushed
the
renovate/npm-axios-=1.0.0-1.13.5-vulnerability
branch
from
October 25, 2026 12:34
e09386e to
901db3a
Compare
renovate
Bot
force-pushed
the
renovate/npm-axios-=1.0.0-1.13.5-vulnerability
branch
from
October 25, 2026 17:19
901db3a to
6315b5d
Compare
renovate
Bot
force-pushed
the
renovate/npm-axios-=1.0.0-1.13.5-vulnerability
branch
from
October 25, 2026 21:57
6315b5d to
bb1163a
Compare
renovate
Bot
force-pushed
the
renovate/npm-axios-=1.0.0-1.13.5-vulnerability
branch
from
October 26, 2026 02:12
bb1163a to
7296700
Compare
This branch was successfully deployed
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.
Note
This PR body was truncated due to platform limits.
This PR contains the following updates:
1.18.0→1.20.0](https://renovatebot.com/diffs/npm/axios@>=1.0.0 <1.13.5/1.18.0/1.20.0)Axios: HTTP/2 adapter bypasses configured DNS lookup and proxy controls
CVE-2026-101898 / GHSA-3pq3-5fj3-cg6v
More information
Details
Summary
Axios for Node.js does not apply configured DNS lookup or proxy controls when a request uses
httpVersion: 2. The HTTP/1 adapter path wraps and forwardsconfig.lookup, builds normal request options, and applies proxy routing throughsetProxy(). The HTTP/2 path builds a session withhttp2.connect()using onlyoptions.http2Options, which drops the top-levellookup,agent, and proxy state.Applications are affected when they allow a user to influence request destinations, enable axios HTTP/2, and rely on axios
lookupor proxy routing to prevent SSRF or enforce outbound network policy.Impact
In affected server-side deployments, an attacker can cause axios to connect directly to destinations that the configured resolver or proxy would have rejected. Depending on reachable services, this can expose cloud metadata, internal service responses, or allow state-changing requests to internal systems.
This is not an unconditional SSRF in every axios deployment. It requires
httpVersion: 2and an application-level trust boundary where user-influenced URLs are constrained bylookupor proxy policy.Affected Functionality
Affected:
httpVersion: 2.config.lookupsupplied as a DNS policy.config.proxyand environment-derived proxy settings for HTTPS HTTP/2 requests.Not affected:
lookupto the transport and apply proxy handling.Technical Details
In
lib/adapters/http.js, the adapter readslookup, wraps it, stores it on the requestoptions, and appliessetProxy()before selecting a transport. For HTTP/2,http2Transport.request()builds an authority fromoptions.protocol,options.hostname, andoptions.port, then calls:lib/helpers/Http2Sessions.jsultimately callshttp2.connect(authority, options)with only thehttp2Optionsobject. The configured DNS lookup and the proxy or tunneling agent installed on the top-level request options are not forwarded into that call.Local verification on axios
1.18.1showedlookupCalls: 0while an HTTP/2 request to a local h2 origin succeeded. A second local HTTPS h2 verification with an explicit rejecting HTTP proxy showed the origin received the request and the proxy observed no traffic.Proof of Concept of Attack
Local constrained demonstration:
axios.get("http://localhost:<port>/internal", { httpVersion: 2, lookup })wherelookupthrowsEPOLICY.0.For proxy routing:
httpVersion: 2,http2Options: { rejectUnauthorized: false }, and explicitproxy.Expected safe behavior is that either the lookup policy blocks the request or the proxy observes and rejects the request.
Workarounds
Use the HTTP/1 adapter path for requests that depend on axios
lookupor proxy controls. Alternatively, enforce destination allow/deny policy before calling axios, outside the adapter transport path.Original report
Summary
I found that Axios does not apply the configured
lookupfunction or proxy when a request useshttpVersion: 2. The HTTP/1 adapter applies both controls, but the HTTP/2 path connects straight to the URL's hostname usinghttp2.connect().This matters for server applications that accept a user-influenced URL and use a custom DNS lookup or mandatory outbound proxy to prevent SSRF. Switching the Axios instance to HTTP/2 silently removes those controls, allowing the request to reach an address the application intended to block.
I reproduced this on the current npm release, Axios 1.18.1.
Details
The HTTP adapter reads and wraps the caller's
lookupfunction, builds the normal request options, and callssetProxy():lib/adapters/http.js, around lines 530-578: reads and wrapslookuplib/adapters/http.js, around lines 895-954: addslookuptooptionsand appliessetProxy()For HTTP/2, however, the adapter selects
http2Transport. That transport creates an authority from the destination and only passesoptions.http2Optionsto the session pool:lib/helpers/Http2Sessions.jsthen calls:At this point
optionsis only thehttp2Optionsobject. The top-levellookup, the proxy tunnelling agent created bysetProxy(), and the selectedhttpAgent/httpsAgentare not forwarded. The request therefore uses the system resolver and opens a direct connection to the origin.The same root cause affects both explicit proxy configuration and environment-derived proxy configuration. I kept the PoC local and used an explicit proxy so the result does not depend on shell environment variables.
PoC
I attached axios_http2_transport_controls_poc.mjs. The PoC is entirely local and sets up three pieces:
REACHED_BLOCKED_ORIGIN.502 Bad Gateway.lookupcallback that rejects every DNS lookup with anEPOLICYerror.The first request is an HTTP/1 control request. It uses the blocking
lookupcallback and has proxying disabled. Axios calls the callback, receivesEPOLICY, and does not reach the origin. This confirms that the callback works and that the hostname is blocked through the normal adapter path.The second request targets the same URL with
httpVersion: 2. It is given both security controls: the same blockinglookupcallback and the rejecting proxy. If Axios honors either one, this request cannot reach the origin. It should fail withEPOLICY, or it should reach the proxy and receive its502response.Instead, the request returns HTTP 200 with
REACHED_BLOCKED_ORIGIN. The lookup counter does not increase, and the proxy records no request or CONNECT attempt. The origin is the only server that records traffic. This shows that the HTTP/2 path skipped both controls and connected directly using the system resolver.To reproduce, run the attachment from the root of an Axios checkout:
Run it from the root of an Axios checkout:
Relevant output from my run:
{ "axiosVersion": "1.18.1", "configuredControls": { "lookup": "reject every DNS lookup with EPOLICY", "proxy": "http://127.0.0.1:<port> (reject every request)" }, "http1Control": "EPOLICY: blocked by application DNS policy", "http2Result": { "status": 200, "data": "REACHED_BLOCKED_ORIGIN" }, "lookupCalls": 1, "proxyObservedTraffic": false, "events": [ { "server": "origin", "protocol": "h2", "path": "/internal" } ] }The important parts of the output are:
http1ControlcontainsEPOLICY, proving the DNS policy blocks the destination under HTTP/1.lookupCallsis still1after both requests, proving HTTP/2 never called the configured resolver.proxyObservedTrafficisfalse, proving HTTP/2 did not use the configured proxy.http2Result.statusis200, and the sole event belongs to the origin, proving Axios connected directly to the blocked destination.Impact
The vulnerable configuration is a Node.js application that:
httpVersion: 2;lookupoption or proxy routing to enforce a destination or egress policy.In that setup, an unauthenticated application user may be able to make the server connect directly to loopback, private-network, or link-local services that the lookup policy or proxy would have rejected. Depending on the reachable service, this can expose cloud credentials or internal data, modify internal services, or affect availability.
HTTP/2 support is marked experimental, but neither the HTTP/2 documentation nor the proxy documentation says that
lookupand proxy controls are ignored. The proxy documentation states that HTTPS requests are sent through a CONNECT tunnel. More importantly, Axios's threat model tells callers that destination validation is their responsibility; this behavior silently bypasses such caller-supplied validation.I did not test against any third-party or production service. The PoC only uses listeners on my own machine.
Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios: Prototype Pollution Gadget in axios toFormData Options
CVE-2026-101909 / GHSA-x97p-jq2g-jp4f
More information
Details
Summary
Axios form serialization reads
visitor,maxDepth,dots,indexes,metaTokens, andBlobfrom an internal options object without own-property guards. WhenObject.prototypehas been polluted elsewhere in the same process, those inherited values can change how axios serializes multipart and URL-encoded request bodies.Axios does not create the prototype pollution source. This is a read-side gadget: axios turns an existing same-process pollution condition into altered request serialization or request failures.
Impact
The impact depends on which property is polluted and which axios serialization path the application uses.
Polluted
dots,indexes, ormetaTokenscan change field names and cause the receiving service to parse different data than the caller intended. PollutedmaxDepthcan cause nested form submissions to throwERR_FORM_DATA_DEPTH_EXCEEDED, producing request-level or service-level denial of service for affected workflows. Pollutedvisitorcan execute as the serializer visitor if an attacker can place a function onObject.prototype, but that condition generally implies a stronger same-process code-execution or malicious-dependency primitive and should be described carefully.Affected Functionality
Affected:
axios.toFormData().transformRequestpaths that serialize plain objects tomultipart/form-data.formSerializeroption defaults when the relevant properties are absent as own properties.Not affected:
toFormData().Object.prototypeis not polluted.Technical Details
lib/helpers/toFormData.jsmerges caller options with defaults usingutils.toFlatObject(). Whenoptionsisundefined,toFlatObject()returns the default object unchanged:That default object has
Object.prototypein its prototype chain.toFormData()then reads behavior-affecting values directly:These reads can resolve inherited polluted properties.
Local code review confirmed the direct reads in
v1.18.1. Tag checks show the option-based form serializer exists inv0.28.0and later;maxDepthappears in the1.xline from the form recursion fix.Proof of Concept of Attack
Constrained local demonstration:
Expected safe behavior is that the default max depth is used unless the caller sets an own
formSerializer.maxDepth. Current behavior reads the inherited value and can throwERR_FORM_DATA_DEPTH_EXCEEDED.For serializer alteration, polluting
Object.prototype.dots = truechanges nested field naming from bracket notation to dot notation when the caller did not opt into that behavior.Workarounds
Avoid serializing attacker-controlled objects as form data in a process with known prototype pollution. As a partial mitigation, callers can pass an own
formSerializerobject that sets explicit safe values for all relevant keys, includingvisitor,maxDepth,dots,indexes,metaTokens, andBlob.Original report
Summary
axios v1.18.1 contains a read-side prototype pollution gadget in its form data serialization logic. Six option properties (
visitor,maxDepth,dots,indexes,metaTokens,Blob) are read from a plain JavaScript object that inherits fromObject.prototypewithouthasOwnPropertyguards. WhenObject.prototypehas been polluted elsewhere in the process a common consequence of compromised transitive npm dependencies, these polluted values silently control axios' form serialization behavior.The highest-impact gadget is
visitor: a polluted function onObject.prototype.visitoris invoked for every key-value pair during multipart and URL-encoded form serialization, receiving the value, key, path, and internal helper functions as arguments.Details
Root Cause
The attack chain has three steps:
Step 1:
formSerializeris read safely, butundefinedflows throughIn
lib/defaults/index.js, the defaulttransformRequestfunction readsformSerializerfrom config using theown()helper, which enforceshasOwnProp:When the user does not explicitly configure
formSerializer, this correctly returnsundefined. Thatundefinedis then passed as theoptionsparameter totoFormData():Step 2:
toFlatObjectreturns a plain-object defaultInside
lib/helpers/toFormData.js,options(which isundefined) is merged with defaults viautils.toFlatObject():toFlatObjecthas an early-return for null/undefined sources:Since
optionsisundefined, the function returnsdestObjunchanged — the plain object{ metaTokens: true, dots: false, indexes: false }. This object's prototype isObject.prototype.Step 3: Options are read without
hasOwnPropguardsThe six option properties are read directly from the plain object:
None of these reads use
utils.hasOwnProp(). Since theoptionsobject inherits fromObject.prototype, any property set onObject.prototypeby a compromised dependency is resolved through the prototype chain.Why the Existing Defenses Didn't Catch This
axios has extensive prototype pollution defenses. However, those defenses are all focused on the config object (created by
mergeConfig, which returnsObject.create(null)). ThetoFormDatafunction creates its own internal options object that sits outside that boundary, and the 6 reads on that internal object were never audited.PoC
Reproduction Steps
Environment
Any environment with Node.js and npm. Tested on:
- Node.js v24.15.0, npm 11.13.0
- axios v1.18.1 (latest release at time of writing)
Step 1: Create a fresh project
mkdir axios-pp-poc cd axios-pp-poc npm init -y npm install axios@1.18.1Step 2: Create the PoC file
Create
poc.mjswith the following content:Step 3: Run the PoC
Impact
1. Data Exfiltration via
visitor(Confidentiality: High)A polluted
Object.prototype.visitorfunction is called as the form data visitor:The attacker receives:
-
value— the raw value being serialized (passwords, tokens, PII, API keys)-
key— the field name-
path— the full path array (e.g.,['profile', 'address', 'street'])-
exposedHelpers— internal helpers includingdefaultVisitor,convertValue,isVisitableBy delegating to
helpers.defaultVisitor, the attack is completely transparent, the request succeeds normally and the server receives intact data. The exfiltration is invisible to both the caller and the server.2. Denial of Service via
maxDepth(Availability: Low)A polluted
Object.prototype.maxDepthof1or2causes any moderately nested form data request to throwERR_FORM_DATA_DEPTH_EXCEEDED. Applications that send nested objects as form data (common with APIs that acceptprofile[name],address[city], etc.) will experience mysterious failures.3. Data Corruption via
dots,indexes,metaTokens(Integrity: Low)Polluting these options changes the serialization format of form field names:
-
dots: true— changes bracket notation (user[name]) to dot notation (user.name)-
indexes: true— changes array serialization (items[]) to indexed (items[0],items[1])-
metaTokens: false— changesobj{}keys to raw json stringsThe server may misinterpret the submitted form data, leading to silent data corruption.
Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios: Prototype-Pollution Gadget in the Default Instance Allows Inherited Object.prototype.method to Override HTTP Method
CVE-2026-101902 / GHSA-9fr6-4gfg-395g
More information
Details
Summary
Axios default-instance requests that omit an explicit method can read an inherited
methodvalue fromObject.prototype. If another vulnerability in the same process pollutesObject.prototype.method, calls such asaxios.request({ url })andaxios({ url })can send a state-changing HTTP method instead of the expected defaultGET.Axios does not create the prototype pollution source. This is a read-side gadget in axios request dispatch.
Impact
In an affected application with a separate prototype-pollution primitive, an attacker can change axios default-instance requests that omit
methodfromGETto methods such asDELETE,POST,PUT, orPATCH. The practical impact depends on the target endpoint and can include unintended writes, deletion, or other state changes.Method aliases such as
axios.get(url)and requests with an explicit ownmethodare not affected by the confirmed method path.Affected Functionality
Affected:
axios.request({ url }).axios({ url }).config.methodis provided.Not affected in the confirmed method PoC:
axios.get(url)and other method aliases.axios.request({ url, method: 'GET' }).axios.create().request({ url })when the created instance defaults are produced by currentmergeConfig()and do not inherit fromObject.prototype.Technical Details
lib/core/Axios.jssets the request method with:mergeConfig()now returns a null-prototype request config, soconfig.methodis safe fromObject.prototype. However, the default axios instance stores the module defaults object asthis.defaults, and that defaults object is a normal object. IfObject.prototype.methodexists,this.defaults.methodresolves to the polluted inherited value.Local verification on axios
1.18.1showed a default-instanceaxios.request({ url })request reaching a loopback server asDELETEafterObject.prototype.method = 'DELETE'.Proof of Concept of Attack
Constrained local demonstration:
Expected safe behavior is a
GETrequest. Current affected behavior sendsDELETEon the default instance when no method is provided.Workarounds
Use explicit method aliases such as
axios.get()or set an ownmethodon request configs. Avoid default-instance shorthand for requests in processes where prototype pollution is suspected or possible.Original report
Summary
Axios
1.17.0contains a read-side prototype-pollution gadget in the default Axios instance. If another vulnerability in the same Node.js process pollutesObject.prototype.method, default-instance calls such asaxios.request({ url })andaxios({ url })can be forced to use an attacker-controlled HTTP method, such asDELETE, instead of the expected defaultGET.Axios does not create the prototype pollution by itself. The issue is that Axios reads fallback values from
this.defaultswithout an own-property guard, allowing inherited values fromObject.prototypeto influence request behavior.This should be treated as a prototype-pollution gadget, not as a standalone prototype-pollution source. In other words, Axios is not the component that lets the attacker write to
Object.prototype; Axios is the component that becomes dangerous afterObject.prototypehas already been polluted by another bug in the same process.Details
The vulnerable fallback read is in
lib/core/Axios.js:The merged request
configis created as a null-prototype object inlib/core/mergeConfig.js:Therefore, when the caller does not provide
config.method, the fallback becomes:The default Axios instance uses the module defaults object. In the tested version, that defaults object is affected by inherited properties from
Object.prototype. IfObject.prototype.methodis polluted,this.defaults.methodresolves to that inherited value and Axios uses it as the request method.The same unsafe inherited-property pattern also affects
this.defaults.allowAbsoluteUrls, which can change how absolute URLs are combined withbaseURL.Proof of Concept
Access and Attack Conditions
No admin access is required for Axios itself. This is a library-level gadget.
The attacker must have an existing way to pollute
Object.prototypein the same Node.js process, for example through a separate prototype-pollution vulnerability in another dependency or application input path. Axios is the gadget that turns that pollution into dangerous HTTP request behavior.Required condition:
What Axios contributes:
What Axios does not do:
Affected usage:
Not affected in the confirmed PoC:
Reproduction Steps
1.17.0:Object.prototype.method = "DELETE", default-instance calls that omit an explicit method are sent asDELETE.What the Method PoC Script Does
The PoC starts a temporary local HTTP server for each Axios call and records the HTTP method received by that server. It then simulates an already-existing prototype-pollution condition by setting:
While that pollution is active, the script sends five Axios requests:
The script then deletes the polluted property:
Finally, it prints the method observed by the local server for each request. The vulnerable behavior is confirmed when the default Axios instance sends
DELETEforaxios.request({ url })andaxios({ url }), while the safe comparison paths still sendGET.Method Override PoC
Create
validate-prototype-method-gadget.mjs:Run:
Observed result:
The local server received:
This confirms that inherited
Object.prototype.methodcontrols the default method for vulnerable default-instance request paths.Supporting
allowAbsoluteUrlsGadget EvidenceThe same inherited-property issue affects
allowAbsoluteUrls.Create
validate-prototype-allowabsoluteurls-gadget.mjs:Observed result:
Without pollution, Axios sends the request to the absolute URL. After
Object.prototype.allowAbsoluteUrls = false, the default Axios instance combines the absolute URL withbaseURLand sends the request to the base server instead. An instance created withaxios.create()remains unaffected.Impact
This is a prototype-pollution gadget. It becomes exploitable when an application has any separate prototype-pollution primitive that allows an attacker to set properties on
Object.prototypein the same Node.js process.If such pollution is possible, an attacker can influence Axios default-instance requests that omit an explicit method:
axios.request({ url })axios({ url })This can turn an expected safe default
GETrequest into a state-changing method such as:DELETEPOSTPUTPATCHPotential impact includes unauthorized state-changing requests, deletion of resources, unintended writes, data corruption, or denial of service when the target endpoint treats the HTTP method as security-relevant.
The issue does not require admin access to Axios itself, but it does require an existing prototype-pollution path in the application. Applications that always use explicit methods, method aliases such as
axios.get(), or isolated instances created throughaxios.create()are not affected by the confirmed method-override path.Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:H/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios: Prototype pollution gadget in fetch adapter can alter outbound requests
CVE-2026-101908 / GHSA-vh66-26gq-q6x8
More information
Details
Summary
Axios fetch adapter requests can be altered by inherited properties on
fetchOptions. The adapter resolves method, headers, body, signal, and credentials intoresolvedOptions, creates aRequest, and then callsfetch(request, fetchOptions)instead offetch(request, resolvedOptions). In runtimes such as Node's undici-backed fetch, inheritedfetchOptions.headerscan override the headers already placed on theRequest.Axios does not create the prototype pollution source. This is a read-side gadget that becomes exploitable after same-process prototype pollution.
Impact
An attacker with a prior prototype-pollution primitive can cause affected fetch-adapter requests to send attacker-controlled headers and drop caller-specified headers. This can affect authorization, cache behavior, metadata-service interactions, or application-specific header-based controls.
The issue is specific to fetch-adapter behavior and does not affect Node HTTP adapter requests.
Affected Functionality
Affected:
adapter: 'fetch'.fetchOptionsis an object that does not have safe own values for sensitive fetch init fields.Not affected:
Object.prototypeis not polluted.Technical Details
lib/adapters/fetch.jsbuilds:The fallback path without
RequestusesresolvedOptions, but theRequestpath passes the originalfetchOptionsas the second argument tofetch(). That second argument can contain inherited properties fromObject.prototype.Local verification on axios
1.18.1setObject.prototype.headers = { Authorization: 'Bearer POLLUTED' }and called the fetch adapter withheaders: { 'X-Good': 'yes' }, fetchOptions: {}. The loopback server receivedAuthorization: Bearer POLLUTEDand did not receiveX-Good.Proof of Concept of Attack
Constrained local demonstration:
Expected safe behavior is that the sanitized axios headers remain in force. Current behavior can use the inherited fetch init headers instead.
Workarounds
Use the Node HTTP adapter for security-sensitive server-side requests until fixed. If the fetch adapter must be used, avoid passing empty
fetchOptionsobjects in processes where prototype pollution is possible, and set explicit safe own values for fetch init fields.Original report
Hello, I’m not completely sure if this is something you’d consider a security issue, since it depends on prototype pollution happening somewhere else first, but I wanted to report it just in case.
I was testing the fetch adapter with polluted prototype values and found that
Object.prototype.headerscan change the request axios sends.The issue seems to be in
lib/adapters/fetch.js. Axios creates aRequestwith the resolved headers/method/body, but then sends it withfetch(request, fetchOptions). With undici, iffetchOptionsdoesn’t have its own headers, an inheritedObject.prototype.headersvalue can be used during the final fetch call.I tested it with this:
The result I get is:
{ "authorization": "Bearer POLLUTED", "xGood": null }So the polluted Authorization header is sent, and the normal axios header is not.
Changing the fetch call to pass the already resolved options fixes it for me:
resolvedOptionsalready includes...fetchOptions, so custom fetch options should still work, while headers, method, body, and signal stay as clean own values.Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:H/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Axios: maxRedirects: 0 is not enforced by the fetch adapter, allowing redirect-based SSRF
CVE-2026-101907 / GHSA-r4gj-5m52-g5wh
More information
Details
Summary
Axios exposes
maxRedirectsto limit redirect following, andmaxRedirects: 0is used by applications as a redirect-based SSRF guard. The Node HTTP adapter enforces this option. The fetch adapter does not read it and does not set a Fetch APIredirectmode, so the runtime default ofredirect: 'follow'applies.Applications are affected when they rely on
maxRedirects: 0and use the fetch adapter, either explicitly or because the runtime selects it.Impact
An attacker who controls the initial URL or a redirecting server can cause a fetch-adapter request to follow a redirect even though the caller configured
maxRedirects: 0. If the redirect target is reachable only from the application environment, this can expose internal responses or trigger state-changing internal endpoints.This should not be described as unconditional SSRF. The bypass requires a redirect source, such as an attacker-controlled server or open redirect, and an application that trusted
maxRedirects: 0as the redirect guard.Affected Functionality
Affected:
adapter: 'fetch'.maxRedirects: 0but withoutfetchOptions.redirect: 'manual'or equivalent runtime-specific redirect control.Not affected:
maxRedirects: 0.Technical Details
lib/adapters/fetch.jsdestructures many fields fromresolveConfig(config), but notmaxRedirects. It then builds fetch options without aredirectkey:Because
redirectis absent, the Fetch API default is to follow redirects.Local verification on axios
1.18.1showed the HTTP adapter throwing withmaxRedirects: 0, while the fetch adapter followed the same loopback302and returned the internal response.Proof of Concept of Attack
Constrained local demonstration:
302 Location: http://127.0.0.1:<server-b>/internal.INTERNAL.Workarounds
For fetch-adapter requests, set
fetchOptions: { redirect: 'manual' }where the runtime supports it, or use the Node HTTP adapter for requests that rely on axios redirect limits.Original report
Summary
Axios 1.17.0 exposes
maxRedirectsas a configuration option to limit redirect following, and setting it to0is a documented pattern for preventing redirect-based SSRF. The HTTP adapter enforces this viafollow-redirects. The fetch adapter does not readmaxRedirectsat all - it passes requests to the underlyingfetch()call with noredirectoption, which defaults to'follow', so redirects are followed by the runtime rather than being constrained by axiosmaxRedirects.In the attached PoC, a request issued with
maxRedirects: 0andadapter: 'fetch'follows a302redirect to an internal service and returns its response, while the same request withadapter: 'http'correctly throws. A second bypass case demonstrates that the redirect can reach a state-changing internal endpoint, not just read-only ones, proving both confidentiality and integrity impact.This affects any application that sets
maxRedirects: 0as a redirect guard and runs in an environment where the fetch adapter is active: Deno, Bun, Cloudflare Workers, or Node.js withadapter: 'fetch'set explicitly.Details
The fetch adapter destructures config fields from
resolveConfigatlib/adapters/fetch.js:The options object passed to
fetch()has noredirectkey:Because no
redirectkey is present, the Fetch API default ofredirect: 'follow'applies, so redirects are handled by the runtime rather than constrained by axiosmaxRedirects. The HTTP adapter, by contrast, delegates tofollow-redirects, which readsmaxRedirects, enforces the cap, and stripsAuthorization,Cookie, andProxy-Authorizationon cross-origin redirects.The discrepancy between adapters is not documented. The threat model covers credential stripping on redirects (T-R2) and cites
follow-redirectsas the mitigation, but makes no mention that the fetch adapter does not participate in this mitigation. See: https://github.com/axios/axios/blob/master/THREATMODEL.md#t-r2-credential-leakage-on-cross-origin-redirectThe behaviour difference between adapters is summarised below:
config.maxRedirectsmaxRedirects: 0Authorizationcross-originfollow-redirects>=1.15.8)Cookiecross-originWhen is the fetch adapter selected?
httpmodule available; the adapter list falls through to'fetch'axios.get(url, { adapter: 'fetch' })axios.create({ adapter: ['fetch'] })PoC