Prototype Pollution Vulnerability in Axios: Inherited Properties in Nested Option Objects
Summary
GHSA-7q8q-rj6j-mhjq: Axios: Nested axios option objects can consume polluted prototype values. Affects axios across 2 version ranges.
>= 0.8.0, < 0.33.0
>= 1.0.0, < 1.18.0
Fixed in 0.33.0 or 1.18.0, depending on the release line you run. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Axios is a popular promise-based HTTP client for JavaScript, designed to make HTTP requests easier and more intuitive. It supports features like request and response interception, automatic JSON data transformation, and the ability to cancel requests. However, a vulnerability exists in Axios that allows it to consume inherited properties from nested request option objects when the JavaScript process has a polluted Object.prototype, leading to potential security risks.
Vulnerability Detail
The vulnerability arises from Axios's handling of nested option objects, such as 'auth' and 'paramsSerializer'. When these objects are passed as placeholders (e.g., auth: {}), Axios can inadvertently read inherited properties from Object.prototype, which may have been polluted by other components in the application. This can result in silent injection of sensitive data, such as 'Authorization' headers containing attacker-controlled credentials, or tampering with query strings. The vulnerability is particularly concerning because it can lead to unauthorized access and data exfiltration without any visible errors or warnings.
How To Fix
Latest published version: 1.20.0 as of 22 Oct 2026
npm install axios@1.20.0
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
>= 0.8.0, < 0.33.00.33.0npm install axios@0.33.0 -
>= 1.0.0, < 1.18.01.18.0npm install axios@1.18.0
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
If immediate upgrading is not feasible, avoid passing placeholder nested option objects. Specifically, remove the 'auth' property entirely when Basic auth is not intended. For 'paramsSerializer', provide explicit own 'encode' and 'serialize' properties or remove 'paramsSerializer' when custom serialization is not required. Here is an example of how to avoid passing placeholders:
const response = await axios.get('http://example.com/api', {
paramsSerializer: {
encode: (value) => encodeURIComponent(value),
serialize: (params) => new URLSearchParams(params).toString(),
},
// Do not pass empty auth object
});
Conclusion
In summary, the prototype pollution vulnerability in Axios poses significant risks by allowing inherited properties from polluted Object.prototype to be used in HTTP requests. It is crucial to update to the latest version of Axios to mitigate these risks and ensure the security of your application.
See every vulnerability recorded for axios →
FAQ
Prototype pollution is a security vulnerability that allows an attacker to manipulate the prototype of a base object, potentially leading to unexpected behavior in applications.
You can check if your application is affected by using Vulert, which monitors and alerts for open-source vulnerabilities in real-time. You can also use the Vulert playground to test your application without any signup.
The consequences include unauthorized access through injected credentials and potential data tampering via modified query strings, which can lead to significant security breaches.
Yes, you can mitigate the issue by avoiding the use of placeholder nested option objects and ensuring that you provide explicit properties for 'auth' and 'paramsSerializer'.
The CVSS score of this vulnerability is 6.3, indicating a moderate severity level.
References
Related vulnerabilities
Recent vulnerabilities recorded for axios.