CWEweakness
CWE-26 Path Traversal: '/dir/../filename'
- Abstraction
- Variant
- Structure
- Simple
- Status
- Draft
- Languages
- Not Language-Specific
- CWE version
- 5.0
Description
The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize "/dir/../filename" sequences that can resolve to a location that is outside of that directory.
Extended description
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.
Common consequences
• Confidentiality, Integrity: Read Files or Directories, Modify Files or Directories — An attacker can traverse the file system to access files or directories that are outside of the restricted directory.
Potential mitigations
• [Implementation] 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] 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.
Detection methods
• 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.)
Observed examples
• CVE-2025-25295: Python SDK checks if a URL starts with "/data/upload/" but allows "/data/upload/../../" path traversal sequences that are converted using os.path.join
• CVE-2023-25802: web interface allows reading arbitrary files via manipulations such as /etc/nginx/../passwd
Related
Observed example · CVE (2)
- CVE-2025-25295 Label Studio is an open source data labeling tool. vulnerability
- CVE-2023-25802 Roxy-WI is a Web interface for managing Haproxy, Nginx, Apache, and Keepalived servers. vulnerability
Child of · CWE (1)
- CWE-23 Relative Path Traversal weakness
Referenced by CVE · weakness (20)
- CVE-2026-112904 Vvveb is a powerful and easy to use CMS with page builder to build websites, blogs or ecommerce stores. vulnerability
- CVE-2026-15896 The Super Forms – Drag & Drop Form Builder plugin for WordPress is vulnerable to Directory Traversal in all versions up to, and including,… vulnerability
- CVE-2026-76317 In Splunk Enterprise versions below 10.4.2, 10.2.6, 10.0.9, and 9.4.14, a user who does not hold the "admin" or "power" Splunk roles could… vulnerability
- CVE-2026-46747 A vulnerability has been identified in SINEC INS (All versions < V1.0 SP2 Update 6). vulnerability
- CVE-2026-42196 django-s3file is a lightweight file upload input for Django and Amazon S3. vulnerability
- CVE-2026-25575 NavigaTUM is a website and API to search for rooms, buildings and other places. vulnerability
- CVE-2022-45133 Mahara 21.10 before 21.10.6, 22.04 before 22.04.4, and 22.10 before 22.10.1 allows unsafe font upload for skins. vulnerability
- CVE-2025-53908 RomM is a self-hosted rom manager and player. vulnerability
- CVE-2025-25295 Label Studio is an open source data labeling tool. vulnerability
- CVE-2024-5865 Vulnerability in Delinea Centrify PAS v. vulnerability
- CVE-2024-5866 Vulnerability in Delinea Centrify PAS v. vulnerability
- CVE-2024-28064 Kiteworks Totemomail 7.x and 8.x before 8.3.0 allows /responsiveUI/EnvelopeOpenServlet messageId directory traversal for unauthenticated… vulnerability
- CVE-2024-29466 Directory Traversal vulnerability in lsgwr spring boot online exam v.0.9 allows an attacker to execute arbitrary code via the… vulnerability
- CVE-2024-31551 Directory Traversal vulnerability in lib/admin/image.admin.php in cmseasy v7.7.7.9 20240105 allows attackers to delete arbitrary files via… vulnerability
- CVE-2024-20345 A vulnerability in the file upload functionality of Cisco AppDynamics Controller could allow an authenticated, remote attacker to conduct… vulnerability
- CVE-2024-25466 Directory Traversal vulnerability in React Native Document Picker before v.9.1.1 and fixed in v.9.1.1 allows a local attacker to execute… vulnerability
- CVE-2023-50255 Deepin-Compressor is the default archive manager of Deepin Linux OS. vulnerability
- CVE-2023-25802 Roxy-WI is a Web interface for managing Haproxy, Nginx, Apache, and Keepalived servers. vulnerability
- CVE-2021-42021 A vulnerability has been identified in Siveillance Video DLNA Server (2019 R1), Siveillance Video DLNA Server (2019 R2), Siveillance Video… vulnerability
- CVE-2021-34762 A vulnerability in the web-based management interface of Cisco Firepower Management Center (FMC) Software could allow an authenticated,… vulnerability