CVE-2026-42040: Axios Null Byte Injection Vulnerability in AxiosURLSearchParams

axios Updated 05 May 2026

Summary

05/05/2026
Yes i
Low
3.7

CVE-2026-42040: Axios: Null Byte Injection via Reverse-Encoding in AxiosURLSearchParams. Affects axios across 2 version ranges.

< 0.31.1 >= 1.0.0, < 1.15.1

Fixed in 0.31.1 or 1.15.1, depending on the release line you run. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Axios is a popular JavaScript library used for making HTTP requests from node.js or XMLHttpRequests from the browser. It provides a simple API for handling requests and responses, including support for promises and interceptors. The library is widely used in web applications for its ease of use and flexibility. However, a vulnerability has been identified in the AxiosURLSearchParams component, which can lead to null byte injection due to improper encoding.

Vulnerability Detail

The vulnerability arises from a defect in the encode() function located in lib/helpers/AxiosURLSearchParams.js. Specifically, a character mapping (charMap) at line 21 reverses the safe percent-encoding of null bytes. While encodeURIComponent('\x00') correctly produces the safe sequence %00, the charMap entry '%00': '\x00' converts it back to a raw null byte. This inconsistency poses a risk, as it can lead to issues such as URL truncation and potential bypass of security mechanisms in C-based backends. The vulnerability is classified as having a CVSS score of 3.7, indicating a low severity level.

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.31.1 0.31.1
    npm install axios@0.31.1
  • >= 1.0.0, < 1.15.1 1.15.1
    npm install axios@1.15.1

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 possible, a temporary workaround is to avoid using AxiosURLSearchParams directly for custom serialization. Instead, utilize the standard Axios request flow, which does not trigger this vulnerability. For example, use the buildURL function to handle URL parameters safely.

Conclusion

The CVE-2026-42040 vulnerability in Axios presents a low-severity risk due to improper encoding in the AxiosURLSearchParams component. Users are encouraged to update to the latest patched versions to mitigate this risk. For those unable to upgrade immediately, utilizing alternative methods for URL parameter handling is recommended.

See every vulnerability recorded for axios →

Share this vulnerability

FAQ

The vulnerability is a null byte injection issue caused by improper encoding in the AxiosURLSearchParams component.

You can check if your application is affected by using the Vulert playground at Vulert Scanner, which monitors vulnerabilities using your package-lock.json.

The primary impacts include URL truncation and possible bypass of security mechanisms in C-based backends if null bytes are processed incorrectly.

Yes, a patch is available in versions 1.15.1 and above for Axios 1.x, and 0.31.1 for Axios 0.x.

If you cannot upgrade, avoid using AxiosURLSearchParams directly and use the standard Axios request flow instead.

Related vulnerabilities

Recent vulnerabilities recorded for axios.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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.31.1 0.31.1
    npm install axios@0.31.1
  • >= 1.0.0, < 1.15.1 1.15.1
    npm install axios@1.15.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback