CWE-182 – Collapse of Data into Unsafe Value

Read Time:1 Minute, 16 Second

Description

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

Modes of Introduction:

– Implementation

 

 

Related Weaknesses

CWE-693
CWE-33
CWE-34
CWE-35

 

Consequences

Access Control: Bypass Protection Mechanism

 

Potential Mitigations

Phase: Architecture and Design

Description: 

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

Phase: Implementation

Description: 

Phase: Implementation

Description: 

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.

Phase:

Description: 

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

CVE References

  • 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