CWE-94
Allowed-with-ReviewImproper Control of Generation of Code ('Code Injection')
Abstraction: Base · Status: Draft
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
8642 vulnerabilities reference this CWE, most recent first.
GHSA-5M9G-CF78-FHVJ
Vulnerability from github – Published: 2022-05-01 18:18 – Updated: 2022-05-01 18:18Unspecified vulnerability in Microsoft Word 2000 SP3, Word 2002 SP3, and Office 2004 for Mac allows user-assisted remote attackers to execute arbitrary code via a malformed string in a Word file, aka "Word Memory Corruption Vulnerability."
{
"affected": [],
"aliases": [
"CVE-2007-3899"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2007-10-09T22:17:00Z",
"severity": "HIGH"
},
"details": "Unspecified vulnerability in Microsoft Word 2000 SP3, Word 2002 SP3, and Office 2004 for Mac allows user-assisted remote attackers to execute arbitrary code via a malformed string in a Word file, aka \"Word Memory Corruption Vulnerability.\"",
"id": "GHSA-5m9g-cf78-fhvj",
"modified": "2022-05-01T18:18:29Z",
"published": "2022-05-01T18:18:29Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2007-3899"
},
{
"type": "WEB",
"url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2007/ms07-060"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A1879"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/27151"
},
{
"type": "WEB",
"url": "http://securitytracker.com/id?1018790"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/482366/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/25906"
},
{
"type": "WEB",
"url": "http://www.us-cert.gov/cas/techalerts/TA07-282A.html"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2007/3440"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-5M9W-MC2W-2VGJ
Vulnerability from github – Published: 2022-05-02 03:47 – Updated: 2022-05-02 03:47Microsoft Internet Explorer 7 and 8 does not properly handle objects in memory, which allows remote attackers to execute arbitrary code by accessing an object that (1) was not properly initialized or (2) is deleted, leading to memory corruption, aka "Uninitialized Memory Corruption Vulnerability."
{
"affected": [],
"aliases": [
"CVE-2009-3673"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2009-12-09T18:30:00Z",
"severity": "HIGH"
},
"details": "Microsoft Internet Explorer 7 and 8 does not properly handle objects in memory, which allows remote attackers to execute arbitrary code by accessing an object that (1) was not properly initialized or (2) is deleted, leading to memory corruption, aka \"Uninitialized Memory Corruption Vulnerability.\"",
"id": "GHSA-5m9w-mc2w-2vgj",
"modified": "2022-05-02T03:47:37Z",
"published": "2022-05-02T03:47:37Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2009-3673"
},
{
"type": "WEB",
"url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2009/ms09-072"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A6519"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id?1023293"
},
{
"type": "WEB",
"url": "http://www.us-cert.gov/cas/techalerts/TA09-342A.html"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-5MC8-6VFM-JPQX
Vulnerability from github – Published: 2022-05-01 23:36 – Updated: 2022-05-01 23:36Acresso InstallShield Update Agent does not properly verify the authenticity of Rule Scripts obtained from GetRules.asp web pages on FLEXnet Connect servers, which allows remote man-in-the-middle attackers to execute arbitrary VBScript code via Trojan horse Rules.
{
"affected": [],
"aliases": [
"CVE-2008-1093"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-09-18T15:04:00Z",
"severity": "HIGH"
},
"details": "Acresso InstallShield Update Agent does not properly verify the authenticity of Rule Scripts obtained from GetRules.asp web pages on FLEXnet Connect servers, which allows remote man-in-the-middle attackers to execute arbitrary VBScript code via Trojan horse Rules.",
"id": "GHSA-5mc8-6vfm-jpqx",
"modified": "2022-05-01T23:36:30Z",
"published": "2022-05-01T23:36:30Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-1093"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/31896"
},
{
"type": "WEB",
"url": "http://securityreason.com/securityalert/4268"
},
{
"type": "WEB",
"url": "http://www.kb.cert.org/vuls/id/837092"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/496389/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/31204"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id?1020893"
},
{
"type": "WEB",
"url": "http://www.simplicity.net/vuln/CVE-2008-1093.txt"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2008/2613"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-5MGH-9648-5W74
Vulnerability from github – Published: 2022-05-02 06:15 – Updated: 2022-05-02 06:15Microsoft Internet Explorer 7 does not properly handle objects in memory, which allows remote attackers to execute arbitrary code by accessing a deleted object, leading to memory corruption, aka "HTML Rendering Memory Corruption Vulnerability."
{
"affected": [],
"aliases": [
"CVE-2010-0807"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-03-31T19:30:00Z",
"severity": "HIGH"
},
"details": "Microsoft Internet Explorer 7 does not properly handle objects in memory, which allows remote attackers to execute arbitrary code by accessing a deleted object, leading to memory corruption, aka \"HTML Rendering Memory Corruption Vulnerability.\"",
"id": "GHSA-5mgh-9648-5w74",
"modified": "2022-05-02T06:15:38Z",
"published": "2022-05-02T06:15:38Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-0807"
},
{
"type": "WEB",
"url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2010/ms10-018"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A8532"
},
{
"type": "WEB",
"url": "http://securitytracker.com/id?1023773"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/39024"
},
{
"type": "WEB",
"url": "http://www.us-cert.gov/cas/techalerts/TA10-068A.html"
},
{
"type": "WEB",
"url": "http://www.us-cert.gov/cas/techalerts/TA10-089A.html"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2010/0744"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-5MH9-R3RR-9597
Vulnerability from github – Published: 2020-05-21 21:08 – Updated: 2024-10-15 23:33HtmlUnit prior to 2.37.0 contains code execution vulnerabilities. HtmlUnit initializes Rhino engine improperly, hence a malicious JavScript code can execute arbitrary Java code on the application. Moreover, when embedded in Android application, Android-specific initialization of Rhino engine is done in an improper way, hence a malicious JavaScript code can execute arbitrary Java code on the application.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "net.sourceforge.htmlunit:htmlunit"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.37.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2020-5529"
],
"database_specific": {
"cwe_ids": [
"CWE-665",
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2020-05-21T17:25:38Z",
"nvd_published_at": "2020-02-11T12:15:00Z",
"severity": "HIGH"
},
"details": "HtmlUnit prior to 2.37.0 contains code execution vulnerabilities. HtmlUnit initializes Rhino engine improperly, hence a malicious JavScript code can execute arbitrary Java code on the application. Moreover, when embedded in Android application, Android-specific initialization of Rhino engine is done in an improper way, hence a malicious JavaScript code can execute arbitrary Java code on the application. ",
"id": "GHSA-5mh9-r3rr-9597",
"modified": "2024-10-15T23:33:01Z",
"published": "2020-05-21T21:08:33Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-5529"
},
{
"type": "WEB",
"url": "https://github.com/HtmlUnit/htmlunit/commit/bc1f58d483cc8854a9c4c1739abd5e04a2eb0367"
},
{
"type": "PACKAGE",
"url": "https://github.com/HtmlUnit/htmlunit"
},
{
"type": "WEB",
"url": "https://github.com/HtmlUnit/htmlunit/releases/tag/2.37.0"
},
{
"type": "WEB",
"url": "https://jvn.jp/en/jp/JVN34535327"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread.html/ra2cd7f8e61dc6b8a2d9065094cd1f46aa63ad10f237ee363e26e8563%40%3Ccommits.camel.apache.org%3E"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread.html/ra2cd7f8e61dc6b8a2d9065094cd1f46aa63ad10f237ee363e26e8563@%3Ccommits.camel.apache.org%3E"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2020/08/msg00023.html"
},
{
"type": "WEB",
"url": "https://usn.ubuntu.com/4584-1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Code execution vulnerability in HtmlUnit"
}
GHSA-5MPR-Q32P-2H8G
Vulnerability from github – Published: 2022-05-01 17:49 – Updated: 2022-05-01 17:49PHP remote file inclusion vulnerability in _admin/nav.php in AT Contenator 1.0 and earlier allows remote attackers to execute arbitrary PHP code via a URL in the Root_To_Script parameter.
{
"affected": [],
"aliases": [
"CVE-2007-0983"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2007-02-16T11:28:00Z",
"severity": "MODERATE"
},
"details": "PHP remote file inclusion vulnerability in _admin/nav.php in AT Contenator 1.0 and earlier allows remote attackers to execute arbitrary PHP code via a URL in the Root_To_Script parameter.",
"id": "GHSA-5mpr-q32p-2h8g",
"modified": "2022-05-01T17:49:12Z",
"published": "2022-05-01T17:49:12Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2007-0983"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/32453"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/3297"
},
{
"type": "WEB",
"url": "http://attrition.org/pipermail/vim/2007-February/001312.html"
},
{
"type": "WEB",
"url": "http://osvdb.org/33209"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/24141"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2007/0606"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-5MR6-HRM2-P724
Vulnerability from github – Published: 2021-11-23 00:00 – Updated: 2022-05-11 00:02The affected controllers do not properly sanitize the input containing code syntax. As a result, an attacker could craft code to alter the intended controller flow of the software.
{
"affected": [],
"aliases": [
"CVE-2021-38448"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-11-22T19:15:00Z",
"severity": "HIGH"
},
"details": "The affected controllers do not properly sanitize the input containing code syntax. As a result, an attacker could craft code to alter the intended controller flow of the software.",
"id": "GHSA-5mr6-hrm2-p724",
"modified": "2022-05-11T00:02:21Z",
"published": "2021-11-23T00:00:50Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-38448"
},
{
"type": "WEB",
"url": "https://us-cert.cisa.gov/ics/advisories/icsa-21-266-01"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-5MV2-RX3Q-4W2V
Vulnerability from github – Published: 2022-02-10 22:21 – Updated: 2022-02-11 19:16Description
When in a sandbox mode, the arrow parameter of the sort filter must be a closure to avoid attackers being able to run arbitrary PHP functions.
Resolution
We now disallow calling non Closure in the sort filter like we already did for some other filters.
Credits
We would like to thank Marlon Starkloff for reporting the issue and Fabien Potencier for fixing the issue.
{
"affected": [
{
"package": {
"ecosystem": "Packagist",
"name": "twig/twig"
},
"ranges": [
{
"events": [
{
"introduced": "2.0.0"
},
{
"fixed": "2.14.11"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Packagist",
"name": "twig/twig"
},
"ranges": [
{
"events": [
{
"introduced": "3.0.0"
},
{
"fixed": "3.3.8"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2022-23614"
],
"database_specific": {
"cwe_ids": [
"CWE-74",
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2022-02-07T16:43:09Z",
"nvd_published_at": "2022-02-04T23:15:00Z",
"severity": "HIGH"
},
"details": "# Description\n\nWhen in a sandbox mode, the `arrow` parameter of the `sort` filter must be a closure to avoid attackers being able to run arbitrary PHP functions.\n\n# Resolution\n\nWe now disallow calling non Closure in the `sort` filter like we already did for some other filters.\n\n# Credits\n\nWe would like to thank Marlon Starkloff for reporting the issue and Fabien Potencier for fixing the issue.\n ",
"id": "GHSA-5mv2-rx3q-4w2v",
"modified": "2022-02-11T19:16:32Z",
"published": "2022-02-10T22:21:48Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/twigphp/Twig/security/advisories/GHSA-5mv2-rx3q-4w2v"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-23614"
},
{
"type": "WEB",
"url": "https://github.com/twigphp/Twig/commit/22b9dc3c03ee66d7e21d9ed2ca76052b134cb9e9"
},
{
"type": "WEB",
"url": "https://github.com/twigphp/Twig/commit/2eb33080558611201b55079d07ac88f207b466d5"
},
{
"type": "WEB",
"url": "https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2022-23614.yaml"
},
{
"type": "WEB",
"url": "https://github.com/twigphp/Twig"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/I2PVV5DUTRUECTIHMTWRI5Z7DVNYQ2YO"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OTN4273U4RHVIXED64T7DSMJ3VYTPRE7"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PECHIY2XLWUH2WLCNPDGNFMPHPRPCEDZ"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SIGZCFSYLPP7UVJ4E4NLHSOQSKYNXSAD"
},
{
"type": "WEB",
"url": "https://symfony.com/blog/twig-security-release-disallow-non-closures-in-the-sort-filter"
},
{
"type": "WEB",
"url": "https://www.debian.org/security/2022/dsa-5107"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Code injection in Twig"
}
GHSA-5MVG-7MQQ-MFX7
Vulnerability from github – Published: 2022-05-14 02:42 – Updated: 2025-04-11 03:39Multiple stack-based buffer overflows in FastBackServer.exe in the Server in IBM Tivoli Storage Manager (TSM) FastBack 5.5.0.0 through 5.5.6.0 and 6.1.0.0 through 6.1.0.1 allow remote attackers to execute arbitrary code via vectors involving the (1) AGI_SendToLog (aka _SendToLog) function; the (2) group, (3) workgroup, or (4) domain name field to the USER_S_AddADGroup function; the (5) user_path variable to the FXCLI_checkIndexDBLocation function; or (6) the _AGI_S_ActivateLTScriptReply (aka ActivateLTScriptReply) function. NOTE: this might overlap CVE-2010-3059.
{
"affected": [],
"aliases": [
"CVE-2010-3758"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-10-05T22:00:00Z",
"severity": "HIGH"
},
"details": "Multiple stack-based buffer overflows in FastBackServer.exe in the Server in IBM Tivoli Storage Manager (TSM) FastBack 5.5.0.0 through 5.5.6.0 and 6.1.0.0 through 6.1.0.1 allow remote attackers to execute arbitrary code via vectors involving the (1) AGI_SendToLog (aka _SendToLog) function; the (2) group, (3) workgroup, or (4) domain name field to the USER_S_AddADGroup function; the (5) user_path variable to the FXCLI_checkIndexDBLocation function; or (6) the _AGI_S_ActivateLTScriptReply (aka ActivateLTScriptReply) function. NOTE: this might overlap CVE-2010-3059.",
"id": "GHSA-5mvg-7mqq-mfx7",
"modified": "2025-04-11T03:39:33Z",
"published": "2022-05-14T02:42:52Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-3758"
},
{
"type": "WEB",
"url": "http://www-01.ibm.com/support/docview.wss?uid=swg1IC69883"
},
{
"type": "WEB",
"url": "http://www.ibm.com/support/docview.wss?uid=swg21443820"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/514059/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/514067/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/514072/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/514078/100/0/threaded"
},
{
"type": "WEB",
"url": "http://zerodayinitiative.com/advisories/ZDI-10-180"
},
{
"type": "WEB",
"url": "http://zerodayinitiative.com/advisories/ZDI-10-181"
},
{
"type": "WEB",
"url": "http://zerodayinitiative.com/advisories/ZDI-10-183"
},
{
"type": "WEB",
"url": "http://zerodayinitiative.com/advisories/ZDI-10-184"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-5MXV-J9VC-66X9
Vulnerability from github – Published: 2025-02-20 18:31 – Updated: 2025-11-04 21:31PHPJabbers Shared Asset Booking System v1.0 is vulnerable to CSV Injection vulnerability which allows an attacker to execute remote code. The vulnerability exists due to insufficient input validation on Languages section Labels any parameters field in System Options that is used to construct CSV file.
{
"affected": [],
"aliases": [
"CVE-2023-51324"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-02-20T16:15:35Z",
"severity": "MODERATE"
},
"details": "PHPJabbers Shared Asset Booking System v1.0 is vulnerable to CSV Injection vulnerability which allows an attacker to execute remote code. The vulnerability exists due to insufficient input validation on Languages section Labels any parameters field in System Options that is used to construct CSV file.",
"id": "GHSA-5mxv-j9vc-66x9",
"modified": "2025-11-04T21:31:30Z",
"published": "2025-02-20T18:31:23Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-51324"
},
{
"type": "WEB",
"url": "https://packetstorm.news/files/id/176504"
},
{
"type": "WEB",
"url": "https://www.phpjabbers.com/shared-asset-booking-system/#sectionDemo"
},
{
"type": "WEB",
"url": "http://packetstormsecurity.com/files/176504/PHPJabbers-Shared-Asset-Booking-System-1.0-CSV-Injection.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
Mitigation
Strategy: Refactoring
Refactor your program so that you do not have to dynamically generate code.
Mitigation
- Run your code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which code can be executed by your product.
- Examples include the Unix chroot jail and AppArmor. In general, managed code may provide some protection.
- This may not be a feasible solution, and it only limits the impact to the operating system; the rest of your application may still be subject to compromise.
- Be careful to avoid CWE-243 and other weaknesses related to jails.
Mitigation MIT-5
Strategy: Input Validation
- Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
- When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
- Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- To reduce the likelihood of code injection, use stringent allowlists that limit which constructs are allowed. If you are dynamically constructing code that invokes a function, then verifying that the input is alphanumeric might be insufficient. An attacker might still be able to reference a dangerous function that you did not intend to allow, such as system(), exec(), or exit().
Mitigation
Use dynamic tools and techniques that interact with the product using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The product's operation may slow down, but it should not become unstable, crash, or generate incorrect results.
Mitigation MIT-32
Strategy: Compilation or Build Hardening
Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).
Mitigation MIT-32
Strategy: Environment Hardening
Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).
Mitigation
For Python programs, it is frequently encouraged to use the ast.literal_eval() function instead of eval, since it is intentionally designed to avoid executing code. However, an adversary could still cause excessive memory or stack consumption via deeply nested structures [REF-1372], so the python documentation discourages use of ast.literal_eval() on untrusted data [REF-1373].
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.
CAPEC-35: Leverage Executable Code in Non-Executable Files
An attack of this type exploits a system's trust in configuration and resource files. When the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high.
CAPEC-77: Manipulating User-Controlled Variables
This attack targets user controlled variables (DEBUG=1, PHP Globals, and So Forth). An adversary can override variables leveraging user-supplied, untrusted query variables directly used on the application server without any data sanitization. In extreme cases, the adversary can change variables controlling the business logic of the application. For instance, in languages like PHP, a number of poorly set default configurations may allow the user to override variables.