CWE-73 / WEAKNESS
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.
- Category
- CWE weaknesses
- Version / scope
- CWE 5.0; release 2026-10-28; publisher status Draft
- Affected / relevant technologies
- Not Language-Specific
- Evidence
- Documentation: pinned-source excerpt checked. Execution: not tested. Editorial: curated reference.
Defensive analysis and explicitly authorized assessment only. This website performs no scans, exploitation, model calls or infrastructure changes. Indicators below are investigation opportunities, not proof of compromise or guaranteed detectors.
Mechanism and prerequisites
Review publisher context and local applicability; this reference is not execution evidence.
Potential impact
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.
Versioned source scope
This record contains normalized, sometimes shortened source excerpts with editorial safety context. Markup and executable example blocks are omitted. Source-field verification does not establish device testing, a working detector or local applicability.
Publisher: MITRE. Release: CWE 5.0. Source checked: 2026-11-26.
Source object: CWE-73. Object modified: 2026-10-28.
Attribution and source terms (© The MITRE Corporation; reproduced with permission)Detection and investigation
- 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.
Preserve source timestamps, asset identity and collection context. Correlate independent evidence before attributing malicious intent. In OT, review passive evidence with the process owner; do not induce failures, replay commands or write to controllers to test a hypothesis.
Mitigation and response
- 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 […]
Apply changes through the asset owner's approved change and recovery process. Documentation review is separate from successful testing or verified production protection.
Related technical context
No protocol-specific mapping is asserted for this entry.
Publisher weakness and attack-pattern relationships
These relationships retain the publisher's source attributes and view context; they do not establish that an attack or weakness applies to a particular system.
- CAPEC-13 → Related_Weakness → CWE-73 Open related reference
- CAPEC-267 → Related_Weakness → CWE-73 Open related reference
- CAPEC-64 → Related_Weakness → CWE-73 Open related reference
- CAPEC-72 → Related_Weakness → CWE-73 Open related reference
- CAPEC-76 → Related_Weakness → CWE-73 Open related reference
- CAPEC-78 → Related_Weakness → CWE-73 Open related reference
- CAPEC-79 → Related_Weakness → CWE-73 Open related reference
- CAPEC-80 → Related_Weakness → CWE-73 Open related reference
- CWE-114 → ChildOf → CWE-73 Open related reference
- CWE-73 → Related_Attack_Pattern → CAPEC-13 Open related reference
- CWE-73 → Related_Attack_Pattern → CAPEC-267 Open related reference
- CWE-73 → Related_Attack_Pattern → CAPEC-64 Open related reference
- CWE-73 → Related_Attack_Pattern → CAPEC-72 Open related reference
- CWE-73 → Related_Attack_Pattern → CAPEC-76 Open related reference
- CWE-73 → Related_Attack_Pattern → CAPEC-78 Open related reference
- CWE-73 → Related_Attack_Pattern → CAPEC-79 Open related reference
- CWE-73 → Related_Attack_Pattern → CAPEC-80 Open related reference
- CWE-73 → ChildOf → CWE-20 Open related reference
- CWE-73 → CanPrecede → CWE-22 Open related reference
- CWE-73 → CanPrecede → CWE-41 Open related reference
- CWE-73 → CanPrecede → CWE-434 Open related reference
- CWE-73 → CanPrecede → CWE-59 Open related reference
- CWE-73 → ChildOf → CWE-610 Open related reference
- CWE-73 → ChildOf → CWE-642 Open related reference
- CWE-73 → CanPrecede → CWE-98 Open related reference
- CWE-99 → CanAlsoBe → CWE-73 Open related reference
Authoritative sources and attribution
Identifiers and source titles belong to OWASP, MITRE, the CVE Program, CISA, NIST or the cited vendor. Source excerpts are attributed and adapted under the linked publisher license; editorial context is separate. This is not an official framework mirror. Review baseline: 2026-11-18. Live documents can change; check exact current applicability.
- https://cwe.mitre.org/data/definitions/73.html — Publisher link; not separately HTTP-checked
- MITRE CWE 5.0 source snapshot — source accessed 2026-11-26
Source review supports bounded reference text. It is not execution evidence, a completeness claim, a CVSS assessment, a compliance certification or verification of production security.
