CWE-26: Path Traversal: '/dir/../filename'
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.
Last updated
Overview
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.
Real-world CVEs
15 recorded CVEs are caused by CWE-26 (Path Traversal: '/dir/../filename'). The highest-severity and most recent are shown first. 4 new CWE-26 CVEs have been recorded so far in 2026 (2 in 2025).
- CVE-2026-42196
django-s3file: Relative path traversal
Critical · CVSS 9.9 · EPSS 45th2026-05-12 - CVE-2024-28064Critical · CVSS 9.8 · EPSS 56th2024-05-18
- CVE-2026-76317
Path Traversal through the Lookup Configuration REST API in Splunk Enterprise
High · CVSS 8.8 · EPSS 32th2026-08-19 - CVE-2026-25575
NavigaTUM has a Path Traversal Vulnerability in the propose_edits functionality
High · CVSS 8.8 · EPSS 37th2026-02-04 - CVE-2024-29466High · CVSS 8.8 · EPSS 62th2024-04-30
- CVE-2025-53908
RomM vulnerable to Authenticated Path Traversal
High · CVSS 8.3 · EPSS 38th2025-07-16 - CVE-2021-34762High · CVSS 8.1 · EPSS 79th2021-10-27
- CVE-2024-5865High · CVSS 7.7 · EPSS 39th2024-07-02
- CVE-2024-31551High · CVSS 7.5 · EPSS 50th2024-04-26
- CVE-2021-42021High · CVSS 7.5 · EPSS 75th2021-11-09
- CVE-2024-25466High · CVSS 7.2 · EPSS 43th2024-02-16
- CVE-2022-45133Medium · CVSS 6.5 · EPSS 26th2025-08-22
Showing 12 of 15 recorded CWE-26 CVEs. Track new ones as they are published and get AI-written analysis and fixes.
Monitor CWE-26 vulnerabilitiesCommon consequences
What can happen when CWE-26 is exploited.
Read Files or Directories, Modify Files or Directories
Affects: Confidentiality, Integrity
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
Applies to
Technologies
How to prevent it
Practical mitigations for CWE-26, grouped by where in the lifecycle they apply.
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.
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.
How to detect it
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.)
Illustrative examples
Real CVEs that MITRE cites as examples of this weakness.
- 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
Terminology & mappings
Mapped taxonomies
- PLOVER: '/directory/../filename
- Software Fault Patterns: Path Traversal (SFP16)
Frequently asked questions
Common questions about CWE-26.
- What is CWE-26?
- 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.
- What CVEs are caused by CWE-26?
- 15 recorded CVEs are attributed to CWE-26, including CVE-2026-42196, CVE-2024-28064, CVE-2026-76317.
- How do you prevent CWE-26?
- 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.
- How is CWE-26 detected?
- 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.)
- What are the consequences of CWE-26?
- Exploiting CWE-26 can lead to: Read Files or Directories, Modify Files or Directories.
- Is CWE-26 actively exploited?
- 15 recorded CVEs are caused by CWE-26; none are currently in CISA's KEV catalog of actively exploited flaws.
References
- MITRE CWE definition (CWE-26) (opens in a new tab)
- CWE-26 vulnerabilities on NVD (opens in a new tab)
- Learn: What is a CWE?
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Stay ahead of CWE-26
Get alerted the moment a new CWE-26 vulnerability affects your stack, with AI-written analysis, severity context, and remediation guidance.