CWEweakness
CWE-86 Improper Neutralization of Invalid Characters in Identifiers in Web Pages
- Abstraction
- Variant
- Structure
- Simple
- Status
- Draft
- Languages
- Not Language-Specific
- CWE version
- 5.0
Description
The product does not neutralize or incorrectly neutralizes invalid characters or byte sequences in the middle of tag names, URI schemes, and other identifiers.
Common consequences
• Confidentiality, Integrity, Availability: Read Application Data, Execute Unauthorized Code or Commands
Potential mitigations
• [Implementation] Use and specify an output encoding that can be handled by the downstream component that is reading the output. Common encodings include ISO-8859-1, UTF-7, and UTF-8. When an encoding is not specified, a downstream component may choose a different encoding, either by assuming a default encoding or automatically inferring which encoding is being used, which can be erroneous. When the encodings are inconsistent, the downstream component might treat some character or byte sequences as special, even if they are not special in the original encoding. Attackers might then be able to exploit this discrepancy and conduct injection attacks; they even might be able to bypass protection mechanisms that assume the original encoding is also being used by the downstream component.
The problem of inconsistent output encodings often arises in web pages. If an encoding is not specified in an HTTP header, web browsers often guess about which encoding is being used. This can open up the browser to subtle XSS attacks.
• [Implementation] To help mitigate XSS attacks against the user's session cookie, set the session cookie to be HttpOnly. In browsers that support the HttpOnly feature (such as more recent versions of Internet Explorer and Firefox), this attribute can prevent the user's session cookie from being accessible to malicious client-side scripts that use document.cookie. This is not a complete solution, since HttpOnly is not supported by all browsers. More importantly, XmlHttpRequest and other powerful browser technologies provide read access to HTTP headers, including the Set-Cookie header in which the HttpOnly flag is set.
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-2004-0595: XSS filter doesn't filter null characters before looking for dangerous tags, which are ignored by web browsers. Multiple Interpretation Error (MIE) and validate-before-cleanse.
Related
Attack pattern · CAPEC (3)
Observed example · CVE (1)
- CVE-2004-0595 The strip_tags function in PHP 4.x up to 4.3.7, and 5.x up to 5.0.0RC3, does not filter null (\0) characters within tag names when… vulnerability
Child of · CWE (2)
Peer of · CWE (1)
- CWE-184 Incomplete List of Disallowed Inputs weakness
Referenced by CAPEC · weakness (3)
Referenced by CVE · weakness (11)
- CVE-2026-71478 league/commonmark is a PHP library for parsing and rendering CommonMark Markdown. vulnerability
- CVE-2026-28417 Vim is an open source, command line text editor. vulnerability
- CVE-2025-66606 A vulnerability has been found in FAST/TOOLS provided by Yokogawa Electric Corporation. vulnerability
- CVE-2025-20166 A vulnerability in the web-based management interface of Cisco Common Services Platform Collector (CSPC) could allow an authenticated,… vulnerability
- CVE-2025-20167 A vulnerability in the web-based management interface of Cisco Common Services Platform Collector (CSPC) could allow an authenticated,… vulnerability
- CVE-2025-20168 A vulnerability in the web-based management interface of Cisco Common Services Platform Collector (CSPC) could allow an authenticated,… vulnerability
- CVE-2024-10941 A malicious website could have included an iframe with an malformed URI resulting in a non-exploitable browser crash. vulnerability
- CVE-2024-21864 Improper neutralization in some Intel(R) Arc(TM) & Iris(R) Xe Graphics software before version 31.0.101.5081 may allow an unauthenticated… vulnerability
- CVE-2021-33158 Improper neutralization in some Intel(R) Ethernet Adapters and Intel(R) Ethernet Controller I225 Manageability firmware may allow a… vulnerability
- CVE-2023-22840 Improper neutralization in software for the Intel(R) oneVPL GPU software before version 22.6.5 may allow an authenticated user to… vulnerability
- CVE-2023-31126 `org.xwiki.commons:xwiki-commons-xml` is an XML library used by the open-source wiki platform XWiki. vulnerability
Referenced by OWASP · mapped cwe (1)
- A05:2025 Injection Top 10 2025