CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-42040

CVE-2026-42040: Null Byte Injection via Improper Parameter Serialization in Axios

Alon Barad
Alon Barad
Software Engineer

May 5, 2026·5 min read·40 visits

Executive Summary (TL;DR)

A logic flaw in Axios's URL parameter serializer reverts safely encoded null bytes (%00) back to raw null characters. This requires a specific non-default configuration to trigger but can lead to downstream parsing errors or WAF bypasses.

Axios versions prior to 0.31.1 and 1.x versions prior to 1.15.1 contain a Null Byte Injection vulnerability (CWE-626) in the AxiosURLSearchParams module. A logic defect in the internal parameter encoder incorrectly reverts safely encoded null bytes (%00) back into raw null byte characters. This flaw can facilitate path truncation attacks or security filter bypasses when interacting with vulnerable downstream systems.

Vulnerability Overview

Axios is a widely utilized promise-based HTTP client for browser and Node.js environments. The library includes various helper modules for data processing, including AxiosURLSearchParams, which handles the serialization of URL parameters. This specific module processes key-value pairs and converts them into URL-encoded query strings suitable for HTTP transmission.

A logic flaw exists within the internal encoding mechanism of this helper class, classified as a Null Byte Interaction Error (CWE-626). During the parameter serialization phase, the encoder applies a secondary replacement function after standard URI encoding. This secondary function is intended to restore specific characters for aesthetic or compatibility reasons.

Due to an incorrect mapping in this secondary step, safe URL-encoded null bytes (%00) are actively replaced with raw null byte characters (\x00). This results in the injection of literal null bytes into the final outgoing request payload. The vulnerability primarily affects environments utilizing Axios versions prior to 0.31.1, as well as the 1.x branch prior to version 1.15.1.

Root Cause Analysis

The defect resides in the post-processing phase of the encode utility within lib/helpers/AxiosURLSearchParams.js. The encode function is designed to take an input string, apply the native JavaScript encodeURIComponent function, and then run a custom regular expression replacement. The native function operates correctly, taking an input containing \x00 and converting it safely to %00.

The vulnerability is introduced by the custom replacement logic that immediately follows. The code utilizes a regular expression /[!'()~]|%20|%00/g to identify specific encoded sequences for further modification. When a match is found, the character sequence is passed to a lookup object named charMap to determine the final output string.

The charMap object contains a severe misconfiguration. It explicitly defines a mapping of '%00': '\x00', instructing the application to take the safe %00 string and convert it back into a raw, unencoded null byte. Consequently, any parameter value initially containing a null byte will successfully pass through the standard encoding phase only to be reverted to an unsafe state before transmission.

Code Analysis

An examination of the vulnerable source code clearly highlights the encoding regression. The charMap object serves as a static translation dictionary. While most entries handle standard character normalization, the final entry deliberately targets encoded null bytes.

const charMap = {
  '!': '%21',
  "'": '%27',
  '(': '%28',
  ')': '%29',
  '~': '%7E',
  '%20': '+',
  '%00': '\x00' // Vulnerable entry reversing safe encoding
};
 
function encode(val) {
  return encodeURIComponent(val).replace(/[!'()~]|%20|%00/g, (char) => {
    return charMap[char];
  });
}

The patched versions resolve this issue by removing both the dictionary entry and its corresponding trigger in the regular expression. This ensures that the native JavaScript encoding remains intact and is not tampered with by the secondary string replacement function.

const charMap = {
  '!': '%21',
  "'": '%27',
  '(': '%28',
  ')': '%29',
  '~': '%7E',
  '%20': '+'
};
 
function encode(val) {
  return encodeURIComponent(val).replace(/[!'()~]|%20/g, (char) => {
    return charMap[char];
  });
}

Exploitation Mechanics

Exploitation requires a high degree of complexity due to the non-default execution path. The standard Axios request flow, governed by buildURL.js, does not invoke the flawed AxiosURLSearchParams module by default. An application must explicitly configure a custom paramsSerializer or manually instantiate the vulnerable class to process user-supplied input.

If the prerequisite conditions are met, an attacker can submit a payload containing a literal null byte within a query parameter or form field. The application processes this input, passes it to the flawed serialization function, and constructs an HTTP request containing the raw \x00 byte. This request is then transmitted to the target backend or proxy infrastructure.

The success of the exploit ultimately depends on the behavior of the downstream sink. The raw null byte must cause a parsing anomaly, such as premature string termination in C/C++ backends or evaluation logic bypasses within a Web Application Firewall.

Impact Assessment

The primary security impact involves the manipulation of downstream systems that expect strictly conforming HTTP parameters. When a raw null byte is injected into a URL or form-encoded body, systems developed in memory-unsafe languages or utilizing legacy CGI parsers may interpret the byte as a string terminator. This forces the parser to discard the remainder of the parameter string, potentially altering application logic.

A secondary consequence is the potential to bypass security filters and Web Application Firewalls (WAFs). A WAF that performs strict validation against URL-encoded inputs may halt inspection upon encountering an unexpected raw null byte. This truncation allows malicious payloads appended after the null byte to pass through the filter undetected, arriving at the backend application intact.

Despite these vectors, the vulnerability is assigned a low CVSS score of 3.7. The high attack complexity, requirement for non-standard developer configurations, and reliance on specific downstream architecture significantly restrict the practical blast radius of this flaw.

Remediation and Mitigation

The definitive remediation strategy is upgrading the Axios dependency to a patched release. Development teams must ensure their package managers resolve Axios to version 1.15.1 or greater for the 1.x branch, or version 0.31.1 for legacy codebases. This fully removes the flawed mapping from the internal encoding module.

In environments where immediate patching is unfeasible, developers should audit their codebase for custom paramsSerializer implementations. Any logic that explicitly delegates parameter encoding to the AxiosURLSearchParams class should be temporarily replaced with native JavaScript URLSearchParams or standard encodeURIComponent calls.

As a defense-in-depth measure, all applications should implement strict input validation at the outer boundary. Unprintable control characters, including null bytes (\x00), should be actively sanitized or rejected before they reach underlying HTTP client libraries. This practice mitigates similar injection vectors across the application stack.

Technical Appendix

CVSS Score
3.7/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
EPSS Probability
0.04%
Top 87% most exploited

Affected Systems

Axios HTTP Client (Node.js environments)Axios HTTP Client (Browser environments)

Affected Versions Detail

Product
Affected Versions
Fixed Version
Axios
Axios
< 0.31.10.31.1
Axios
Axios
>= 1.0.0, < 1.15.11.15.1
AttributeDetail
CWE IDCWE-626
Attack VectorNetwork
CVSS v3.1 Score3.7 (Low)
EPSS Score0.00044
Exploit StatusNone
CISA KEVFalse

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1562Impair Defenses
Defense Evasion
CWE-626
Null Byte Interaction Error

Null Byte Interaction Error (Poison Null Byte)

References & Sources

  • [1]GitHub Security Advisory GHSA-xhjh-pmcv-23jw
  • [2]NVD Vulnerability Detail CVE-2026-42040
  • [3]Axios Threat Model Documentation

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•1 day ago•GHSA-H5X8-XP6M-X6Q4
7.1

GHSA-H5X8-XP6M-X6Q4: Unvalidated Signature Generation in @jhb.software/payload-cloudinary-plugin

The @jhb.software/payload-cloudinary-plugin exposes an endpoint that performs unvalidated cryptographic signing of Cloudinary API parameters, allowing authenticated users with minimal privileges to forge valid signatures for arbitrary actions. This flaw allows attackers to overwrite remote storage assets, execute unauthorized file uploads, alter asset visibility parameters, trigger SSRF webhooks, and perform directory traversal within Cloudinary repositories.

Alon Barad
Alon Barad
3 views•6 min read
•1 day ago•GHSA-G2GW-Q38M-VJFC
8.7

GHSA-G2GW-Q38M-VJFC: Server-Side Request Forgery and Bearer Token Exfiltration in @merill/lokka

A Server-Side Request Forgery (SSRF) and Bearer Token Exfiltration vulnerability exists in the @merill/lokka (Lokka) Model Context Protocol (MCP) server prior to version 2.1.2. The server constructed Azure Resource Manager request URLs by concatenating user-controlled path parameters directly into destination request strings. By injecting authority-redefinition characters, an attacker can manipulate URL parsing to execute a host-escape attack, forcing the server to send high-privilege Azure Resource Manager (ARM) Bearer tokens to an external attacker-controlled host. This allows complete administrative access to the associated Azure subscriptions.

Alon Barad
Alon Barad
6 views•7 min read
•1 day ago•GHSA-4XGF-CPJX-PC3J
5.3

GHSA-4xgf-cpjx-pc3j: Directory Traversal and Symlink Following in Pydantic Settings

A directory traversal and symlink following vulnerability exists in Pydantic Settings when using the NestedSecretsSettingsSource with nested subdirectory lookups enabled. An attacker capable of writing to the secrets directory can bypass size limitations, read arbitrary host files, or cause a denial-of-service condition via cyclic symlinks.

Amit Schendel
Amit Schendel
2 views•7 min read
•1 day ago•GHSA-H5RG-8P7F-47G2
4.1

GHSA-h5rg-8p7f-47g2: Server-Side Request Forgery (SSRF) in SurrealDB Identity & Access Management (IAM) JWKS Fetcher

A Server-Side Request Forgery (SSRF) vulnerability exists in SurrealDB's Identity & Access Management (IAM) module prior to version 3.1.5. When configuring JSON Web Key Set (JWKS) URLs for token verification, the remote fetcher follows HTTP redirects by default without validating redirect targets against configured network capabilities. This allows high-privileged users to bypass network access limits and perform blind port scanning of internal network resources.

Amit Schendel
Amit Schendel
4 views•6 min read
•1 day ago•GHSA-CC8F-FCX3-GPJR
7.7

GHSA-cc8f-fcx3-gpjr: Arbitrary File Disclosure via DEFINE ANALYZER mapper filter in SurrealDB

A local file disclosure vulnerability exists in SurrealDB's full-text search capabilities, allowing authenticated users with database EDITOR or OWNER roles to read arbitrary files from the host system filesystem. This occurs by abusing the mapper() filter inside a DEFINE ANALYZER statement to point to system files.

Alon Barad
Alon Barad
6 views•6 min read
•1 day ago•GHSA-H4H3-3RFJ-X6FQ
4.3

GHSA-H4H3-3RFJ-X6FQ: Value-Ordering Oracle Side-Channel via Indexed ORDER BY in SurrealDB

SurrealDB versions 3.0.0 through 3.1.4 contain an information exposure vulnerability (CWE-203) where the query planner optimizes sorted queries using indexes on fields with field-level SELECT restrictions. Because the query planner performs index-based sorting before enforcing permission-based redaction, unauthorized users can observe the physical order of returned rows to deduce the relative values of protected fields.

Alon Barad
Alon Barad
4 views•8 min read