logo
Home/CWEs/CWE-98/

CWE-98 - Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion')

  • Abstraction:Variant
  • Structure:Simple
  • Status:Draft
  • Release Date:2006-07-19
  • Latest Modification Date:2023-06-29

Weakness Name

Improper 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

Scope: Integrity, Confidentiality, Availability

Impact: Execute Unauthorized Code or Commands

Notes: The 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 force the code to execute since php ignores everything in the file except for the content between php specifiers.

Related Weaknesses

CWE-94Improper Control of Generation of Code ('Code Injection')Medium

CWE-426Untrusted Search PathHigh

CWE-706Use of Incorrectly-Resolved Name or Reference

CWE-829Inclusion of Functionality from Untrusted Control Sphere

Related Alerts

Remote File InclusionHigh