CWEweakness

CWE-626 Null Byte Interaction Error (Poison Null Byte)

Official page ↗
Abstraction
Variant
Structure
Simple
Status
Draft
Languages
ASP.NET, PHP, Perl
CWE version
5.0

Description

The product does not properly handle null bytes or NUL characters when passing data between different representations or components.

Extended description

A null byte (NUL character) can have different meanings across representations or languages. For example, it is a string terminator in standard C libraries, but Perl and PHP strings do not treat it as a terminator. When two representations are crossed - such as when Perl or PHP invokes underlying C functionality - this can produce an interaction error with unexpected results. Similar issues have been reported for ASP. Other interpreters written in C might also be affected. The poison null byte is frequently useful in path traversal attacks by terminating hard-coded extensions that are added to a filename. It can play a role in regular expression processing in PHP.

Common consequences

• Integrity: Unexpected State

Potential mitigations

• [Implementation] Remove null bytes from all incoming strings.

Detection methods

• Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Observed examples

• CVE-2005-4155: NUL byte bypasses PHP regular expression check • CVE-2005-3153: inserting SQL after a NUL byte bypasses allowlist regexp, enabling SQL injection

Related

Observed example · CVE (2)

  • CVE-2005-4155 registration.PHP in ATutor 1.5.1 pl2 allows remote attackers to execute arbitrary SQL commands via an e-mail address that ends in a NULL… vulnerability
  • CVE-2005-3153 login.php in myBloggie 2.1.3 beta and earlier allows remote attackers to bypass a whitelist regular expression and conduct SQL injection… vulnerability

Child of · CWE (2)

  • CWE-147 Improper Neutralization of Input Terminators weakness
  • CWE-436 Interpretation Conflict weakness

Referenced by CVE · weakness (8)

  • CVE-2026-76816 Netty is an asynchronous, event-driven network application framework. vulnerability
  • CVE-2026-62380 Netty (io.netty:netty-codec-socks) versions 4.2.0.Final through 4.2.16.Final and 4.1.x through 4.1.136.Final contain null byte, CRLF, and… vulnerability
  • CVE-2026-42579 Netty is an asynchronous, event-driven network application framework. vulnerability
  • CVE-2026-42010 A flaw was found in gnutls. vulnerability
  • CVE-2026-42040 Axios is a promise based HTTP client for the browser and Node.js. vulnerability
  • CVE-2020-10773 A stack information leak flaw was found in s390/s390x in the Linux kernel’s memory manager functionality, where it incorrectly writes to… vulnerability
  • CVE-2019-17137 This vulnerability allows network-adjacent attackers to bypass authentication on affected installations of NETGEAR AC1200 R6220 Firmware… vulnerability
  • CVE-2019-11936 Various APC functions accept keys containing null bytes as input, leading to premature truncation of input. vulnerability