CWE-41 对路径等价的解析不恰当

Improper Resolution of Path Equivalence

结构: Simple

Abstraction: Base

状态: Incomplete

被利用可能性: unkown

基本描述

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.

扩展描述

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.

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 706 cwe_View_ID: 1000 cwe_Ordinal: Primary

适用平台

Language: {'cwe_Class': 'Language-Independent', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
['Confidentiality', 'Integrity', 'Access Control'] ['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.

检测方法

Automated Static Analysis - Binary or Bytecode

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Bytecode Weakness Analysis - including disassembler + source code weakness analysis

Manual Static Analysis - Binary or Bytecode

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies

Dynamic Analysis with Automated Results Interpretation

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Web Application Scanner
  • Web Services Scanner
  • Database Scanners

Dynamic Analysis with Manual Results Interpretation

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Fuzz Tester
  • Framework-based Fuzzer

Manual Static Analysis - Source Code

According to SOAR, the following detection techniques may be useful:

Highly cost effective:
  • Focused Manual Spotcheck - Focused manual analysis of source
  • Manual Source Code Review (not inspections)

Automated Static Analysis - Source Code

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Source code Weakness Analyzer
  • Context-configured Source Code Weakness Analyzer

Architecture or Design Review

According to SOAR, the following detection techniques may be useful:

Highly cost effective:
  • Formal Methods / Correct-By-Construction
Cost effective for partial coverage:
  • Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

可能的缓解方案

MIT-5 Implementation

策略: 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.

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

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

分析过的案例

标识 说明 链接
CVE-2000-1114 Source code disclosure using trailing dot https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-1114
CVE-2002-1986, Source code disclosure using trailing dot https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-1986,
CVE-2004-2213 Source code disclosure using trailing dot or trailing encoding space "%20" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-2213
CVE-2005-3293 Source code disclosure using trailing dot https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-3293
CVE-2004-0061 Bypass directory access restrictions using trailing dot in URL https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0061
CVE-2000-1133 Bypass directory access restrictions using trailing dot in URL https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-1133
CVE-2001-1386 Bypass check for ".lnk" extension using ".lnk." https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1386
CVE-2001-0693 Source disclosure via trailing encoded space "%20" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-0693
CVE-2001-0778 Source disclosure via trailing encoded space "%20" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-0778
CVE-2001-1248 Source disclosure via trailing encoded space "%20" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1248
CVE-2004-0280 Source disclosure via trailing encoded space "%20" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0280
CVE-2005-0622 Source disclosure via trailing encoded space "%20" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-0622
CVE-2005-1656 Source disclosure via trailing encoded space "%20" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-1656
CVE-2002-1603 Source disclosure via trailing encoded space "%20" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-1603
CVE-2001-0054 Multi-Factor Vulnerability (MVF). directory traversal and other issues in FTP server using Web encodings such as "%20"; certain manipulations have unusual side effects. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-0054
CVE-2002-1451 Trailing space ("+" in query string) leads to source code disclosure. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-1451
CVE-2000-0293 Filenames with spaces allow arbitrary file deletion when the product does not properly quote them; some overlap with path traversal. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0293
CVE-2001-1567 "+" characters in query string converted to spaces before sensitive file/extension (internal space), leading to bypass of access restrictions to the file. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1567
CVE-2002-0253 Overlaps infoleak https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-0253
CVE-2001-0446 Application server allows remote attackers to read source code for .jsp files by appending a / to the requested URL. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-0446
CVE-2004-0334 Bypass Basic Authentication for files using trailing "/" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0334
CVE-2001-0893 Read sensitive files with trailing "/" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-0893
CVE-2001-0892 Web server allows remote attackers to view sensitive files under the document root (such as .htpasswd) via a GET request with a trailing /. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-0892
CVE-2004-1814 Directory traversal vulnerability in server allows remote attackers to read protected files via .. (dot dot) sequences in an HTTP request. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-1814
BID:3518 Source code disclosure http://www.securityfocus.com/bid/3518
CVE-2002-1483 Read files with full pathname using multiple internal slash. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-1483
CVE-1999-1456 Server allows remote attackers to read arbitrary files via a GET request with more than one leading / (slash) character in the filename. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-1999-1456
CVE-2004-0578 Server allows remote attackers to read arbitrary files via leading slash (//) characters in a URL request. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0578
CVE-2002-0275 Server allows remote attackers to bypass authentication and read restricted files via an extra / (slash) in the requested URL. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-0275
CVE-2004-1032 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. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-1032
CVE-2002-1238 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/. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-1238
CVE-2004-1878 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). https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-1878
CVE-2005-1365 Server allows remote attackers to execute arbitrary commands via a URL with multiple leading "/" (slash) characters and ".." sequences. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-1365
CVE-2000-1050 Access directory using multiple leading slash. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-1050
CVE-2001-1072 Bypass access restrictions via multiple leading slash, which causes a regular expression to fail. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1072
CVE-2004-0235 Archive extracts to arbitrary files using multiple leading slash in filenames in the archive. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0235
CVE-2002-1078 Directory listings in web server using multiple trailing slash https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-1078
CVE-2004-0847 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." https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0847
CVE-2000-0004 Server allows remote attackers to read source code for executable files by inserting a . (dot) into the URL. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0004
CVE-2002-0304 Server allows remote attackers to read password-protected files via a /./ in the HTTP request. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-0304
BID:6042 Input Validation error http://www.securityfocus.com/bid/6042
CVE-1999-1083 Possibly (could be a cleansing error) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-1999-1083
CVE-2004-0815 "/./////etc" cleansed to ".///etc" then "/etc" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0815
CVE-2002-0112 Server allows remote attackers to view password protected files via /./ in the URL. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-0112
CVE-2004-0696 List directories using desired path and "*" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0696
CVE-2002-0433 List files in web server using "*.ext" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-0433
CVE-2001-1152 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. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1152
CVE-2000-0191 application check access for restricted URL before canonicalization https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0191
CVE-2005-1366 CGI source disclosure using "dirname/../cgi-bin" https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-1366
CVE-1999-0012 Multiple web servers allow restriction bypass using 8.3 names instead of long names https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-1999-0012
CVE-2001-0795 Source code disclosure using 8.3 file name. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-0795
CVE-2005-0471 Multi-Factor Vulnerability. Product generates temporary filenames using long filenames, which become predictable in 8.3 format. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-0471

Notes

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
PLOVER Path Equivalence
CERT C Secure Coding FIO02-C Canonicalize path names originating from untrusted sources

相关攻击模式

  • CAPEC-3