CWE
Home > CWE List > CWE-158 Individual Dictionary Definition (Draft 9)   View the CWE List

CWE-158 Individual Dictionary Definition (Draft 9)

Failure to Sanitize Null Byte or NUL Character
Weakness ID
Status: Incomplete

158 (Weakness Variant)

Description

Summary

NUL characters or null bytes injected into an application through input can be used to compromise a system. As data is parsed, an injected NUL character or null byte may cause the process to take unexpected actions that result in an attack.

Potential Mitigations

Developers should anticipate that null characters or null bytes will be injected/removed/manipulated in the input vectors of their software system. Use an appropriate combination of black lists and white lists to ensure only valid, expected and appropriate input is processed by the system.

Observed Examples
ReferenceDescription
CVE-2005-2008Source code disclosure using trailing null.
CVE-2005-3293Source code disclosure using trailing null.
CVE-2005-2061Trailing null allows file include.
CVE-2002-1774Null character in MIME header allows detection bypass.
CVE-2000-0149
CVE-2000-0671
CVE-2001-0738
CVE-2001-1140
CVE-2002-1031
CVE-2002-1025
CVE-2003-0768
CVE-2004-0189Decoding function in proxy allows regular expression bypass in ACLs via URLs with null characters.
CVE-2005-3153Null byte bypasses PHP regexp check (interaction error).
CVE-2005-4155Null byte bypasses PHP regexp check (interaction error).
Context Notes

This can be a factor in multiple interpretation errors, other interaction errors, filename equivalence, etc.

Relationships
NatureTypeIDName
ChildOfWeakness ClassWeakness ClassWeakness Class138Failure to Sanitize Special Elements
Source Taxonomies

PLOVER - Null Character / Null Byte

Applicable Platforms

All

Time of Introduction

Implementation

Related Attack Patterns
CAPEC-IDAttack Pattern Name
53Postfix, Null Terminate, and Backslash
52Embedding NULL Bytes
Page Last Updated: April 21, 2008