---
title: "CWE-25: Path Traversal: '/../filedir'"
url: https://radicalnotion.ai/cwe/cwe-25
type: cwe
description: "The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize \"/../\" sequences that can resolve to a location that is outside of that directory."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-25: Path Traversal: '/../filedir'

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 12
- **Of those, in CISA KEV:** 1
- **New in 2026:** 2
- **CWE catalog version:** 4.21

## Description

The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize "/../" sequences that can resolve to a location that is outside of that directory.

Sometimes a program checks for "../" at the beginning of the input, so a "/../" can bypass that check.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| 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 (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 (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.

## 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 | Description |
| --- | --- |
| CVE-2022-20775 | A cloud management tool allows attackers to bypass the restricted shell using path traversal sequences like "/../" in the USER environment variable. |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2022-20775 | Cisco SD-WAN Software Privilege Escalation Vulnerability | high | 8.5 | - | Yes | 2022-09-30 |
| CVE-2023-52138 | Path traversal via crafted cpio archives in Engrampa archivers | critical | 9.6 | - | No | 2024-02-05 |
| CVE-2025-68916 | - | critical | 9.1 | - | No | 2025-12-24 |
| CVE-2022-20818 | Cisco SD-WAN Software Privilege Escalation Vulnerabilities | high | 7.8 | - | No | 2022-09-30 |
| CVE-2023-6947 | Best WordPress Gallery Plugin – FooGallery \<= 2.4.16 - Authenticated (Contributor+) Directory Traversal | high | 7.7 | - | No | 2024-12-10 |
| CVE-2024-2442 | Path Traversal vulnerability in Franklin Fueling System EVO 550/5000 | high | 7.5 | - | No | 2024-03-19 |
| CVE-2023-6919 | Path Traversal in VGuard IP Camera Network Recorder | high | 7.5 | - | No | 2024-01-26 |
| CVE-2023-6118 | Path Traversal in Neutron IP Camera | high | 7.5 | - | No | 2023-11-23 |
| CVE-2026-68959 | Path traversal in SKYMEC IT Manager and SKYSEA Client View | medium | 5.8 | - | No | 2026-08-25 |
| CVE-2025-58286 | Denial of service (DoS) vulnerability in the office service | medium | 5.5 | - | No | 2025-10-11 |
| CVE-2026-23877 | Directory Traversal & Filesystem can be accessed by a non-admin user | medium | 5.3 | - | No | 2026-01-19 |
| CVE-2025-0225 | Tsinghua Unigroup Electronic Archives System exampleDownload.html path traversal | medium | 5.3 | - | No | 2025-01-05 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-23](https://radicalnotion.ai/cwe/cwe-23) | Relative Path Traversal |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | '/../filedir | - | - |
| Software Fault Patterns | Path Traversal | SFP16 | - |

## Frequently asked questions

### What is CWE-25?

The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize "/../" sequences that can resolve to a location that is outside of that directory.

### What CVEs are caused by CWE-25?

12 recorded CVEs are attributed to CWE-25, including CVE-2022-20775, CVE-2023-52138 and CVE-2025-68916. 1 is listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### How do you prevent CWE-25?

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-25 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-25?

Exploiting CWE-25 can lead to: Read Files or Directories, Modify Files or Directories.

### Is CWE-25 actively exploited?

Yes. 1 CWE-25 vulnerability is in CISA's KEV catalog of actively exploited flaws, out of 12 recorded CVEs.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/25.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-25). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
