This allows attackers to traverse the file system to access files or directories that are outside of the restricted directory.
The '/dir/../filename' manipulation is useful for bypassing some path traversal protection schemes. Sometimes a program only checks for "../" at the beginning of the input, so a "/../" can bypass that check.
| Impact | Details |
|---|---|
|
Read Files or Directories; Modify Files or Directories |
Scope: Confidentiality, Integrity |
| Phase(s) | Mitigation |
|---|---|
|
Implementation |
Strategy: Input Validation Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list 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. This 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, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright. When validating filenames, use stringent allowlists that limit the character set to be used. If feasible, only allow a single "." character in the filename to avoid weaknesses such as CWE-23, and exclude directory separators such as "/" to avoid CWE-36. Use a list of allowable file extensions, which will help to avoid CWE-434. Do not rely exclusively on a filtering mechanism that removes potentially dangerous characters. This is equivalent to a denylist, which may be incomplete (CWE-184). For example, filtering "/" is insufficient protection if the filesystem also supports the use of "\" as a directory separator. Another possible error could occur when the filtering is applied in a way that still produces dangerous data (CWE-182). For example, if "../" sequences are removed from the ".../...//" string in a sequential fashion, two instances of "../" would be removed from the original string, but the remaining characters would still form the "../" string. |
|
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 allowlist validation schemes by introducing dangerous inputs after they have been checked.
|
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 23 | Relative Path Traversal |
| Phase | Note |
|---|---|
| Implementation |
Class: Not Language-Specific (Undetermined Prevalence)
Web Server (Often Prevalent)
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 981 | SFP Secondary Cluster: Path Traversal |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1404 | Comprehensive Categorization: File Handling |
Rationale
This CWE entry is at the Variant level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.Comments
Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.| Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
|---|---|---|---|
| PLOVER | '/directory/../filename | ||
| Software Fault Patterns | SFP16 | Path Traversal |
| Submissions | |||
|---|---|---|---|
| Submission Date | Submitter | Organization | |
|
2006年07月19日
(CWE Draft 3, 2006年07月19日) |
PLOVER | ||
| Modifications | |||
| Modification Date | Modifier | Organization | |
|
2025年09月09日
(CWE 4.18, 2025年09月09日) |
CWE Content Team | MITRE | |
| updated Affected_Resources, Functional_Areas | |||
| 2023年06月29日 | CWE Content Team | MITRE | |
| updated Mapping_Notes | |||
| 2023年04月27日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2023年01月31日 | CWE Content Team | MITRE | |
| updated Description | |||
| 2020年06月25日 | CWE Content Team | MITRE | |
| updated Potential_Mitigations | |||
| 2020年02月24日 | CWE Content Team | MITRE | |
| updated Potential_Mitigations, Relationships | |||
| 2017年11月08日 | CWE Content Team | MITRE | |
| updated Applicable_Platforms | |||
| 2014年07月30日 | CWE Content Team | MITRE | |
| updated Relationships, Taxonomy_Mappings | |||
| 2012年05月11日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2011年06月01日 | CWE Content Team | MITRE | |
| updated Common_Consequences | |||
| 2011年03月29日 | CWE Content Team | MITRE | |
| updated Potential_Mitigations | |||
| 2010年06月21日 | CWE Content Team | MITRE | |
| updated Description, Potential_Mitigations | |||
| 2009年07月27日 | CWE Content Team | MITRE | |
| updated Potential_Mitigations | |||
| 2008年10月14日 | CWE Content Team | MITRE | |
| updated Description | |||
| 2008年09月08日 | CWE Content Team | MITRE | |
| updated Applicable_Platforms, Relationships, Taxonomy_Mappings | |||
| 2008年07月01日 | Eric Dalci | Cigital | |
| updated Potential_Mitigations, Time_of_Introduction | |||
| Previous Entry Names | |||
| Change Date | Previous Entry Name | ||
| 2008年04月11日 | Path Issue - Leading Directory Dot Dot Slash - '/directory/../filename' | ||
Use of the Common Weakness Enumeration (CWE™) and the associated references from this website are subject to the Terms of Use. CWE is sponsored by the U.S. Department of Homeland Security (DHS) Cybersecurity and Infrastructure Security Agency (CISA) and managed by the Homeland Security Systems Engineering and Development Institute (HSSEDI) which is operated by The MITRE Corporation (MITRE). Copyright © 2006–2025, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation.