CAPEC-251 Local Code Inclusion

CAPEC ID: 251

CAPEC-251 Metadata

Likelihood of Attack

High

Typical Severity

Medium

Overview

Summary

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.

Potential Solutions / 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 ID Description
CWE-829 Inclusion of Functionality from Untrusted Control Sphere

Related CAPECs

CAPEC ID Description
CAPEC-175 An adversary exploits a weakness on the target to force arbitrary code to be retrieved locally or from a remote location and executed. This differs from code injection in that code injection involves the direct inclusion of code while code inclusion involves the addition or replacement of a reference to a code file, which is subsequently loaded by the target and used as part of the code of some application.

Taxonomy Mappings

Taxonomy: ATTACK

Entry ID Entry Name
1055 Process Injection

Stay Ahead of Attack Patterns

Understanding CAPEC patterns helps security professionals anticipate and thwart potential attacks. Leverage these insights to enhance threat modeling, strengthen your software development lifecycle, and train your security teams effectively.