---
title: "CAPEC-251: Local Code Inclusion"
url: https://radicalnotion.ai/capec/capec-251
type: capec
description: "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."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-251: Local Code Inclusion

- **Abstraction:** Standard
- **Status:** Stable
- **Typical severity:** Medium
- **CAPEC catalog version:** 3.9

## Description

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.

## 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

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity | Execute Unauthorized Commands | Through local code inclusion, the adversary compromises the integrity of the application. |
| Confidentiality | Read Data | 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. |

## Mitigations

- Implementation: Avoid passing user input to filesystem or framework API. If necessary to do so, implement a specific, allowlist approach.

## Related weaknesses (CWE)

- [CWE-829](https://radicalnotion.ai/cwe/cwe-829): Inclusion of Functionality from Untrusted Control Sphere

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-175](https://radicalnotion.ai/capec/capec-175) | Code Inclusion |
| Child | [CAPEC-252](https://radicalnotion.ai/capec/capec-252) | PHP Local File Inclusion |
| Child | [CAPEC-640](https://radicalnotion.ai/capec/capec-640) | Inclusion of Code in Existing Process |
| Child | [CAPEC-660](https://radicalnotion.ai/capec/capec-660) | Root/Jailbreak Detection Evasion via Hooking |

## Taxonomy mappings

| Taxonomy | Entry | Id |
| --- | --- | --- |
| ATTACK | Process Injection | 1055 |

## Frequently asked questions

### 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 one CWE weakness: CWE-829 (Inclusion of Functionality from Untrusted Control Sphere).

### How severe is CAPEC-251?

MITRE rates CAPEC-251 as Medium severity.

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/251.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/capec/capec-251). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
