CWE-182: Collapse of Data into Unsafe Value

Base Draft Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

The product filters data in a way that causes it to be reduced or "collapsed" into an unsafe value that violates an expected security property.

常见后果

影响范围: Access Control

技术影响: Bypass Protection Mechanism

潜在缓解措施

阶段: Architecture and Design

策略: Input Validation

描述: Avoid making decisions based on names of resources (e.g. files) if those resources can have alternate names.

阶段: Implementation

策略: Input Validation

阶段: Implementation

策略: Input Validation

描述: Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.

描述: Canonicalize the name to match that of the file system's representation of the name. This can sometimes be achieved with an available API (e.g. in Win32 the GetFullPathName function).

检测方法

方法: 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-0815

"/.////" in pathname collapses to absolute path.

参考: CVE-2005-3123

"/.//..//////././" is collapsed into "/.././" after ".." and "//" sequences are removed.

参考: CVE-2002-0325

".../...//" collapsed to "..." due to removal of "./" in web server.

参考: CVE-2002-0784

chain: HTTP server protects against ".." but allows "." variants such as "////./../.../". If the server removes "/.." sequences, the result would collapse into an unsafe value "////../" (CWE-182).

参考: CVE-2005-2169

MFV. Regular expression intended to protect against directory traversal reduces ".../...//" to "../".

参考: CVE-2001-1157

XSS protection mechanism strips a <script> sequence that is nested in another <script> sequence.

引入模式

阶段 说明
Implementation -

适用平台

编程语言
Not Language-Specific (Undetermined)

分类映射

分类名称 条目ID 条目名称 映射适配度
PLOVER - Collapse of Data into Unsafe Value -
The CERT Oracle Secure Coding Standard for Java (2011) IDS11-J Eliminate noncharacter code points before validation -
关键信息

CWE ID: CWE-182

抽象级别: Base

结构: Simple

状态: Draft

相关弱点