CWE

Common Weakness Enumeration

A Community-Developed Dictionary of Software Weakness Types

CWE/SANS Top 25 Most Dangerous Software Errors Common Weakness Scoring System
Common Weakness Risk Analysis Framework
Home > CWE List > CWE- Individual Dictionary Definition (2.7)  

Presentation Filter:

CWE-41: Improper Resolution of Path Equivalence

 
Improper Resolution of Path Equivalence
Weakness ID: 41 (Weakness Base)Status: Incomplete
+ Description

Description Summary

The system or application is vulnerable to file system contents disclosure through path equivalence. Path equivalence involves the use of special characters in file and directory names. The associated manipulations are intended to generate multiple names for the same object.

Extended Description

Path equivalence is usually employed in order to circumvent access controls expressed using an incomplete set of file name or file path representations. This is different from path traversal, wherein the manipulations are performed to generate a name for a different object.

+ Time of Introduction
  • Implementation
+ Applicable Platforms

Languages

All

+ Common Consequences
ScopeEffect

Technical Impact: Read files or directories; Modify files or directories; Bypass protection mechanism

An attacker may be able to traverse the file system to unintended locations and read or overwrite the contents of unexpected files. If the files are used for a security mechanism than an attacker may be able to bypass the mechanism.

+ Observed Examples
ReferenceDescription
Source code disclosure using trailing dot
Source code disclosure using trailing dot
Source code disclosure using trailing dot or trailing encoding space "%20"
Source code disclosure using trailing dot
Bypass directory access restrictions using trailing dot in URL
Bypass directory access restrictions using trailing dot in URL
Bypass check for ".lnk" extension using ".lnk."
Source disclosure via trailing encoded space "%20"
Source disclosure via trailing encoded space "%20"
Source disclosure via trailing encoded space "%20"
Source disclosure via trailing encoded space "%20"
Source disclosure via trailing encoded space "%20"
Source disclosure via trailing encoded space "%20"
Source disclosure via trailing encoded space "%20"
Multi-Factor Vulnerability (MVF). directory traversal and other issues in FTP server using Web encodings such as "%20"; certain manipulations have unusual side effects.
Trailing space ("+" in query string) leads to source code disclosure.
Filenames with spaces allow arbitrary file deletion when the product does not properly quote them; some overlap with path traversal.
"+" characters in query string converted to spaces before sensitive file/extension (internal space), leading to bypass of access restrictions to the file.
Overlaps infoleak
Application server allows remote attackers to read source code for .jsp files by appending a / to the requested URL.
Bypass Basic Authentication for files using trailing "/"
Read sensitive files with trailing "/"
Web server allows remote attackers to view sensitive files under the document root (such as .htpasswd) via a GET request with a trailing /.
Directory traversal vulnerability in server allows remote attackers to read protected files via .. (dot dot) sequences in an HTTP request.
Source code disclosure
Read files with full pathname using multiple internal slash.
Server allows remote attackers to read arbitrary files via a GET request with more than one leading / (slash) character in the filename.
Server allows remote attackers to read arbitrary files via leading slash (//) characters in a URL request.
Server allows remote attackers to bypass authentication and read restricted files via an extra / (slash) in the requested URL.
Product allows local users to delete arbitrary files or create arbitrary empty files via a target filename with a large number of leading slash (/) characters.
Server allows remote attackers to bypass access restrictions for files via an HTTP request with a sequence of multiple / (slash) characters such as http://www.example.com///file/.
Product allows remote attackers to bypass authentication, obtain sensitive information, or gain access via a direct request to admin/user.pl preceded by // (double leading slash).
Server allows remote attackers to execute arbitrary commands via a URL with multiple leading "/" (slash) characters and ".." sequences.
Access directory using multiple leading slash.
Bypass access restrictions via multiple leading slash, which causes a regular expression to fail.
Archive extracts to arbitrary files using multiple leading slash in filenames in the archive.
Directory listings in web server using multiple trailing slash
ASP.NET allows remote attackers to bypass authentication for .aspx files in restricted directories via a request containing a (1) "\" (backslash) or (2) "%5C" (encoded backslash), aka "Path Validation Vulnerability."
Server allows remote attackers to read source code for executable files by inserting a . (dot) into the URL.
Server allows remote attackers to read password-protected files via a /./ in the HTTP request.
Input Validation error
Possibly (could be a cleansing error)
"/./////etc" cleansed to ".///etc" then "/etc"
Server allows remote attackers to view password protected files via /./ in the URL.
List directories using desired path and "*"
List files in web server using "*.ext"
Proxy allows remote attackers to bypass blacklist restrictions and connect to unauthorized web servers by modifying the requested URL, including (1) a // (double slash), (2) a /SUBDIR/.. where the desired file is in the parentdir, (3) a /./, or (4) URL-encoded characters.
application check access for restricted URL before canonicalization
CGI source disclosure using "dirname/../cgi-bin"
Multiple web servers allow restriction bypass using 8.3 names instead of long names
Source code disclosure using 8.3 file name.
Multi-Factor Vulnerability. Product generates temporary filenames using long filenames, which become predictable in 8.3 format.
+ Potential Mitigations

Phase: Implementation

Strategy: Input Validation

Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a whitelist of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.

When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."

Do not rely exclusively on looking for malicious or malformed inputs (i.e., do not rely on a blacklist). A blacklist is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, blacklists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.

Phase: Implementation

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

Phase: Implementation

Strategy: 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 whitelist validation schemes by introducing dangerous inputs after they have been checked.

+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfCategoryCategory21Pathname Traversal and Equivalence Errors
Development Concepts (primary)699
ChildOfCategoryCategory632Weaknesses that Affect Files or Directories
Resource-specific Weaknesses (primary)631
ChildOfWeakness ClassWeakness Class706Use of Incorrectly-Resolved Name or Reference
Research Concepts (primary)1000
ChildOfCategoryCategory723OWASP Top Ten 2004 Category A2 - Broken Access Control
Weaknesses in OWASP Top Ten (2004) (primary)711
ChildOfCategoryCategory743CERT C Secure Coding Section 09 - Input Output (FIO)
Weaknesses Addressed by the CERT C Secure Coding Standard (primary)734
ChildOfCategoryCategory877CERT C++ Secure Coding Section 09 - Input Output (FIO)
Weaknesses Addressed by the CERT C++ Secure Coding Standard (primary)868
ChildOfCategoryCategory893SFP Cluster: Path Resolution
Software Fault Pattern (SFP) Clusters (primary)888
ParentOfWeakness VariantWeakness Variant42Path Equivalence: 'filename.' (Trailing Dot)
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant44Path Equivalence: 'file.name' (Internal Dot)
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant46Path Equivalence: 'filename ' (Trailing Space)
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant47Path Equivalence: ' filename' (Leading Space)
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant48Path Equivalence: 'file name' (Internal Whitespace)
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant49Path Equivalence: 'filename/' (Trailing Slash)
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant50Path Equivalence: '//multiple/leading/slash'
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant51Path Equivalence: '/multiple//internal/slash'
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant52Path Equivalence: '/multiple/trailing/slash//'
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant53Path Equivalence: '\multiple\\internal\backslash'
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant54Path Equivalence: 'filedir\' (Trailing Backslash)
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant55Path Equivalence: '/./' (Single Dot Directory)
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant56Path Equivalence: 'filedir*' (Wildcard)
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant57Path Equivalence: 'fakedir/../realdir/filename'
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant58Path Equivalence: Windows 8.3 Filename
Development Concepts (primary)699
Research Concepts (primary)1000
MemberOfViewView884CWE Cross-section
CWE Cross-section (primary)884
CanFollowWeakness ClassWeakness Class20Improper Input Validation
Research Concepts1000
CanFollowWeakness ClassWeakness Class73External Control of File Name or Path
Research Concepts1000
CanFollowWeakness ClassWeakness Class172Encoding Error
Research Concepts1000
+ Relationship Notes

Some of these manipulations could be effective in path traversal issues, too.

+ Affected Resources
  • File/Directory
+ Taxonomy Mappings
Mapped Taxonomy NameNode IDFitMapped Node Name
PLOVERPath Equivalence
CERT C Secure CodingFIO02-CCanonicalize path names originating from untrusted sources
CERT C++ Secure CodingFIO02-CPPCanonicalize path names originating from untrusted sources
+ Content History
Submissions
Submission DateSubmitterOrganizationSource
Externally Mined
Modifications
Modification DateModifierOrganizationSource
2008-07-01CigitalExternal
updated Potential_Mitigations, Time_of_Introduction
2008-09-08MITREInternal
updated Relationships, Other_Notes, Taxonomy_Mappings, Type
2008-10-14MITREInternal
updated Description
2008-11-24MITREInternal
updated Relationships, Taxonomy_Mappings
2009-03-10MITREInternal
updated Relationships
2009-05-27MITREInternal
updated Name
2009-07-27MITREInternal
updated Potential_Mitigations
2011-03-29MITREInternal
updated Other_Notes, Potential_Mitigations, Relationship_Notes
2011-06-01MITREInternal
updated Common_Consequences
2011-09-13MITREInternal
updated Relationships, Taxonomy_Mappings
2012-05-11MITREInternal
updated Common_Consequences, Observed_Examples, Relationships
2012-10-30MITREInternal
updated Potential_Mitigations
Previous Entry Names
Change DatePrevious Entry Name
2008-04-11Path Equivalence
2009-05-27Failure to Resolve Path Equivalence
Page Last Updated: June 23, 2014