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

Variant Draft Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

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

常见后果

影响范围: Confidentiality Integrity Availability

技术影响: Read Application Data Execute Unauthorized Code or Commands

潜在缓解措施

阶段: Implementation

策略: Output Encoding

阶段: 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.

有效性: Defense in Depth

检测方法

方法: 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.)

有效性: High

观察示例

参考: 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.

引入模式

阶段 说明
Implementation -

适用平台

编程语言
Not Language-Specific (Undetermined)

分类映射

分类名称 条目ID 条目名称 映射适配度
PLOVER - Invalid Characters in Identifiers -
Software Fault Patterns SFP24 Tainted input to command -
关键信息

CWE ID: CWE-86

抽象级别: Variant

结构: Simple

状态: Draft

相关弱点
相关攻击模式
CAPEC-247 CAPEC-73 CAPEC-85