---
title: "CWE-73: External Control of File Name or Path"
url: https://radicalnotion.ai/cwe/cwe-73
type: cwe
description: "The product allows user input to control or influence paths or file names that are used in filesystem operations."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-73: External Control of File Name or Path

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **Likelihood of exploit:** High
- **CVEs with this as primary weakness:** 665
- **Of those, in CISA KEV:** 5
- **New in 2026:** 380
- **CWE catalog version:** 4.21

## Description

The product allows user input to control or influence paths or file names that are used in filesystem operations.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | - |
| Implementation | - |
| Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |

## Applicable platforms

**Operating systems:** Unix (Often), Windows (Often), macOS (Often)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity, Confidentiality | Read Files or Directories | The application can operate on unexpected files, such as system files or configuration files. Confidentiality is violated when the targeted filename is not directly readable by the attacker. |
| Integrity, Confidentiality, Availability | Modify Files or Directories, Execute Unauthorized Code or Commands | The application can operate on unexpected files. This may violate integrity if the filename is written to, or if the filename is for a program or other form of executable code. |
| Availability | DoS: Crash, Exit, or Restart, DoS: Resource Consumption (Other) | The application can operate on unexpected files. Availability can be violated if the attacker specifies an unexpected file that the application modifies. Availability can also be affected if the attacker specifies a filename for a large file, or points to a special device or a file that does not have the format that the application expects. |

## Potential mitigations

### Architecture and Design

When the set of filenames is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames, and reject all other inputs. For example, ID 1 could map to "inbox.txt" and ID 2 could map to "profile.txt". Features such as the ESAPI AccessReferenceMap provide this capability.

### Architecture and Design, Operation

Run your code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict all access to files within a particular directory.

Examples include the Unix chroot jail and AppArmor. In general, managed code may provide some protection.

This may not be a feasible solution, and it only limits the impact to the operating system; the rest of your application may still be subject to compromise.

Be careful to avoid CWE-243 and other weaknesses related to jails.

### Architecture and Design

For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.

### 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.

Effectiveness: High

### Implementation

Use a built-in path canonicalization function (such as realpath() in C) that produces the canonical version of the pathname, which effectively removes ".." sequences and symbolic links (CWE-23, CWE-59).

### Installation, Operation

Use OS-level permissions and run as a low-privileged user to limit the scope of any successful attack.

### Operation, Implementation

If you are using PHP, configure your application so that it does not use register\_globals. During implementation, develop your application so that it does not rely on this feature, but be wary of implementing a register\_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.

### Testing

Use tools and techniques that require manual (human) analysis, such as penetration testing, threat modeling, and interactive tools that allow the tester to record and modify an active session. These may be more effective than strictly automated techniques. This is especially the case with weaknesses that are related to design and business rules.

## Detection methods

### Automated Static Analysis

The external control or influence of filenames can often be detected using automated static analysis that models data flow within the product.

Automated static analysis might not be able to recognize when proper input validation is being performed, leading to false positives - i.e., warnings that do not have any security consequences or require any code changes.

## Demonstrative examples

### Example 1

The following code uses input from an HTTP request to create a file name. The programmer has not considered the possibility that an attacker could provide a file name such as "../../tomcat/conf/server.xml", which causes the application to delete one of its own configuration files (CWE-22).

Bad code:

```java
String rName = request.getParameter("reportName");
File rFile = new File("/usr/local/apfr/reports/" + rName);
...
rFile.delete();
```

### Example 2

The following code uses input from a configuration file to determine which file to open and echo back to the user. If the program runs with privileges and malicious users can change the configuration file, they can use the program to read any file on the system that ends with the extension .txt.

Bad code:

```java
fis = new FileInputStream(cfg.getProperty("sub")+".txt");
amt = fis.read(arr);
out.println(arr);
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2022-45918 | Chain: a learning management tool debugger uses external input to locate previous session logs (CWE-73) and does not properly validate the given path (CWE-20), allowing for filesystem path traversal using "../" sequences (CWE-24) |
| CVE-2008-5748 | Chain: external control of values for user's desired language and theme enables path traversal. |
| CVE-2008-5764 | Chain: external control of user's target language enables remote file inclusion. |

## Real CVEs with this weakness (sample of 12 of 665)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-96656 | Plex Media Server arbitrary file write | high | 8.6 | - | Yes | 2026-09-23 |
| CVE-2025-33053 | Internet Shortcut Files Remote Code Execution Vulnerability | high | 8.6 | - | Yes | 2025-06-10 |
| CVE-2025-0111 | PAN-OS: Authenticated File Read Vulnerability in the Management Web Interface | high | 7.1 | - | Yes | 2025-02-12 |
| CVE-2025-24054 | NTLM Hash Disclosure Spoofing Vulnerability | medium | 6.9 | - | Yes | 2025-03-11 |
| CVE-2024-43451 | NTLM Hash Disclosure Spoofing Vulnerability | medium | 6.9 | - | Yes | 2024-11-12 |
| CVE-2026-124822 | Easy DragDrop File Uploader \< 1.1.10 - Unauthenticated Arbitrary File Deletion via Path Traversal | critical | 10.0 | - | No | 2026-11-13 |
| CVE-2026-107594 | File Upload to Order \< 1.1.4 - Unauthenticated Arbitrary File Deletion | critical | 10.0 | - | No | 2026-10-14 |
| CVE-2026-101148 | BackupSheep \<= 1.8 - Unauthenticated Arbitrary File Deletion and Backup Exfiltration via Empty Integration Key | critical | 10.0 | - | No | 2026-10-01 |
| CVE-2026-20358 | Cisco Crosswork Security Hardening Release: August 2026 | critical | 10.0 | - | No | 2026-08-19 |
| CVE-2026-50148 | Metabase: Remote Code Execution via Snowflake JDBC Driver Arbitrary File Write | critical | 10.0 | - | No | 2026-07-15 |
| CVE-2025-71338 | Flowise through 2.2.7 - Arbitrary File Write to Remote Code Execution via document-store API | critical | 10.0 | - | No | 2026-06-25 |
| CVE-2025-54945 | SUNNET Corporate Training Management System - External Control of File Name or Path | critical | 10.0 | - | No | 2025-08-30 |

## Related attack patterns (CAPEC)

- [CAPEC-13](https://radicalnotion.ai/capec/capec-13): Subverting Environment Variable Values
- [CAPEC-267](https://radicalnotion.ai/capec/capec-267): Leverage Alternate Encoding
- [CAPEC-64](https://radicalnotion.ai/capec/capec-64): Using Slashes and URL Encoding Combined to Bypass Validation Logic
- [CAPEC-72](https://radicalnotion.ai/capec/capec-72): URL Encoding
- [CAPEC-76](https://radicalnotion.ai/capec/capec-76): Manipulating Web Input to File System Calls
- [CAPEC-78](https://radicalnotion.ai/capec/capec-78): Using Escaped Slashes in Alternate Encoding
- [CAPEC-79](https://radicalnotion.ai/capec/capec-79): Using Slashes in Alternate Encoding
- [CAPEC-80](https://radicalnotion.ai/capec/capec-80): Using UTF-8 Encoding to Bypass Validation Logic

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-20](https://radicalnotion.ai/cwe/cwe-20) | Improper Input Validation |
| Parent | [CWE-610](https://radicalnotion.ai/cwe/cwe-610) | Externally Controlled Reference to a Resource in Another Sphere |
| Parent | [CWE-642](https://radicalnotion.ai/cwe/cwe-642) | External Control of Critical State Data |
| Child | [CWE-114](https://radicalnotion.ai/cwe/cwe-114) | Process Control |
| Can precede | [CWE-22](https://radicalnotion.ai/cwe/cwe-22) | Improper Limitation of a Pathname to a Restricted Directory |
| Can precede | [CWE-41](https://radicalnotion.ai/cwe/cwe-41) | Improper Resolution of Path Equivalence |
| Can precede | [CWE-59](https://radicalnotion.ai/cwe/cwe-59) | Improper Link Resolution Before File Access |
| Can precede | [CWE-98](https://radicalnotion.ai/cwe/cwe-98) | Improper Control of Filename for Include/Require Statement in PHP Program |
| Can precede | [CWE-434](https://radicalnotion.ai/cwe/cwe-434) | Unrestricted Upload of File with Dangerous Type |
| Related | [CWE-99](https://radicalnotion.ai/cwe/cwe-99) | Improper Control of Resource Identifiers |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| 7 Pernicious Kingdoms | Path Manipulation | - | - |
| Software Fault Patterns | Path Traversal | SFP16 | - |

## Frequently asked questions

### What is CWE-73?

The product allows user input to control or influence paths or file names that are used in filesystem operations.

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

665 recorded CVEs are attributed to CWE-73, including CVE-2026-96656, CVE-2025-33053 and CVE-2025-0111. 5 are listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### How do you prevent CWE-73?

When the set of filenames is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames, and reject all other inputs. For example, ID 1 could map to "inbox.txt" and ID 2 could map to "profile.txt". Features such as the ESAPI AccessReferenceMap provide this capability.

### How is CWE-73 detected?

Automated Static Analysis: The external control or influence of filenames can often be detected using automated static analysis that models data flow within the product.

### What are the consequences of CWE-73?

Exploiting CWE-73 can lead to: Read Files or Directories, Modify Files or Directories, Execute Unauthorized Code or Commands, DoS: Crash, Exit, or Restart, DoS: Resource Consumption (Other).

### Is CWE-73 actively exploited?

Yes. 5 CWE-73 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 665 recorded CVEs.

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

---

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