CAPEC-242
Code Injection
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 prompt
Explain 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
| Impact | Affects | Note |
|---|---|---|
| Other | Confidentiality, Integrity, Availability | Code 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
- 2.0CVE-2026-140057
A vulnerability was detected in yangzongzhuan RuoYi up to 4.8.3. The impacted element is an unknown function of the file ruoyi-admin/src/main/resources/templates/system/menu/menu.html of the component Menu Management. The manipulation of t…
- 2.0CVE-2026-140056
A security vulnerability has been detected in yangzongzhuan RuoYi up to 4.8.3. The affected element is the function menuItem of the file ruoyi-admin/src/main/resources/static/ruoyi/index.js of the component Menu Management Sidebar Tab Rend…
- 2.1CVE-2026-139858
A flaw has been found in Dromara Jpom up to 2.11.14. The impacted element is the function toIndex of the file IndexControl.java of the component Server Index Controller. This manipulation causes cross site scripting. Remote exploitation of…
- 2.1CVE-2026-139857
A vulnerability was detected in Dromara Jpom up to 2.11.14. The affected element is the function toIndex of the file modules/server/src/main/java/org/dromara/jpom/controller/IndexControl.java of the component Web Console. The manipulation …
- 2.0CVE-2026-138668
A vulnerability has been found in youseries UReport up to 2.2.9. This affects the function buildTable of the file ureport2-core/src/main/java/com/bstek/ureport/export/html/HtmlProducer.java of the component ureport2-core. The manipulation …
- 5.5CVE-2026-138438
A weakness has been identified in RackTables up to 0.22.0. This vulnerability affects the function init_config of the file wwwroot/inc/install.php of the component Installer. This manipulation of the argument mysql_username causes code inj…
- 2.1CVE-2026-138435
A vulnerability was determined in Kingsoft WPS Meeting 2.4.0. Affected by this vulnerability is the function parsingUrl of the file chunk-common.js of the component Kmeeting Url-Scheme Deep-Link Handler. Executing a manipulation of the arg…
- 2.0CVE-2026-138428
A security flaw has been discovered in SourceCodester Real Estate Property Listing App 1.0. This issue affects some unknown processing of the file /index.php. Performing a manipulation of the argument property['title'] results in cross sit…
The newest records naming one of them. Each weakness's page lists them all.
Related attack patterns
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.