CWE-73: External Control of File Name or Path

BaseDraftExploit Likelihood: High

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

View on MITRE
Back to CWE Lookup

Extended Description

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.

Technical Details

Structure
Simple
Vulnerability Mapping
ALLOWED

Applicable To

Languages
Not Language-Specific
Platforms
UnixWindowsmacOS

Source-backed guidance

Additional facts reviewed against primary or authoritative security sources.

Verify controls for CWE-73 with SSDF evidence

Use NIST SSDF verification and vulnerability-response practices to detect CWE-73, External Control of File Name or Path, throughout the product lifecycle. Derive review questions, static or dynamic checks, and negative tests from the CWE's causal behavior; define the components and lifecycle stages each check covers; and retain findings with enough evidence to distinguish the root cause from symptoms and impacts. Track escapes and false negatives, then improve the verification plan after every confirmed occurrence.

NIST SP 800-218 Secure Software Development FrameworkNational Institute of Standards and Technology

Apply Input Validation controls for External Control of File Name or Path

MITRE associates mitigation with Architecture and Design, Operation, Implementation, Installation, and Testing; the listed strategies include Input Validation; documented detection approaches include Automated Static Analysis. Use these source-defined anchors to turn CWE-73 into implementation, review, and verification checks for the affected component.

CWE-73: External Control of File Name or PathMITRE CWE

Triage CWE-73 against known exploitation evidence

Use CISA's Known Exploited Vulnerabilities catalog to test whether a vulnerability mapped to CWE-73, External Control of File Name or Path, has evidence of exploitation in the wild. Confirm the CVE-to-CWE root-cause mapping independently before attaching the example, then capture the affected product, required action, and remediation deadline. A missing KEV match is not evidence that the weakness is unexploited, and a KEV entry must not be generalized to every occurrence of this CWE.

Known Exploited Vulnerabilities CatalogCybersecurity and Infrastructure Security Agency

Apply precise root-cause mapping to CWE-73

Apply MITRE's full root-cause mapping guidance when using CWE-73, External Control of File Name or Path. Separate weakness language from attacker prerequisites and technical impact, check the entry's abstraction and vulnerability-mapping notes, and prefer the most specific Base or Variant supported by the evidence. Record the rejected alternatives and require an independent review before the mapping is used for remediation trends or program metrics.

CVE to CWE Root Cause Mapping GuidanceMITRE CWE

Validate CWE-73 with root-cause mapping checks

Apply MITRE's root-cause mapping quick tips to CWE-73, External Control of File Name or Path. Confirm the finding describes the causal weakness rather than an impact or attack pattern, compare the abstraction and mapping notes with plausible alternatives, and have a second reviewer challenge the selection. Preserve the evidence and reasoning so recurring defects can be measured against one consistent identifier.

CVE to CWE Root Cause Mapping Quick TipsMITRE CWE

Frequently Asked Questions

What is CWE-73: External Control of File Name or Path?+

CWE-73: External Control of File Name or Path is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product allows user input to control or influence paths or file names that are used in filesystem operations. 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.

What are the security consequences of External Control of File Name or Path?+

If exploited, CWE-73 (External Control of File Name or Path) it can compromise Integrity, Confidentiality and Availability, leading to outcomes such as Read Files or Directories, Modify Files or Directories, Execute Unauthorized Code or Commands, DoS: Crash, Exit, or Restart and DoS: Resource Consumption (Other).

How do you prevent or mitigate External Control of File Name or Path?+

Recommended mitigations for CWE-73 include: 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.

How is External Control of File Name or Path detected?+

CWE-73 can be detected using Automated Static Analysis. Combining automated tooling with manual review typically yields the best coverage.

Which programming languages are affected by External Control of File Name or Path?+

CWE-73 commonly affects Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of External Control of File Name or Path?+

MITRE documents real CVEs mapped to CWE-73, including CVE-2022-45918, CVE-2008-5748 and CVE-2008-5764. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-73 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More

Advertisement