CWE-86: Improper Neutralization of Invalid Characters in Identifiers in Web Pages
The product does not neutralize or incorrectly neutralizes invalid characters or byte sequences in the middle of tag names, URI schemes, and other identifiers.
Last updated
Overview
Some web browsers may remove these sequences, resulting in output that may have unintended control implications. For example, the product may attempt to remove a "javascript:" URI scheme, but a "java%00script:" URI may bypass this check and still be rendered as active javascript by some browsers, allowing XSS or other attacks.
Real-world CVEs
10 recorded CVEs are caused by CWE-86 (Improper Neutralization of Invalid Characters in Identifiers in Web Pages). The highest-severity and most recent are shown first. 2 new CWE-86 CVEs have been recorded so far in 2026 (3 in 2025).
- CVE-2023-31126Critical · CVSS 9.6 · EPSS 55th2023-05-09
- CVE-2026-28417
Vim has OS Command Injection in netrw
High · CVSS 7.8 · EPSS 65th2026-02-27 - CVE-2024-21864High · CVSS 7.8 · EPSS 27th2024-05-16
- CVE-2021-33158High · CVSS 7.2 · EPSS 12th2024-05-16
- CVE-2024-10941Medium · CVSS 6.5 · EPSS 34th2024-11-06
- CVE-2023-22840Medium · CVSS 5.5 · EPSS 36th2023-08-11
- CVE-2025-20168
Cisco Common Services Platform Collector Cross-Site Scripting Vulnerability
Medium · CVSS 5.4 · EPSS 21th2025-01-08 - CVE-2025-20167
Cisco Common Services Platform Collector Cross-Site Scripting Vulnerability
Medium · CVSS 5.4 · EPSS 21th2025-01-08 - CVE-2025-20166
Cisco Common Services Platform Collector Cross-Site Scripting Vulnerability
Medium · CVSS 5.4 · EPSS 30th2025-01-08 - CVE-2025-66606Low · CVSS 2.1 · EPSS 12th2026-02-09
Common consequences
What can happen when CWE-86 is exploited.
Read Application Data, Execute Unauthorized Code or Commands
Affects: Confidentiality, Integrity, Availability
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
Applies to
Technologies
How to prevent it
Practical mitigations for CWE-86, grouped by where in the lifecycle they apply.
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.
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.
Effectiveness: Defense in Depth
How to detect it
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.)
Effectiveness: High
Illustrative examples
Real CVEs that MITRE cites as examples of this weakness.
- 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.
Terminology & mappings
Mapped taxonomies
- PLOVER: Invalid Characters in Identifiers
- Software Fault Patterns: Tainted input to command (SFP24)
Attack patterns
CAPEC attack patterns that exploit this weakness.
Frequently asked questions
Common questions about CWE-86.
- What is CWE-86?
- The product does not neutralize or incorrectly neutralizes invalid characters or byte sequences in the middle of tag names, URI schemes, and other identifiers.
- What CVEs are caused by CWE-86?
- 10 recorded CVEs are attributed to CWE-86, including CVE-2023-31126, CVE-2026-28417, CVE-2024-21864.
- How do you prevent CWE-86?
- 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.
- How is CWE-86 detected?
- 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.)
- What are the consequences of CWE-86?
- Exploiting CWE-86 can lead to: Read Application Data, Execute Unauthorized Code or Commands.
- Is CWE-86 actively exploited?
- 10 recorded CVEs are caused by CWE-86; none are currently in CISA's KEV catalog of actively exploited flaws.
References
- MITRE CWE definition (CWE-86) (opens in a new tab)
- CWE-86 vulnerabilities on NVD (opens in a new tab)
- Learn: What is a CWE?
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Stay ahead of CWE-86
Get alerted the moment a new CWE-86 vulnerability affects your stack, with AI-written analysis, severity context, and remediation guidance.