CWE•Base•Draft•20 recent CVEs
CWE-73External Control of File Name or Path
Description
The product allows user input to control or influence paths or file names that are used in filesystem operations.
[object Object]
Common consequences
- Integrity,Confidentiality→Read Files or Directories,Modify Files or DirectoriesThe application can operate on unexpected 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 CommandsThe 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 fil
Potential mitigations
- Architecture and DesignWhen 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[object Object]
- Architecture and DesignFor 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[object Object]
- ImplementationUse 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,OperationUse OS-level permissions and run as a low-privileged user to limit the scope of any successful attack.
- Operation,ImplementationIf 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.
- TestingUse 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.
Related CWEs
CWE-642External Control of Critical State DataCWE-610Externally Controlled Reference to a Resource in Another SphereCWE-20Improper Input ValidationCWE-22Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')CWE-41Improper Resolution of Path EquivalenceCWE-98Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion')CWE-434Unrestricted Upload of File with Dangerous TypeCWE-59Improper Link Resolution Before File Access ('Link Following')
Recent CVEs classified under this CWE
CVE-2025-126563.82026-06-06CVE-2026-463976.52026-06-05CVE-2026-463992026-06-05CVE-2026-406052026-06-04CVE-2026-201756.12026-06-03CVE-2026-350808.12026-06-03CVE-2026-350798.12026-06-03CVE-2026-350788.12026-06-03CVE-2026-350778.12026-06-03CVE-2026-350768.12026-06-03CVE-2026-106947.32026-06-03CVE-2026-414124.92026-06-02CVE-2026-105596.32026-06-02CVE-2026-105586.32026-06-02CVE-2026-95599.92026-05-29CVE-2026-464028.12026-05-27CVE-2026-450898.22026-05-27CVE-2026-450887.52026-05-27CVE-2026-489208.82026-05-27CVE-2025-08986.52026-05-27