CWE•Variant•Draft•20 recent CVEs
CWE-98Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion')
Description
The PHP application receives input from an upstream component, but it does not restrict or incorrectly restricts the input before its usage in "require," "include," or similar functions.
In certain versions and configurations of PHP, this can allow an attacker to specify a URL to a remote location from which the product will obtain the code to execute. In other cases in association with path traversal, the attacker can specify a local file that may contain executable statements that can be parsed by PHP.
Common consequences
- Integrity,Confidentiality,Availability→Execute Unauthorized Code or CommandsThe attacker may be able to specify arbitrary code to be executed from a remote location. Alternatively, it may be possible to use normal program behavior to insert php code into files on the local machine which can then be included and for
Potential mitigations
- Architecture and DesignUse a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].
- Architecture and Design[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.
- Architecture and Design,Operation[object Object]
- Architecture and Design,OperationRun your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database ad
- Implementation[object Object]
- Architecture and Design,Operation[object Object]
- Architecture and Design,Implementation[object Object]
- OperationUse an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].
- Operation,ImplementationDevelop and run your code in the most recent versions of PHP available, preferably PHP 6 or later. Many of the highly risky features in earlier PHP interpreters have been removed, restricted, or disabled by default.
Related CWEs
Recent CVEs classified under this CWE
CVE-2026-395538.12026-06-02CVE-2026-395528.12026-06-02CVE-2025-693698.12026-06-02CVE-2025-688868.12026-06-02CVE-2025-588978.12026-06-02CVE-2025-587078.12026-06-02CVE-2025-587058.12026-06-02CVE-2025-580247.52026-06-02CVE-2025-534408.12026-06-02CVE-2026-442398.82026-05-29CVE-2026-95599.92026-05-29CVE-2026-372668.02026-05-28CVE-2026-489727.52026-05-27CVE-2026-92007.52026-05-27CVE-2026-481337.52026-05-26CVE-2026-396617.52026-05-26CVE-2026-81347.22026-05-21CVE-2026-398507.42026-05-20CVE-2026-75228.82026-05-20CVE-2018-253297.52026-05-17