CWEweakness
CWE-73 External Control of File Name or Path
High
Official page ↗
- Abstraction
- Base
- Structure
- Simple
- Status
- Draft
- Likelihood of exploit
- High
- Languages
- Not Language-Specific
- CWE version
- 5.0
Description
The product allows user input to control or influence paths or file names that are used in filesystem operations.
Common consequences
• 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] 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.
• [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.
Observed examples
• 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.
Related
Attack pattern · CAPEC (8)
- CAPEC-13 Subverting Environment Variable Values attack pattern
- CAPEC-267 Leverage Alternate Encoding attack pattern
- CAPEC-64 Using Slashes and URL Encoding Combined to Bypass Validation Logic attack pattern
- CAPEC-72 URL Encoding attack pattern
- CAPEC-76 Manipulating Web Input to File System Calls attack pattern
- CAPEC-78 Using Escaped Slashes in Alternate Encoding attack pattern
- CAPEC-79 Using Slashes in Alternate Encoding attack pattern
- CAPEC-80 Using UTF-8 Encoding to Bypass Validation Logic attack pattern
Observed example · CVE (3)
- CVE-2022-45918 ILIAS before 7.16 allows External Control of File Name or Path. vulnerability
- CVE-2008-5764 PHP remote file inclusion vulnerability in calendar.php in WorkSimple 1.2.1, when register_globals is enabled, allows remote attackers to… vulnerability
- CVE-2008-5748 Directory traversal vulnerability in plugins/spaw2/dialogs/dialog.php in BloofoxCMS 0.3.4 allows remote attackers to read arbitrary files… vulnerability
Can precede · CWE (5)
- CWE-22 Improper Limitation of a Pathname to a Restricted Directory weakness
- CWE-41 Improper Resolution of Path Equivalence weakness
- CWE-434 Unrestricted Upload of File with Dangerous Type weakness
- CWE-59 Improper Link Resolution Before File Access weakness
- CWE-98 Improper Control of Filename for Include/Require Statement in PHP Program weakness
Child of · CWE (3)
Referenced by CAPEC · weakness (8)
- CAPEC-13 Subverting Environment Variable Values attack pattern
- CAPEC-267 Leverage Alternate Encoding attack pattern
- CAPEC-64 Using Slashes and URL Encoding Combined to Bypass Validation Logic attack pattern
- CAPEC-72 URL Encoding attack pattern
- CAPEC-76 Manipulating Web Input to File System Calls attack pattern
- CAPEC-78 Using Escaped Slashes in Alternate Encoding attack pattern
- CAPEC-79 Using Slashes in Alternate Encoding attack pattern
- CAPEC-80 Using UTF-8 Encoding to Bypass Validation Logic attack pattern
Referenced by CVE · weakness (737)
- CVE-2026-90871 Improper limitation of a pathname to a restricted directory in Progress Software WS_FTP Server versions prior to 2024.0.7 and 2025.0.4 on… vulnerability
- CVE-2026-116822 YesWiki before 4.7.0 contains a path traversal vulnerability in BazarListeAction that allows unauthenticated attackers to select arbitrary… vulnerability
- CVE-2026-90464 An external control of file path vulnerability in a WatchGuard Fireware OS firewall diagnostic command allows a remote, authenticated… vulnerability
- CVE-2026-93864 A link following vulnerability in WatchGuard Fireware OS’s firewall daemon allows a local attacker with code execution as a low-privileged… vulnerability
- CVE-2026-115931 Postiz lets a signed-in user ask the backend to run a function on one of their connected channels. vulnerability
- CVE-2026-46652 The Goobi viewer is a web application that allows digitised material to be displayed in a web browser. vulnerability
- CVE-2026-57113 PraisonAI is a multi-agent teams system. vulnerability
- CVE-2026-57208 Entire CLI hooks into Git workflows to capture AI agent sessions. vulnerability
- CVE-2026-92709 Rsyslog is a rocket-fast system for log processing. vulnerability
- CVE-2026-114253 A vulnerability was determined in oretnom23 file-management-system-php up to 2e3c1ebe60f121e8df4fb3f544f0e9591d9a01e4. vulnerability
- CVE-2026-114379 A flaw has been found in EKKOLearnAI ekko-studio up to 1.0.6. vulnerability
- CVE-2026-114491 pdfmake 0.3.8 before 0.3.12 fails to apply the setLocalAccessPolicy() restriction to images referenced inside SVG content, allowing… vulnerability
- CVE-2026-86147 External control of file name or path and uncontrolled resource consumption in Apache bRPC (version < 1.18.0) on all platforms allows… vulnerability
- CVE-2026-111935 NoteGen through 0.38.3 contains an external control of file path vulnerability in chat image analysis that allows attackers to read local… vulnerability
- CVE-2026-112310 docling-core 2.5.0 before 2.103.0 contains a local file disclosure vulnerability that allows attackers to read local images by supplying… vulnerability
- CVE-2026-105037 EnergizeLab station-middleware (NestJS) Docker images 1.6.5 through 1.8.2 allow any registered, low-privilege account to read arbitrary… vulnerability
- CVE-2026-111230 Netgate pfSense CE through 2.9.0 contains a local file read vulnerability that allows users with the Dynamic DNS client privilege to read… vulnerability
- CVE-2026-111234 SimplePie through 1.9.0 contains a local file read vulnerability that allows malicious feed servers to read server files by supplying… vulnerability
- CVE-2026-57155 OPNsense is a FreeBSD based firewall and routing platform. vulnerability
- CVE-2026-107594 The File Upload to Order WordPress plugin before 1.1.4 does not validate or confine a file path taken from attacker-controlled session data… vulnerability
- CVE-2026-110385 A remote code execution vulnerability in ONLYOFFICE Document Server versions before10.0.0 allows an authenticated attacker with a valid… vulnerability
- CVE-2026-54703 Markdown Preview Enhanced is a Markdown preview extension for Visual Studio Code. vulnerability
- CVE-2026-92153 F´ (F Prime) is a framework that enables development and deployment of spaceflight and other embedded software applications. vulnerability
- CVE-2026-103928 Metabase is an open source business intelligence and analytics platform. vulnerability
- CVE-2026-106042 An External Control of File Name or Path vulnerability in Ivanti Xtraction before version 2026.4 allows a remote authenticated attacker to… vulnerability
- CVE-2026-69783 External control of file name or path in Windows Update allows an authorized attacker to elevate privileges locally. vulnerability
- CVE-2026-109601 Frappe Framework before 15.117.0 and 16.x before 16.30.0 contains an arbitrary file read vulnerability in the handling of attributes in… vulnerability
- CVE-2026-59976 ConvertX is a self-hosted file conversion service. vulnerability
- CVE-2026-93695 In Progress ShareFile Storage Zones Controller v5.12.6 and below, FileCopyService uses a remote file identifier when constructing a local… vulnerability
- CVE-2026-108694 ConvertX through 0.19.0 contains an arbitrary file read vulnerability that allows authenticated users to read server files because… vulnerability
Referenced by CWE · can also be (1)
- CWE-99 Improper Control of Resource Identifiers weakness
Referenced by CWE · child of (1)
- CWE-114 Process Control weakness