CWE-73: External Control of File Name or Path
The product allows user input to control or influence paths or file names that are used in filesystem operations.
Last updated
Overview
This could allow an attacker to access or modify system files or other files that are critical to the application. Path manipulation errors occur when the following two conditions are met: 1. An attacker can specify a path used in an operation on the filesystem. 2. By specifying the resource, the attacker gains a capability that would not otherwise be permitted. For example, the program may give the attacker the ability to overwrite the specified file or run with a configuration controlled by the attacker.
Real-world CVEs
627 recorded CVEs are caused by CWE-73 (External Control of File Name or Path), including 6 in CISA's KEV (Known Exploited Vulnerabilities) catalog. KEVs are shown first. 340 new CWE-73 CVEs have been recorded so far in 2026 (130 in 2025).
- CVE-2020-1631CISA KEV
Out of Cycle Security Advisory: Junos OS: Security vulnerability in J-Web and web based (HTTP/HTTPS) services
Critical · CVSS 9.3 · EPSS 92th2020-05-04 - CVE-2026-96656CISA KEV
Plex Media Server arbitrary file write
High · CVSS 8.6 · EPSS 78th2026-09-23 - CVE-2025-33053CISA KEV
Internet Shortcut Files Remote Code Execution Vulnerability
High · CVSS 8.6 · EPSS 100th2025-06-10 - CVE-2025-0111CISA KEV
PAN-OS: Authenticated File Read Vulnerability in the Management Web Interface
High · CVSS 7.1 · EPSS 81th2025-02-12 - CVE-2025-24054CISA KEV
NTLM Hash Disclosure Spoofing Vulnerability
Medium · CVSS 6.9 · EPSS 99th2025-03-11 - CVE-2024-43451CISA KEV
NTLM Hash Disclosure Spoofing Vulnerability
Medium · CVSS 6.9 · EPSS 100th2024-11-12 - CVE-2026-107594
File Upload to Order < 1.1.4 - Unauthenticated Arbitrary File Deletion
Critical · CVSS 10.0 · EPSS 40th2026-10-14 - CVE-2026-101148
BackupSheep <= 1.8 - Unauthenticated Arbitrary File Deletion and Backup Exfiltration via Empty Integration Key
Critical · CVSS 10.0 · EPSS 24th2026-10-01 - CVE-2026-20358
Cisco Crosswork Security Hardening Release: August 2026
Critical · CVSS 10.0 · EPSS 42th2026-08-19 - CVE-2026-50148
Metabase: Remote Code Execution via Snowflake JDBC Driver Arbitrary File Write
Critical · CVSS 10.0 · EPSS 56th2026-07-15 - CVE-2025-71338
Flowise through 2.2.7 - Arbitrary File Write to Remote Code Execution via document-store API
Critical · CVSS 10.0 · EPSS 67th2026-06-25 - CVE-2026-40342
Firebird: Path Traversal + Arbitrary File Write Leads to Remote Code Execution
Critical · CVSS 10.0 · EPSS 53th2026-04-17
Showing 12 of 627 recorded CWE-73 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsCommon consequences
What can happen when CWE-73 is exploited.
Read Files or Directories, Modify Files or Directories
Affects: Integrity, Confidentiality
The application can operate on unexpected files. Confidentiality is violated when the targeted filename is not directly readable by the attacker.
Modify Files or Directories, Execute Unauthorized Code or Commands
Affects: Integrity, Confidentiality, Availability
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.
DoS: Crash, Exit, or Restart, DoS: Resource Consumption (Other)
Affects: Availability
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.
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
Applies to
Operating systems
How to prevent it
Practical mitigations for CWE-73, grouped by where in the lifecycle they apply.
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.
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.
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.
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
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).
Use OS-level permissions and run as a low-privileged user to limit the scope of any successful attack.
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.
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.
How to detect it
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.
Code examples
MITRE examples of the weakness in code.
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).
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.
Illustrative examples
Real CVEs that MITRE cites as examples of this weakness.
- 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.
Terminology & mappings
Mapped taxonomies
- 7 Pernicious Kingdoms: Path Manipulation
- Software Fault Patterns: Path Traversal (SFP16)
Attack patterns
CAPEC attack patterns that exploit this weakness.
- CAPEC-13: Subverting Environment Variable Values
- CAPEC-267: Leverage Alternate Encoding
- CAPEC-64: Using Slashes and URL Encoding Combined to Bypass Validation Logic
- CAPEC-72: URL Encoding
- CAPEC-76: Manipulating Web Input to File System Calls
- CAPEC-78: Using Escaped Slashes in Alternate Encoding
- CAPEC-79: Using Slashes in Alternate Encoding
- CAPEC-80: Using UTF-8 Encoding to Bypass Validation Logic
Frequently asked questions
Common questions about CWE-73.
- 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?
- 627 recorded CVEs are attributed to CWE-73, including CVE-2020-1631, CVE-2026-96656 and CVE-2025-33053. 6 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. 6 CWE-73 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 627 recorded CVEs.
Sources
References
- MITRE CWE definition (CWE-73) (opens in a new tab)
- CWE-73 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.
Track CWE-73 CVEs
Get an alert when a new CWE-73 CVE affects your products, with AI-written analysis and remediation steps.