CAPEC-251: Local Code Inclusion
The attacker forces an application to load arbitrary code files from the local machine. The attacker could use this to try to load old versions of library files that have known vulnerabilities, to load 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.
Last updated
Overview
CAPEC-251 (Local Code Inclusion) is a standard-level attack pattern catalogued by MITRE in the Common Attack Pattern Enumeration and Classification (CAPEC). It describes a recurring method attackers use to exploit software weaknesses.
What the attacker needs
Prerequisites
- The targeted application must have a bug that allows an adversary to control which code file is loaded at some juncture.
- Some variants of this attack may require that old versions of some code files be present and in predictable locations.
Resources required
- The adversary needs to have enough access to the target application to control the identity of a locally included file. The attacker may also need to be able to upload arbitrary code files to the target machine, although any location for these files may be acceptable.
Consequences
What a successful CAPEC-251 attack can achieve.
Execute Unauthorized Commands
Affects: Integrity
Through local code inclusion, the adversary compromises the integrity of the application.
Read Data
Affects: Confidentiality
An attacker may leverage local code inclusion in order to print sensitive data to a page, such as hidden configuration files or or password hashes.
How to mitigate it
Defenses that reduce the risk of CAPEC-251.
- Implementation: Avoid passing user input to filesystem or framework API. If necessary to do so, implement a specific, allowlist approach.
Terminology & mappings
Mapped taxonomies
- ATTACK: Process Injection (1055)
Frequently asked questions
Common questions about CAPEC-251.
- What is CAPEC-251?
- The attacker forces an application to load arbitrary code files from the local machine. The attacker could use this to try to load old versions of library files that have known vulnerabilities, to load 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.
- How do you prevent CAPEC-251?
- Implementation: Avoid passing user input to filesystem or framework API. If necessary to do so, implement a specific, allowlist approach.
- What weaknesses does CAPEC-251 target?
- CAPEC-251 exploits 1 CWE weakness, including CWE-829 (Inclusion of Functionality from Untrusted Control Sphere).
- How severe is CAPEC-251?
- MITRE rates CAPEC-251 as Medium severity.
References
Attack-pattern data is sourced from the MITRE CAPEC catalog (v3.9). Weakness associations link to the corresponding CWE entries on RadicalNotion.AI.
Defend against CAPEC-251
Track the CVEs and weaknesses attackers exploit with this technique, with AI-written analysis and remediation guidance.