cve.bz

CAPEC-242

Code Injection

High severityHigh likelihoodMeta pattern

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.

On this page

Ask an AI about this attack pattern

Show the promptExplain the attack pattern CAPEC-242: Code Injection: how it unfolds, what it needs and how to prevent and detect it in my systems. Use https://capec.mitre.org/data/definitions/242.html and https://cve.bz/cve/capec/242?via=ask-ai-copy, which lists recent CVEs with the weaknesses it exploits. Cite the sources.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this attack pattern's id and public links.

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

What a successful attack can lead to
ImpactAffectsNote
OtherConfidentiality, Integrity, AvailabilityCode Injection attack patterns can result in a wide variety of consequences and negatively affect all three elements of the security triad.

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.

Weaknesses it exploits

  • CWE-94 Improper Control of Generation of Code

Recent CVEs with these weaknesses

  1. 8.6CVE-2026-109097

    A vulnerability has been identified in ROS# (All versions < V2.3.1). Affected systems do not properly escape text of message definition files. This could allow an attacker that is able to pass a crafted message definition file to the user …

  2. 2.0CVE-2026-125082

    A security flaw has been discovered in sunkaifei FlyCMS up to e71738e0cfb7ffd48c2ce74242a2dbb43f84f25a. Affected by this vulnerability is the function ModelDataService.insertData of the file articles/detail.html of the component Content Re…

  3. 7.2CVE-2026-120009

    SAP ABAP Developer Tools (AMDP Data Preview) does not perform sufficient validation and authorization checks within certain affected functionality. An attacker with high privileges could submit specially crafted input to inject and execute…

  4. 9.9CVE-2026-109803

    SAP NetWeaver Knowledge Management (XML Forms) does not sufficiently restrict the selection of XSL transformations processed by the affected functionality. Under certain conditions, an authenticated user with access to the affected functio…

  5. 9.9CVE-2026-109795

    SAP NetWeaver does not perform necessary authorization checks and lacks sufficient input validation in certain remote-enabled functionality. An attacker with low privileges could send specially crafted input through a remote interface to i…

  6. 10.0CVE-2026-115252

    The Confection WordPress Cable WordPress plugin from 0.4.0 to 0.4.7 does not perform any capability or nonce checks before saving its settings and writing one of them, unmodified, into a standalone PHP file that it then serves, allowing un…

  7. 2.1CVE-2026-124588

    A security flaw has been discovered in huggingface finetrainers 0.1.0/0.2.0. The impacted element is the function resolve_component_cls of the file finetrainers/utils/model.py of the component Model Index Handler. Performing a manipulation…

  8. 1.9CVE-2026-124570

    A vulnerability was detected in SourceCodester Online Leave Management System 1.0. Affected is an unknown function of the file app/classes/Master.php of the component Employee Avatar Upload Extension. Performing a manipulation of the argum…

The newest records naming one of them. Each weakness's page lists them all.

More specific patterns
  • CAPEC-19 Embedding Scripts within Scripts
  • CAPEC-23 File Content Injection
  • CAPEC-41 Using Meta-characters in E-mail Headers to Inject Malicious Payloads
  • CAPEC-63 Cross-Site Scripting (XSS)
  • CAPEC-468 Generic Cross-Browser Cross-Domain Theft

MITRE's words, unchanged: CAPEC-242 at MITRE. CAPEC is Copyright © 2007–2026, The MITRE Corporation, used under the CAPEC terms of use: “The MITRE Corporation (MITRE) hereby grants you a non-exclusive, royalty-free license to use Common Attack Pattern Enumeration and Classification (CAPEC™) for research, development, and commercial purposes. Any copy you make for such purposes is authorized provided that you reproduce MITRE’s copyright designation and this license in any such copy.” CAPEC and the CAPEC logo are trademarks of The MITRE Corporation. Credits. All attack patterns.