CAPECattack pattern
CAPEC-242 Code Injection
High
Official page ↗
- Abstraction
- Meta
- Status
- Stable
- Likelihood of attack
- High
- Typical severity
- High
- CAPEC version
- 3.9
Description
An adversary exploits a weakness in input validation on the target to inject new code into that which is currently executing. This differs from code inclusion in that 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.
Prerequisites
• The target software does not validate user-controlled input such that the execution of a process may be altered by sending code in through legitimate data channels, using no other mechanism.
Consequences
• Confidentiality, Integrity, Availability: Other
Mitigations
• Utilize strict type, character, and encoding enforcement
• Ensure all input content that is delivered to client is sanitized against an acceptable content specification.
• Perform input validation for all content.
• Enforce regular patching of software.
Related
Weakness · CWE (1)
- CWE-94 Improper Control of Generation of Code weakness
Referenced by CAPEC · can follow (1)
- CAPEC-234 Hijacking a privileged process attack pattern
Referenced by CAPEC · child of (5)
- CAPEC-19 Embedding Scripts within Scripts attack pattern
- CAPEC-23 File Content Injection attack pattern
- CAPEC-41 Using Meta-characters in E-mail Headers to Inject Malicious Payloads attack pattern
- CAPEC-468 Generic Cross-Browser Cross-Domain Theft attack pattern
- CAPEC-63 Cross-Site Scripting (XSS) attack pattern
Referenced by CWE · attack pattern (1)
- CWE-94 Improper Control of Generation of Code weakness