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.
8353 vulnerabilities reference this CWE, most recent first.
GHSA-3R28-RGP9-QGV4
Vulnerability from github – Published: 2023-08-29 00:32 – Updated: 2023-08-31 14:59An issue in pf4j pf4j v.3.9.0 and before allows a remote attacker to obtain sensitive information and execute arbitrary code via the zippluginPath parameter.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "org.pf4j:pf4j"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "3.9.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2023-40826"
],
"database_specific": {
"cwe_ids": [
"CWE-22",
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2023-08-29T17:41:26Z",
"nvd_published_at": "2023-08-28T22:15:09Z",
"severity": "HIGH"
},
"details": "An issue in pf4j pf4j v.3.9.0 and before allows a remote attacker to obtain sensitive information and execute arbitrary code via the zippluginPath parameter.",
"id": "GHSA-3r28-rgp9-qgv4",
"modified": "2023-08-31T14:59:24Z",
"published": "2023-08-29T00:32:04Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-40826"
},
{
"type": "WEB",
"url": "https://github.com/pf4j/pf4j/issues/536"
},
{
"type": "PACKAGE",
"url": "https://github.com/pf4j/pf4j"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
],
"summary": "pf4j vulnerable to remote code execution via the zippluginPath parameter"
}
GHSA-3R32-CP7V-5WQ4
Vulnerability from github – Published: 2023-08-29 00:32 – Updated: 2024-10-02 18:37An issue in ansible semaphore v.2.8.90 allows a remote attacker to execute arbitrary code via a crafted payload to the extra variables parameter.
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/ansible-semaphore/semaphore"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "2.8.90"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2023-39059"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2023-08-30T20:43:00Z",
"nvd_published_at": "2023-08-28T22:15:08Z",
"severity": "HIGH"
},
"details": "An issue in ansible semaphore v.2.8.90 allows a remote attacker to execute arbitrary code via a crafted payload to the extra variables parameter.",
"id": "GHSA-3r32-cp7v-5wq4",
"modified": "2024-10-02T18:37:59Z",
"published": "2023-08-29T00:32:03Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-39059"
},
{
"type": "WEB",
"url": "https://gist.github.com/Alevsk/1757da24c5fb8db735d392fd4146ca3a"
},
{
"type": "PACKAGE",
"url": "https://github.com/ansible-semaphore/semaphore"
},
{
"type": "WEB",
"url": "https://www.alevsk.com/2023/07/a-quick-story-of-security-pitfalls-with-execcommand-in-software-integrations"
}
],
"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"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Code injection in ansible semaphore"
}
GHSA-3R37-P8J6-6WP6
Vulnerability from github – Published: 2023-05-02 21:31 – Updated: 2024-04-04 03:46European Chemicals Agency IUCLID before 6.27.6 allows remote authenticated users to execute arbitrary code via Server Side Template Injection (SSTI) with a crafted template file. The attacker must have template manager permission.
{
"affected": [],
"aliases": [
"CVE-2023-26546"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-05-02T20:15:10Z",
"severity": "HIGH"
},
"details": "European Chemicals Agency IUCLID before 6.27.6 allows remote authenticated users to execute arbitrary code via Server Side Template Injection (SSTI) with a crafted template file. The attacker must have template manager permission.",
"id": "GHSA-3r37-p8j6-6wp6",
"modified": "2024-04-04T03:46:44Z",
"published": "2023-05-02T21:31:48Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-26546"
},
{
"type": "WEB",
"url": "https://iuclid6.echa.europa.eu"
},
{
"type": "WEB",
"url": "https://iuclid6.echa.europa.eu/documents/1387205/1809530/note_v6.27.6.pdf/76545a65-e6be-6486-280a-7d7c3d2ad455?t=1677577170669"
},
{
"type": "WEB",
"url": "https://iuclid6.echa.europa.eu/download"
}
],
"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"
}
]
}
GHSA-3R3X-75VR-Q97W
Vulnerability from github – Published: 2021-12-27 00:00 – Updated: 2022-07-13 00:01Certain NETGEAR devices are affected by server-side injection. This affects D6200 before 1.1.00.38, D7000 before 1.0.1.78, R6020 before 1.0.0.48, R6080 before 1.0.0.48, R6050 before 1.0.1.26, JR6150 before 1.0.1.26, R6120 before 1.0.0.66, R6220 before 1.1.0.100, R6230 before 1.1.0.100, R6260 before 1.1.0.78, R6800 before 1.2.0.76, R6900v2 before 1.2.0.76, R6700v2 before 1.2.0.76, R7450 before 1.2.0.76, AC2100 before 1.2.0.76, AC2400 before 1.2.0.76, AC2600 before 1.2.0.76, RBK40 before 2.5.1.16, RBR40 before 2.5.1.16, RBS40 before 2.5.1.16, RBK20 before 2.5.1.16, RBR20 before 2.5.1.16, RBS20 before 2.5.1.16, RBK50 before 2.5.1.16, RBR50 before 2.5.1.16, RBS50 before 2.5.1.16, RBS50Y before 2.6.1.40, and WNR2020 before 1.1.0.62.
{
"affected": [],
"aliases": [
"CVE-2021-45657"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-12-26T01:15:00Z",
"severity": "HIGH"
},
"details": "Certain NETGEAR devices are affected by server-side injection. This affects D6200 before 1.1.00.38, D7000 before 1.0.1.78, R6020 before 1.0.0.48, R6080 before 1.0.0.48, R6050 before 1.0.1.26, JR6150 before 1.0.1.26, R6120 before 1.0.0.66, R6220 before 1.1.0.100, R6230 before 1.1.0.100, R6260 before 1.1.0.78, R6800 before 1.2.0.76, R6900v2 before 1.2.0.76, R6700v2 before 1.2.0.76, R7450 before 1.2.0.76, AC2100 before 1.2.0.76, AC2400 before 1.2.0.76, AC2600 before 1.2.0.76, RBK40 before 2.5.1.16, RBR40 before 2.5.1.16, RBS40 before 2.5.1.16, RBK20 before 2.5.1.16, RBR20 before 2.5.1.16, RBS20 before 2.5.1.16, RBK50 before 2.5.1.16, RBR50 before 2.5.1.16, RBS50 before 2.5.1.16, RBS50Y before 2.6.1.40, and WNR2020 before 1.1.0.62.",
"id": "GHSA-3r3x-75vr-q97w",
"modified": "2022-07-13T00:01:51Z",
"published": "2021-12-27T00:00:31Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-45657"
},
{
"type": "WEB",
"url": "https://kb.netgear.com/000064067/Security-Advisory-for-Server-Side-Injection-on-Some-Routers-and-WiFi-Systems-PSV-2019-0141"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-3R46-8FPH-P95V
Vulnerability from github – Published: 2023-09-05 15:30 – Updated: 2024-04-04 07:28An issue was discovered in NOKIA AMS 9.7.05. Remote Code Execution exists via the debugger of the ipAddress variable. A remote user, authenticated to the AMS server, could inject code in the PING function. The privileges of the command executed depend on the user that runs the service.
{
"affected": [],
"aliases": [
"CVE-2022-41763"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-09-05T13:15:07Z",
"severity": "HIGH"
},
"details": "An issue was discovered in NOKIA AMS 9.7.05. Remote Code Execution exists via the debugger of the ipAddress variable. A remote user, authenticated to the AMS server, could inject code in the PING function. The privileges of the command executed depend on the user that runs the service.",
"id": "GHSA-3r46-8fph-p95v",
"modified": "2024-04-04T07:28:57Z",
"published": "2023-09-05T15:30:25Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-41763"
},
{
"type": "WEB",
"url": "https://www.gruppotim.it/it/footer/red-team.html"
}
],
"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"
}
]
}
GHSA-3R53-83GH-9P5M
Vulnerability from github – Published: 2022-05-01 06:49 – Updated: 2022-05-01 06:49Eval injection vulnerability in Horde Application Framework versions 3.0 before 3.0.10 and 3.1 before 3.1.1 allows remote attackers to execute arbitrary code via the help viewer.
{
"affected": [],
"aliases": [
"CVE-2006-1491"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2006-03-29T22:02:00Z",
"severity": "HIGH"
},
"details": "Eval injection vulnerability in Horde Application Framework versions 3.0 before 3.0.10 and 3.1 before 3.1.1 allows remote attackers to execute arbitrary code via the help viewer.",
"id": "GHSA-3r53-83gh-9p5m",
"modified": "2022-05-01T06:49:58Z",
"published": "2022-05-01T06:49:58Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2006-1491"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/25516"
},
{
"type": "WEB",
"url": "http://cvs.horde.org/diff.php?f=horde%2Fservices%2Fhelp%2Findex.php\u0026r1=2.85\u0026r2=2.86"
},
{
"type": "WEB",
"url": "http://lists.horde.org/archives/announce/2006/000271.html"
},
{
"type": "WEB",
"url": "http://lists.horde.org/archives/announce/2006/000272.html"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/19485"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/19504"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/19528"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/19619"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/19692"
},
{
"type": "WEB",
"url": "http://securitytracker.com/id?1015841"
},
{
"type": "WEB",
"url": "http://www.attrition.org/pipermail/vim/2006-March/000671.html"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2006/dsa-1033"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2006/dsa-1034"
},
{
"type": "WEB",
"url": "http://www.gentoo.org/security/en/glsa/glsa-200604-02.xml"
},
{
"type": "WEB",
"url": "http://www.novell.com/linux/security/advisories/2006_07_sr.html"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/17292"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2006/1154"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-3R5P-998X-5M4F
Vulnerability from github – Published: 2022-05-02 06:11 – Updated: 2022-05-02 06:11The Microsoft Data Analyzer ActiveX control (aka the Office Excel ActiveX control for Data Analysis) in max3activex.dll in Microsoft Windows 2000 SP4, Windows XP SP2 and SP3, Windows Server 2003 SP2, Windows Vista Gold, SP1, and SP2, Windows Server 2008 Gold, SP2, and R2, and Windows 7 allows remote attackers to execute arbitrary code via a crafted web page that corrupts the "system state," aka "Microsoft Data Analyzer ActiveX Control Vulnerability."
{
"affected": [],
"aliases": [
"CVE-2010-0252"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-02-10T18:30:00Z",
"severity": "HIGH"
},
"details": "The Microsoft Data Analyzer ActiveX control (aka the Office Excel ActiveX control for Data Analysis) in max3activex.dll in Microsoft Windows 2000 SP4, Windows XP SP2 and SP3, Windows Server 2003 SP2, Windows Vista Gold, SP1, and SP2, Windows Server 2008 Gold, SP2, and R2, and Windows 7 allows remote attackers to execute arbitrary code via a crafted web page that corrupts the \"system state,\" aka \"Microsoft Data Analyzer ActiveX Control Vulnerability.\"",
"id": "GHSA-3r5p-998x-5m4f",
"modified": "2022-05-02T06:11:15Z",
"published": "2022-05-02T06:11:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-0252"
},
{
"type": "WEB",
"url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2010/ms10-008"
},
{
"type": "WEB",
"url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2010/ms10-034"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A8424"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/38503"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/40059"
},
{
"type": "WEB",
"url": "http://www.us-cert.gov/cas/techalerts/TA10-040A.html"
},
{
"type": "WEB",
"url": "http://www.us-cert.gov/cas/techalerts/TA10-159B.html"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-3R6G-VGFW-328V
Vulnerability from github – Published: 2022-05-01 18:19 – Updated: 2025-04-09 03:44Argument injection vulnerability in Mozilla Firefox before 2.0.0.5, when running on systems with Thunderbird 1.5 installed and certain URIs registered, allows remote attackers to conduct cross-browser scripting attacks and execute arbitrary commands via shell metacharacters in a mailto URI, which are inserted into the command line that is created when invoking Thunderbird.exe, a similar issue to CVE-2007-3670.
{
"affected": [],
"aliases": [
"CVE-2007-4038"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2007-07-27T22:30:00Z",
"severity": "MODERATE"
},
"details": "Argument injection vulnerability in Mozilla Firefox before 2.0.0.5, when running on systems with Thunderbird 1.5 installed and certain URIs registered, allows remote attackers to conduct cross-browser scripting attacks and execute arbitrary commands via shell metacharacters in a mailto URI, which are inserted into the command line that is created when invoking Thunderbird.exe, a similar issue to CVE-2007-3670.",
"id": "GHSA-3r6g-vgfw-328v",
"modified": "2025-04-09T03:44:31Z",
"published": "2022-05-01T18:19:47Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2007-4038"
},
{
"type": "WEB",
"url": "http://larholm.com/2007/07/25/mozilla-protocol-abuse"
},
{
"type": "WEB",
"url": "http://seclists.org/fulldisclosure/2007/Jul/0557.html"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/474624/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/474686/100/0/threaded"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-3R6H-CMR9-36J6
Vulnerability from github – Published: 2025-02-27 21:32 – Updated: 2025-03-04 15:31An issue was discovered on Tuoshi/Dionlink LT15D 4G Wi-Fi devices through M7628NNxlSPv2xUI_v1.0.1802.10.08_P4 and LT21B devices through M7628xUSAxUIv2_v1.0.1481.15.02_P0. A unauthenticated remote attacker with network access can exploit a command injection vulnerability. The /goform/formJsonAjaxReq endpoint fails to sanitize shell metacharacters sent via JSON parameters, thus allowing attackers to execute arbitrary OS commands with root privileges.
{
"affected": [],
"aliases": [
"CVE-2024-53944"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-02-27T20:16:01Z",
"severity": "CRITICAL"
},
"details": "An issue was discovered on Tuoshi/Dionlink LT15D 4G Wi-Fi devices through M7628NNxlSPv2xUI_v1.0.1802.10.08_P4 and LT21B devices through M7628xUSAxUIv2_v1.0.1481.15.02_P0. A unauthenticated remote attacker with network access can exploit a command injection vulnerability. The /goform/formJsonAjaxReq endpoint fails to sanitize shell metacharacters sent via JSON parameters, thus allowing attackers to execute arbitrary OS commands with root privileges.",
"id": "GHSA-3r6h-cmr9-36j6",
"modified": "2025-03-04T15:31:47Z",
"published": "2025-02-27T21:32:16Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-53944"
},
{
"type": "WEB",
"url": "https://github.com/actuator/cve/blob/main/Tuoshi/CVE-2024-53944-Whitepaper.pdf"
},
{
"type": "WEB",
"url": "https://github.com/actuator/cve/blob/main/Tuoshi/CVE-2024-53944.txt"
},
{
"type": "WEB",
"url": "https://github.com/actuator/cve/blob/main/Tuoshi/Firmware-M7628NNxISPv2xUI_v1.0.1802.10.08_P4-Blind-CMD-Injection-unauth-WAN.gif"
},
{
"type": "WEB",
"url": "http://www.tuoshi.net/productview.asp?id=218"
},
{
"type": "WEB",
"url": "http://www.tuoshi.net/productview.asp?id=226"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-3R79-62F7-6GCX
Vulnerability from github – Published: 2025-07-09 03:30 – Updated: 2025-07-09 03:30An authentication bypass vulnerability exists in the WordPress Pie Register plugin ≤ 3.7.1.4 that allows unauthenticated attackers to impersonate arbitrary users by submitting a crafted POST request to the login endpoint. By setting social_site=true and manipulating the user_id_social_site parameter, an attacker can generate a valid WordPress session cookie for any user ID, including administrators. Once authenticated, the attacker may exploit plugin upload functionality to install a malicious plugin containing arbitrary PHP code, resulting in remote code execution on the underlying server.
{
"affected": [],
"aliases": [
"CVE-2025-34077"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-07-09T01:15:49Z",
"severity": "CRITICAL"
},
"details": "An authentication bypass vulnerability exists in the WordPress Pie Register plugin \u2264 3.7.1.4 that allows unauthenticated attackers to impersonate arbitrary users by submitting a crafted POST request to the login endpoint. By setting social_site=true and manipulating the user_id_social_site parameter, an attacker can generate a valid WordPress session cookie for any user ID, including administrators. Once authenticated, the attacker may exploit plugin upload functionality to install a malicious plugin containing arbitrary PHP code, resulting in remote code execution on the underlying server.",
"id": "GHSA-3r79-62f7-6gcx",
"modified": "2025-07-09T03:30:22Z",
"published": "2025-07-09T03:30:22Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-34077"
},
{
"type": "WEB",
"url": "https://github.com/GTSolutions/Pie-Register"
},
{
"type": "WEB",
"url": "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/unix/webapp/wp_pie_register_bypass_rce.rb"
},
{
"type": "WEB",
"url": "https://pieregister.com"
},
{
"type": "WEB",
"url": "https://vulncheck.com/advisories/wordpress-pie-register-plugin-rce"
},
{
"type": "WEB",
"url": "https://wordpress.org/plugins/pie-register"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/50395"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
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.