CAPECattack pattern
CAPEC-252 PHP Local File Inclusion
Medium
Official page ↗
- Abstraction
- Detailed
- Status
- Draft
- Typical severity
- Medium
- CAPEC version
- 3.9
Description
The attacker loads and executes an arbitrary local PHP file on a target machine. The attacker could use this to try to load old versions of PHP files that have known vulnerabilities, to load PHP files that the attacker placed on the local machine during a prior attack, or to otherwise change the functionality of the targeted application in unexpected ways.
Execution flow
1. [Explore] [Survey application] Using a browser or an automated tool, an adversary follows all public links on a web site. They record all the links they find. The adversary is looking for URLs that show PHP file inclusion is used, which can look something like "http://vulnerable-website/file.php?file=index.php".
2. [Experiment] [Attempt variations on input parameters] Once the adversary finds a vulnerable URL that takes file input, they attempt a variety of path traversal techniques to attempt to get the application to display the contents of a local file, or execute a different PHP file already stored locally on the server.
3. [Exploit] [Include desired local file] Once the adversary has determined which techniques of path traversal successfully work with the vulnerable PHP application, they will target a specific local file to include. These can be files such as "/etc/passwd", "/etc/shadow", or configuration files for the application that might expose sensitive information.
Prerequisites
• The targeted PHP application must have a bug that allows an attacker to control which code file is loaded at some juncture.
Related
Child of · CAPEC (1)
- CAPEC-251 Local Code Inclusion attack pattern
Weakness · CWE (1)
- CWE-829 Inclusion of Functionality from Untrusted Control Sphere weakness
Referenced by CWE · attack pattern (1)
- CWE-829 Inclusion of Functionality from Untrusted Control Sphere weakness