---
title: "CWE-86: Improper Neutralization of Invalid Characters in Identifiers in Web Pages"
url: https://radicalnotion.ai/cwe/cwe-86
type: cwe
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."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-86: Improper Neutralization of Invalid Characters in Identifiers in Web Pages

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 10
- **Of those, in CISA KEV:** 0
- **New in 2026:** 2
- **CWE catalog version:** 4.21

## 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.

Some web browsers may attempt to proactively handle malformed or invalid web pages by removing invalid characters or byte sequences in ways 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.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Technologies:** Web Based (Often), Web Server (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity, Availability | Read Application Data, Execute Unauthorized Code or Commands | - |

## Potential mitigations

### Implementation (Output Encoding)

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 (Attack Surface Reduction)

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

## 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.)

Effectiveness: High

## Observed examples

| CVE | Description |
| --- | --- |
| 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. |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2023-31126 | Improper Neutralization of Invalid Characters in Data Attribute Names in org.xwiki.commons:xwiki-commons-xml | critical | 9.6 | - | No | 2023-05-09 |
| CVE-2026-28417 | Vim has OS Command Injection in netrw | high | 7.8 | - | No | 2026-02-27 |
| CVE-2024-21864 | - | high | 7.8 | - | No | 2024-05-16 |
| CVE-2021-33158 | - | high | 7.2 | - | No | 2024-05-16 |
| CVE-2024-10941 | firefox: Browser crash from invalid URI | medium | 6.5 | - | No | 2024-11-06 |
| CVE-2023-22840 | - | medium | 5.5 | - | No | 2023-08-11 |
| CVE-2025-20168 | Cisco Common Services Platform Collector Cross-Site Scripting Vulnerability | medium | 5.4 | - | No | 2025-01-08 |
| CVE-2025-20167 | Cisco Common Services Platform Collector Cross-Site Scripting Vulnerability | medium | 5.4 | - | No | 2025-01-08 |
| CVE-2025-20166 | Cisco Common Services Platform Collector Cross-Site Scripting Vulnerability | medium | 5.4 | - | No | 2025-01-08 |
| CVE-2025-66606 | Improper Neutralization of Invalid Characters in Identifiers in Web Pages in Yokogawa FAST/TOOLS | low | 2.1 | - | No | 2026-02-09 |

## Related attack patterns (CAPEC)

- [CAPEC-247](https://radicalnotion.ai/capec/capec-247): XSS Using Invalid Characters
- [CAPEC-73](https://radicalnotion.ai/capec/capec-73): User-Controlled Filename
- [CAPEC-85](https://radicalnotion.ai/capec/capec-85): AJAX Footprinting

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-79](https://radicalnotion.ai/cwe/cwe-79) | Improper Neutralization of Input During Web Page Generation |
| Parent | [CWE-436](https://radicalnotion.ai/cwe/cwe-436) | Interpretation Conflict |
| Peer | [CWE-184](https://radicalnotion.ai/cwe/cwe-184) | Incomplete List of Disallowed Inputs |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Invalid Characters in Identifiers | - | - |
| Software Fault Patterns | Tainted input to command | SFP24 | - |

## Frequently asked questions

### 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 and 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.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/86.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-86). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
