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.
8297 vulnerabilities reference this CWE, most recent first.
GHSA-W2WW-4MX4-W7C7
Vulnerability from github – Published: 2022-05-01 23:59 – Updated: 2025-04-09 03:56Unspecified vulnerability in PunBB before 1.2.19 allows remote attackers to inject arbitrary SMTP commands via unknown vectors.
{
"affected": [],
"aliases": [
"CVE-2008-3335"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-07-27T23:41:00Z",
"severity": "HIGH"
},
"details": "Unspecified vulnerability in PunBB before 1.2.19 allows remote attackers to inject arbitrary SMTP commands via unknown vectors.",
"id": "GHSA-w2ww-4mx4-w7c7",
"modified": "2025-04-09T03:56:53Z",
"published": "2022-05-01T23:59:11Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-3335"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/44010"
},
{
"type": "WEB",
"url": "http://punbb.informer.com"
},
{
"type": "WEB",
"url": "http://punbb.informer.com/download/changelogs/1.2.17_to_1.2.19.txt"
},
{
"type": "WEB",
"url": "http://punbb.informer.com/forums/topic/19539/punbb-1219"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/31219"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/30395"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-W2X6-63R6-W8MJ
Vulnerability from github – Published: 2022-05-01 23:48 – Updated: 2022-05-01 23:48PHP remote file inclusion vulnerability in fusebox5.php in Fusebox 5.5.1 allows remote attackers to execute arbitrary PHP code via a URL in the FUSEBOX_APPLICATION_PATH parameter. NOTE: the provenance of this information is unknown; the details are obtained solely from third party information.
{
"affected": [],
"aliases": [
"CVE-2008-2284"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-05-18T14:20:00Z",
"severity": "HIGH"
},
"details": "PHP remote file inclusion vulnerability in fusebox5.php in Fusebox 5.5.1 allows remote attackers to execute arbitrary PHP code via a URL in the FUSEBOX_APPLICATION_PATH parameter. NOTE: the provenance of this information is unknown; the details are obtained solely from third party information.",
"id": "GHSA-w2x6-63r6-w8mj",
"modified": "2022-05-01T23:48:39Z",
"published": "2022-05-01T23:48:39Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-2284"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/42389"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/30178"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/29163"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-W32Q-QM9C-QVJ6
Vulnerability from github – Published: 2022-05-01 17:53 – Updated: 2022-05-01 17:53Multiple PHP remote file inclusion vulnerabilities in Open Education System (OES) 0.1beta allow remote attackers to execute arbitrary PHP code via a URL in the CONF_INCLUDE_PATH parameter to (1) lib-account.inc.php, (2) lib-file.inc.php, (3) lib-group.inc.php, (4) lib-log.inc.php, (5) lib-mydb.inc.php, (6) lib-template-mod.inc.php, and (7) lib-themes.inc.php in includes/.
{
"affected": [],
"aliases": [
"CVE-2007-1446"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2007-03-14T00:19:00Z",
"severity": "HIGH"
},
"details": "Multiple PHP remote file inclusion vulnerabilities in Open Education System (OES) 0.1beta allow remote attackers to execute arbitrary PHP code via a URL in the CONF_INCLUDE_PATH parameter to (1) lib-account.inc.php, (2) lib-file.inc.php, (3) lib-group.inc.php, (4) lib-log.inc.php, (5) lib-mydb.inc.php, (6) lib-template-mod.inc.php, and (7) lib-themes.inc.php in includes/.",
"id": "GHSA-w32q-qm9c-qvj6",
"modified": "2022-05-01T17:53:51Z",
"published": "2022-05-01T17:53:51Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2007-1446"
},
{
"type": "WEB",
"url": "http://advisories.echo.or.id/adv/adv69-K-159-2007.txt"
},
{
"type": "WEB",
"url": "http://securityreason.com/securityalert/2421"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/462670/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/22934"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2007/0920"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-W32V-X9J2-MV46
Vulnerability from github – Published: 2023-03-24 18:30 – Updated: 2023-03-29 00:30Apache OpenOffice versions before 4.1.14 may be configured to add an empty entry to the Java class path. This may lead to run arbitrary Java code from the current directory.
{
"affected": [],
"aliases": [
"CVE-2022-38745"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-03-24T16:15:00Z",
"severity": "HIGH"
},
"details": "Apache OpenOffice versions before 4.1.14 may be configured to add an empty entry to the Java class path. This may lead to run arbitrary Java code from the current directory.",
"id": "GHSA-w32v-x9j2-mv46",
"modified": "2023-03-29T00:30:17Z",
"published": "2023-03-24T18:30:21Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-38745"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread/q3noq7m681kvtb29m28x74q8cnwnzzo0"
},
{
"type": "WEB",
"url": "https://www.openoffice.org/security/cves/CVE-2022-38745.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-W34F-X9RJ-JG28
Vulnerability from github – Published: 2025-05-21 21:31 – Updated: 2025-05-22 21:30A vulnerability in SeedDMS 6.0.32 allows an attacker with admin privileges to execute arbitrary PHP code by exploiting the zip import functionality in the Extension Manager.
{
"affected": [],
"aliases": [
"CVE-2025-45752"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-05-21T19:16:08Z",
"severity": "HIGH"
},
"details": "A vulnerability in SeedDMS 6.0.32 allows an attacker with admin privileges to execute arbitrary PHP code by exploiting the zip import functionality in the Extension Manager.",
"id": "GHSA-w34f-x9rj-jg28",
"modified": "2025-05-22T21:30:45Z",
"published": "2025-05-21T21:31:40Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-45752"
},
{
"type": "WEB",
"url": "https://www.simonjuguna.com/cve-2025-45752-authenticated-remote-code-execution-vulnerability-in-seeddms-v6-0-32"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-W34P-WQJQ-9XW2
Vulnerability from github – Published: 2022-05-01 23:58 – Updated: 2022-05-01 23:58Multiple PHP remote file inclusion vulnerabilities in CreaCMS 1.0 allow remote attackers to execute arbitrary PHP code via a URL in the (1) cfg[document_uri] parameter to _administration/edition_article/edition_article.php and the (2) cfg[base_uri_admin] parameter to _administration/fonctions/get_liste_langue.php. NOTE: the provenance of this information is unknown; the details are obtained solely from third party information.
{
"affected": [],
"aliases": [
"CVE-2008-3313"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-07-25T16:41:00Z",
"severity": "HIGH"
},
"details": "Multiple PHP remote file inclusion vulnerabilities in CreaCMS 1.0 allow remote attackers to execute arbitrary PHP code via a URL in the (1) cfg[document_uri] parameter to _administration/edition_article/edition_article.php and the (2) cfg[base_uri_admin] parameter to _administration/fonctions/get_liste_langue.php. NOTE: the provenance of this information is unknown; the details are obtained solely from third party information.",
"id": "GHSA-w34p-wqjq-9xw2",
"modified": "2022-05-01T23:58:53Z",
"published": "2022-05-01T23:58:53Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-3313"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/43906"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/30284"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-W379-57QR-347P
Vulnerability from github – Published: 2022-05-14 01:31 – Updated: 2022-05-14 01:31The RPC client implementation in Microsoft Windows XP SP2 and SP3 and Server 2003 SP2 does not properly allocate memory during the parsing of responses, which allows remote RPC servers and man-in-the-middle attackers to execute arbitrary code via a malformed response, aka "RPC Memory Corruption Vulnerability."
{
"affected": [],
"aliases": [
"CVE-2010-2567"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-09-15T19:00:00Z",
"severity": "HIGH"
},
"details": "The RPC client implementation in Microsoft Windows XP SP2 and SP3 and Server 2003 SP2 does not properly allocate memory during the parsing of responses, which allows remote RPC servers and man-in-the-middle attackers to execute arbitrary code via a malformed response, aka \"RPC Memory Corruption Vulnerability.\"",
"id": "GHSA-w379-57qr-347p",
"modified": "2022-05-14T01:31:44Z",
"published": "2022-05-14T01:31:44Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-2567"
},
{
"type": "WEB",
"url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2010/ms10-066"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A7177"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-W37R-X9RF-6846
Vulnerability from github – Published: 2022-05-04 00:30 – Updated: 2022-05-04 00:30CRLF injection vulnerability in Mozilla Firefox 4.x through 10.0, Firefox ESR 10.x before 10.0.3, Thunderbird 5.0 through 10.0, Thunderbird ESR 10.x before 10.0.3, and SeaMonkey before 2.8 allows remote web servers to bypass intended Content Security Policy (CSP) restrictions and possibly conduct cross-site scripting (XSS) attacks via crafted HTTP headers.
{
"affected": [],
"aliases": [
"CVE-2012-0451"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2012-03-14T19:55:00Z",
"severity": "MODERATE"
},
"details": "CRLF injection vulnerability in Mozilla Firefox 4.x through 10.0, Firefox ESR 10.x before 10.0.3, Thunderbird 5.0 through 10.0, Thunderbird ESR 10.x before 10.0.3, and SeaMonkey before 2.8 allows remote web servers to bypass intended Content Security Policy (CSP) restrictions and possibly conduct cross-site scripting (XSS) attacks via crafted HTTP headers.",
"id": "GHSA-w37r-x9rf-6846",
"modified": "2022-05-04T00:30:24Z",
"published": "2022-05-04T00:30:24Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2012-0451"
},
{
"type": "WEB",
"url": "https://bugzilla.mozilla.org/show_bug.cgi?id=717511"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A14909"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2012-03/msg00014.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-updates/2012-03/msg00042.html"
},
{
"type": "WEB",
"url": "http://rhn.redhat.com/errata/RHSA-2012-0387.html"
},
{
"type": "WEB",
"url": "http://rhn.redhat.com/errata/RHSA-2012-0388.html"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/48359"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/48402"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/48496"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/48513"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/48553"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/48561"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/48629"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/49055"
},
{
"type": "WEB",
"url": "http://www.mandriva.com/security/advisories?name=MDVSA-2012:032"
},
{
"type": "WEB",
"url": "http://www.mozilla.org/security/announce/2012/mfsa2012-15.html"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/52463"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id?1026801"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id?1026803"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id?1026804"
},
{
"type": "WEB",
"url": "http://www.ubuntu.com/usn/USN-1400-1"
},
{
"type": "WEB",
"url": "http://www.ubuntu.com/usn/USN-1400-2"
},
{
"type": "WEB",
"url": "http://www.ubuntu.com/usn/USN-1400-3"
},
{
"type": "WEB",
"url": "http://www.ubuntu.com/usn/USN-1400-4"
},
{
"type": "WEB",
"url": "http://www.ubuntu.com/usn/USN-1400-5"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-W39X-CHVM-PJ3C
Vulnerability from github – Published: 2022-05-03 00:00 – Updated: 2022-05-19 22:21All versions of package com.bstek.ureport:ureport2-console are vulnerable to Remote Code Execution by connecting to a malicious database server, causing arbitrary file read and deserialization of local gadgets.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "com.bstek.ureport:ureport2-console"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "2.2.9"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2022-25767"
],
"database_specific": {
"cwe_ids": [
"CWE-502",
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2022-05-19T22:21:59Z",
"nvd_published_at": "2022-05-01T16:15:00Z",
"severity": "CRITICAL"
},
"details": "All versions of package com.bstek.ureport:ureport2-console are vulnerable to Remote Code Execution by connecting to a malicious database server, causing arbitrary file read and deserialization of local gadgets.",
"id": "GHSA-w39x-chvm-pj3c",
"modified": "2022-05-19T22:21:59Z",
"published": "2022-05-03T00:00:44Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-25767"
},
{
"type": "WEB",
"url": "https://github.com/JinYiTong/CVE-Req/blob/main/ureport2/ureport2-console.md"
},
{
"type": "PACKAGE",
"url": "https://github.com/youseries/ureport"
},
{
"type": "WEB",
"url": "https://snyk.io/vuln/SNYK-JAVA-COMBSTEKUREPORT-2322018"
}
],
"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"
}
],
"summary": "Deserialization of Untrusted Data in com.bstek.ureport:ureport2-console"
}
GHSA-W3C2-79CF-M9PF
Vulnerability from github – Published: 2022-05-14 02:44 – Updated: 2022-05-14 02:44The do_anonymous_page function in mm/memory.c in the Linux kernel before 2.6.27.52, 2.6.32.x before 2.6.32.19, 2.6.34.x before 2.6.34.4, and 2.6.35.x before 2.6.35.2 does not properly separate the stack and the heap, which allows context-dependent attackers to execute arbitrary code by writing to the bottom page of a shared memory segment, as demonstrated by a memory-exhaustion attack against the X.Org X server.
{
"affected": [],
"aliases": [
"CVE-2010-2240"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-09-03T20:00:00Z",
"severity": "HIGH"
},
"details": "The do_anonymous_page function in mm/memory.c in the Linux kernel before 2.6.27.52, 2.6.32.x before 2.6.32.19, 2.6.34.x before 2.6.34.4, and 2.6.35.x before 2.6.35.2 does not properly separate the stack and the heap, which allows context-dependent attackers to execute arbitrary code by writing to the bottom page of a shared memory segment, as demonstrated by a memory-exhaustion attack against the X.Org X server.",
"id": "GHSA-w3c2-79cf-m9pf",
"modified": "2022-05-14T02:44:29Z",
"published": "2022-05-14T02:44:29Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-2240"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2010:0631"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2010:0660"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2010:0661"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2010:0670"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2010:0676"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2010:0677"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2010:0882"
},
{
"type": "WEB",
"url": "https://access.redhat.com/security/cve/CVE-2010-2240"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=606611"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A13247"
},
{
"type": "WEB",
"url": "https://rhn.redhat.com/errata/RHSA-2010-0661.html"
},
{
"type": "WEB",
"url": "http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git%3Ba=commit%3Bh=320b2b8de12698082609ebbc1a17165727f4c893"
},
{
"type": "WEB",
"url": "http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=320b2b8de12698082609ebbc1a17165727f4c893"
},
{
"type": "WEB",
"url": "http://lists.vmware.com/pipermail/security-announce/2011/000133.html"
},
{
"type": "WEB",
"url": "http://securitytracker.com/id?1024344"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2010/dsa-2094"
},
{
"type": "WEB",
"url": "http://www.invisiblethingslab.com/resources/misc-2010/xorg-large-memory-attacks.pdf"
},
{
"type": "WEB",
"url": "http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.27.52"
},
{
"type": "WEB",
"url": "http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.32.19"
},
{
"type": "WEB",
"url": "http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.34.4"
},
{
"type": "WEB",
"url": "http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.35.2"
},
{
"type": "WEB",
"url": "http://www.mandriva.com/security/advisories?name=MDVSA-2010:172"
},
{
"type": "WEB",
"url": "http://www.mandriva.com/security/advisories?name=MDVSA-2010:198"
},
{
"type": "WEB",
"url": "http://www.mandriva.com/security/advisories?name=MDVSA-2011:051"
},
{
"type": "WEB",
"url": "http://www.redhat.com/support/errata/RHSA-2010-0660.html"
},
{
"type": "WEB",
"url": "http://www.redhat.com/support/errata/RHSA-2010-0670.html"
},
{
"type": "WEB",
"url": "http://www.redhat.com/support/errata/RHSA-2010-0882.html"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/517739/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.vmware.com/security/advisories/VMSA-2011-0007.html"
},
{
"type": "WEB",
"url": "http://www.vmware.com/security/advisories/VMSA-2011-0009.html"
}
],
"schema_version": "1.4.0",
"severity": []
}
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.