CWEweakness

CWE-158 Improper Neutralization of Null Byte or NUL Character

Official page ↗
Abstraction
Variant
Structure
Simple
Status
Incomplete
Languages
C, C++, Not Language-Specific
CWE version
5.0

Description

The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes NUL characters or null bytes when they are sent to a downstream component.

Common consequences

• Integrity: Unexpected State — As data is parsed, an injected NUL character or null byte may cause the product to believe the input is terminated earlier than it actually is, or otherwise cause the input to be misinterpreted. This could then be used to inject potentially dangerous input that occurs after the null byte or otherwise bypass validation routines and other protection mechanisms.

Potential mitigations

• Developers should anticipate that null characters or null bytes will be injected/removed/manipulated in the input vectors of their product. Use an appropriate combination of denylists and allowlists to ensure only valid, expected and appropriate input is processed by the system. • [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright. • [Implementation] Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.

Observed examples

• CVE-2008-1284: NUL byte in theme name causes directory traversal impact to be worse • CVE-2005-2008: Source code disclosure using trailing null. • CVE-2005-3293: Source code disclosure using trailing null (CWE-158) or trailing dot (CWE-42). • CVE-2005-2061: Trailing null allows file include. • CVE-2002-1774: Null character in MIME header allows detection bypass. • CVE-2000-0149: Web server allows remote attackers to view the source code for CGI programs via a null character (%00) at the end of a URL. • CVE-2000-0671: Web server allows remote attackers to bypass access restrictions, list directory contents, and read source code by inserting a null character (%00) in the URL. • CVE-2001-0738: Logging system allows an attacker to cause a denial of service (hang) by causing null bytes to be placed in log messages. • CVE-2001-1140: Web server allows source code for executable programs to be read via a null character (%00) at the end of a request. • CVE-2002-1031: Protection mechanism for limiting file access can be bypassed using a null character (%00) at the end of the directory name. • CVE-2002-1025: Application server allows remote attackers to read JSP source code via an encoded null byte in an HTTP GET request, which causes the server to send the .JSP file unparsed. • CVE-2003-0768: XSS protection mechanism only checks for sequences with an alphabetical character following a (<), so a non-alphabetical or null character (%00) following a < may be processed. • CVE-2004-0189: Decoding function in proxy allows regular expression bypass in ACLs via URLs with null characters. • CVE-2005-3153: Null byte bypasses PHP regexp check (interaction error). • CVE-2005-4155: Null byte bypasses PHP regexp check (interaction error).

Related

Attack pattern · CAPEC (2)

  • CAPEC-52 Embedding NULL Bytes attack pattern
  • CAPEC-53 Postfix, Null Terminate, and Backslash attack pattern

Observed example · CVE (15)

  • CVE-2008-1284 Directory traversal vulnerability in Horde 3.1.6, Groupware before 1.0.5, and Groupware Webmail Edition before 1.0.6, when running with… vulnerability
  • 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-3293 Xerver 4.17 allows remote attackers to (1) obtain source code of scripts via a request with a trailing "." (dot) or (2) list directory… 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
  • CVE-2005-2061 Infopop UBB.Threads before 6.5.2 Beta allows remote attackers to include arbitrary files via the language parameter in a cookie followed by… vulnerability
  • CVE-2005-2008 Yaws Webserver 1.55 and earlier allows remote attackers to obtain the source code for yaws scripts via a request to a yaw script with a… vulnerability
  • CVE-2004-0189 The "%xx" URL decoding function in Squid 2.5STABLE4 and earlier allows remote attackers to bypass url_regex ACLs via a URL with a NULL… vulnerability
  • CVE-2003-0768 Microsoft ASP.Net 1.1 allows remote attackers to bypass the Cross-Site Scripting (XSS) and Script Injection protection feature via a null… vulnerability
  • CVE-2002-1774 NOTE: this issue has been disputed by the vendor. vulnerability
  • CVE-2002-1025 JRun 3.0 through 4.0 allows remote attackers to read JSP source code via an encoded null byte in an HTTP GET request, which causes the… vulnerability
  • CVE-2002-1031 KeyFocus (KF) web server 1.0.2 allows remote attackers to list directories and read restricted files via an HTTP request containing a %00… vulnerability
  • CVE-2001-0738 LogLine function in klogd in sysklogd 1.3 in various Linux distributions allows an attacker to cause a denial of service (hang) by causing… vulnerability
  • CVE-2001-1140 BadBlue Personal Edition v1.02 beta allows remote attackers to read source code for executable programs by appending a %00 (null byte) to… vulnerability
  • CVE-2000-0671 Roxen web server earlier than 2.0.69 allows allows remote attackers to bypass access restrictions, list directory contents, and read source… vulnerability
  • CVE-2000-0149 Zeus web server allows remote attackers to view the source code for CGI programs via a null character (%00) at the end of a URL. vulnerability

Child of · CWE (1)

  • CWE-138 Improper Neutralization of Special Elements weakness

Referenced by CAPEC · weakness (2)

  • CAPEC-52 Embedding NULL Bytes attack pattern
  • CAPEC-53 Postfix, Null Terminate, and Backslash attack pattern

Referenced by CVE · weakness (33)

  • CVE-2026-84790 OpenVPN 2.7_alpha1 through 2.7.7 allows remote authenticated users to impersonate others via a crafted certificate subject field vulnerability
  • CVE-2026-92705 Aegisub is a cross-platform advanced subtitle editor. vulnerability
  • CVE-2026-105239 Improper Neutralization of Null Byte or NUL Character vulnerability in the EventLogAppender of Apache log4net. vulnerability
  • CVE-2026-105240 Improper Neutralization of Null Byte or NUL Character vulnerability in the OutputDebugStringAppender of Apache log4net. vulnerability
  • CVE-2026-76354 In Splunk Enterprise versions below 10.4.2, 10.2.6, 10.0.9, and 9.4.14, a user who does not hold the "admin" or "power" Splunk roles could… vulnerability
  • CVE-2026-70603 Electron is a framework for writing cross-platform desktop applications using JavaScript, HTML and CSS. vulnerability
  • CVE-2026-47778 Envoy is an open source edge and service proxy designed for cloud-native applications. vulnerability
  • CVE-2026-41256 jq is a command-line JSON processor. vulnerability
  • CVE-2026-43895 jq is a command-line JSON processor. vulnerability
  • CVE-2026-43859 mutt before 2.3.2 sometimes uses strfcpy instead of memcpy for the IMAP auth_cram MD5 digest. vulnerability
  • CVE-2026-43861 mutt before 2.3.2 does not check for '\0' in url_pct_decode. vulnerability
  • CVE-2026-23863 An attachment spoofing issue in WhatsApp for Windows prior to v2.3000.1032164386.258709 could have allowed maliciously formatted documents… vulnerability
  • CVE-2026-33191 Free5GC is an open-source Linux Foundation project for 5th generation (5G) mobile core networks. vulnerability
  • CVE-2026-4359 A compromised third party cloud server or man-in-the-middle attacker could send a malformed HTTP response and cause a crash in applications… vulnerability
  • CVE-2026-28540 Out-of-bounds character read vulnerability in Bluetooth. vulnerability
  • CVE-2025-14388 The PhastPress plugin for WordPress is vulnerable to Unauthenticated Arbitrary File Read via null byte injection in all versions up to, and… vulnerability
  • CVE-2025-66263 Unauthenticated Arbitrary File Read via Null Byte Injection in DB Electronica Telecomunicazioni S.p.A. vulnerability
  • CVE-2025-61985 ssh in OpenSSH before 10.1 allows the '\0' character in an ssh:// URI, potentially leading to code execution when a ProxyCommand is used. vulnerability
  • CVE-2025-9648 A vulnerability in the CivetWeb library's function mg_handle_form_request allows remote attackers to trigger a denial of service (DoS)… vulnerability
  • CVE-2025-55113 If the Access Control List is enforced by the Control-M/Agent and the C router is in use (default in Out-of-support Control-M/Agent… vulnerability
  • CVE-2025-47812 In Wing FTP Server before 7.4.4. vulnerability
  • CVE-2025-1936 jar: URLs retrieve local file content packaged in a ZIP archive. vulnerability
  • CVE-2024-10921 An authorized user may trigger crashes or receive the contents of buffer over-reads of Server memory by issuing specially crafted requests… vulnerability
  • CVE-2024-9026 In PHP versions 8.1.* before 8.1.30, 8.2.* before 8.2.24, 8.3.* before 8.3.12, when using PHP-FPM SAPI and it is configured to catch… vulnerability
  • CVE-2024-0408 A flaw was found in the X.Org server. vulnerability
  • CVE-2023-5719 The Crimson 3.2 Windows-based configuration tool allows users with administrative access to define new passwords for users and to download… vulnerability
  • CVE-2022-31223 Dell BIOS versions contain an Improper Neutralization of Null Byte vulnerability. vulnerability
  • CVE-2022-20812 Multiple vulnerabilities in the API and in the web-based management interface of Cisco Expressway Series and Cisco TelePresence Video… vulnerability
  • CVE-2022-20813 Multiple vulnerabilities in the API and in the web-based management interface of Cisco Expressway Series and Cisco TelePresence Video… vulnerability
  • CVE-2020-7928 A user authorized to perform database queries may trigger a read overrun and access arbitrary memory by issuing specially crafted queries. vulnerability
Show all 33 ›