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.
9286 vulnerabilities reference this CWE, most recent first.
GHSA-P6F8-2H8R-5246
Vulnerability from github – Published: 2022-05-02 03:29 – Updated: 2022-05-02 03:29The garbage-collection implementation in Mozilla Firefox before 3.0.11, Thunderbird before 2.0.0.22, and SeaMonkey before 1.1.17 sets an element's owner document to null in unspecified circumstances, which allows remote attackers to execute arbitrary JavaScript with chrome privileges via a crafted event handler, related to an incorrect context for this event handler.
{
"affected": [],
"aliases": [
"CVE-2009-1838"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2009-06-12T21:30:00Z",
"severity": "HIGH"
},
"details": "The garbage-collection implementation in Mozilla Firefox before 3.0.11, Thunderbird before 2.0.0.22, and SeaMonkey before 1.1.17 sets an element\u0027s owner document to null in unspecified circumstances, which allows remote attackers to execute arbitrary JavaScript with chrome privileges via a crafted event handler, related to an incorrect context for this event handler.",
"id": "GHSA-p6f8-2h8r-5246",
"modified": "2022-05-02T03:29:08Z",
"published": "2022-05-02T03:29:08Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2009-1838"
},
{
"type": "WEB",
"url": "https://bugzilla.mozilla.org/show_bug.cgi?id=489131"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=503580"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A11080"
},
{
"type": "WEB",
"url": "https://rhn.redhat.com/errata/RHSA-2009-1095.html"
},
{
"type": "WEB",
"url": "https://www.redhat.com/archives/fedora-package-announce/2009-July/msg00444.html"
},
{
"type": "WEB",
"url": "https://www.redhat.com/archives/fedora-package-announce/2009-July/msg00504.html"
},
{
"type": "WEB",
"url": "https://www.redhat.com/archives/fedora-package-announce/2009-June/msg00574.html"
},
{
"type": "WEB",
"url": "https://www.redhat.com/archives/fedora-package-announce/2009-June/msg00657.html"
},
{
"type": "WEB",
"url": "http://osvdb.org/55157"
},
{
"type": "WEB",
"url": "http://rhn.redhat.com/errata/RHSA-2009-1096.html"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35331"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35415"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35428"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35431"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35439"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35440"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35468"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35536"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35561"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35602"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/35882"
},
{
"type": "WEB",
"url": "http://slackware.com/security/viewer.php?l=slackware-security\u0026y=2009\u0026m=slackware-security.372468"
},
{
"type": "WEB",
"url": "http://slackware.com/security/viewer.php?l=slackware-security\u0026y=2009\u0026m=slackware-security.425408"
},
{
"type": "WEB",
"url": "http://sunsolve.sun.com/search/document.do?assetkey=1-66-264308-1"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2009/dsa-1820"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2009/dsa-1830"
},
{
"type": "WEB",
"url": "http://www.mandriva.com/security/advisories?name=MDVSA-2009:141"
},
{
"type": "WEB",
"url": "http://www.mozilla.org/security/announce/2009/mfsa2009-29.html"
},
{
"type": "WEB",
"url": "http://www.redhat.com/support/errata/RHSA-2009-1125.html"
},
{
"type": "WEB",
"url": "http://www.redhat.com/support/errata/RHSA-2009-1126.html"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/35326"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/35383"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id?1022397"
},
{
"type": "WEB",
"url": "http://www.slackware.com/security/viewer.php?l=slackware-security\u0026y=2009\u0026m=slackware-security.454275"
},
{
"type": "WEB",
"url": "http://www.ubuntu.com/usn/usn-782-1"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2009/1572"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-P6H7-29R2-G88F
Vulnerability from github – Published: 2022-05-14 02:55 – Updated: 2024-01-15 17:50setup/lib/ConfigGenerator.class.php in phpMyAdmin 3.x before 3.3.10.2 and 3.4.x before 3.4.3.1 does not properly restrict the presence of comment closing delimiters, which allows remote attackers to conduct static code injection attacks by leveraging the ability to modify the SESSION superglobal array.
{
"affected": [
{
"package": {
"ecosystem": "Packagist",
"name": "phpmyadmin/phpmyadmin"
},
"ranges": [
{
"events": [
{
"introduced": "3.0"
},
{
"fixed": "3.3.10.2"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Packagist",
"name": "phpmyadmin/phpmyadmin"
},
"ranges": [
{
"events": [
{
"introduced": "3.4"
},
{
"fixed": "3.4.3.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2011-2506"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2024-01-15T17:50:29Z",
"nvd_published_at": "2011-07-14T23:55:00Z",
"severity": "HIGH"
},
"details": "`setup/lib/ConfigGenerator.class.php` in phpMyAdmin 3.x before 3.3.10.2 and 3.4.x before 3.4.3.1 does not properly restrict the presence of comment closing delimiters, which allows remote attackers to conduct static code injection attacks by leveraging the ability to modify the SESSION superglobal array.",
"id": "GHSA-p6h7-29r2-g88f",
"modified": "2024-01-15T17:50:29Z",
"published": "2022-05-14T02:55:16Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2011-2506"
},
{
"type": "WEB",
"url": "https://github.com/phpmyadmin/phpmyadmin/commit/0fbedaf5fd7a771d0885c6b7385d934fc90d0d7f"
},
{
"type": "WEB",
"url": "https://github.com/phpmyadmin/phpmyadmin/commit/2e01647949df937040e73a94ce0bac0daecbdcf4"
},
{
"type": "PACKAGE",
"url": "https://github.com/phpmyadmin/composer"
},
{
"type": "WEB",
"url": "https://web.archive.org/web/20110712103138/http://www.xxor.se/advisories/phpMyAdmin_3.x_Multiple_Remote_Code_Executions.txt"
},
{
"type": "WEB",
"url": "https://web.archive.org/web/20111116172111/http://www.securityfocus.com/archive/1/518804/100/0/threaded"
},
{
"type": "WEB",
"url": "https://web.archive.org/web/20121105034518/http://www.mandriva.com/en/support/security/advisories?name=MDVSA-2011:124"
},
{
"type": "WEB",
"url": "http://ha.xxor.se/2011/07/phpmyadmin-3x-multiple-remote-code.html"
},
{
"type": "WEB",
"url": "http://lists.fedoraproject.org/pipermail/package-announce/2011-July/062719.html"
},
{
"type": "WEB",
"url": "http://phpmyadmin.git.sourceforge.net/git/gitweb.cgi?p=phpmyadmin/phpmyadmin;a=commit;h=0fbedaf5fd7a771d0885c6b7385d934fc90d0d7f"
},
{
"type": "WEB",
"url": "http://securityreason.com/securityalert/8306"
},
{
"type": "WEB",
"url": "http://typo3.org/teams/security/security-bulletins/typo3-sa-2011-008"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2011/dsa-2286"
},
{
"type": "WEB",
"url": "http://www.exploit-db.com/exploits/17514"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2011/06/28/2"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2011/06/28/6"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2011/06/28/8"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2011/06/29/11"
},
{
"type": "WEB",
"url": "http://www.phpmyadmin.net/home_page/security/PMASA-2011-6.php"
}
],
"schema_version": "1.4.0",
"severity": [],
"summary": "phpMyAdmin vulnerable to static code injection"
}
GHSA-P6PV-686X-7V4V
Vulnerability from github – Published: 2022-05-01 23:45 – Updated: 2022-05-01 23:45PHP remote file inclusion vulnerability in includes/functions.php in Quate Grape Web Statistics 0.2a allows remote attackers to execute arbitrary PHP code via a URL in the location parameter.
{
"affected": [],
"aliases": [
"CVE-2008-1963"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-04-25T19:05:00Z",
"severity": "HIGH"
},
"details": "PHP remote file inclusion vulnerability in includes/functions.php in Quate Grape Web Statistics 0.2a allows remote attackers to execute arbitrary PHP code via a URL in the location parameter.",
"id": "GHSA-p6pv-686x-7v4v",
"modified": "2022-05-01T23:45:22Z",
"published": "2022-05-01T23:45:22Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-1963"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/41883"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/5463"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/28838"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-P6W4-R2QV-79V8
Vulnerability from github – Published: 2022-05-17 04:38 – Updated: 2022-05-17 04:38The auto-format feature in the Request_Curl class in FuelPHP 1.1 through 1.7.1 allows remote attackers to execute arbitrary code via a crafted response.
{
"affected": [],
"aliases": [
"CVE-2014-1999"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2014-07-20T11:12:00Z",
"severity": "HIGH"
},
"details": "The auto-format feature in the Request_Curl class in FuelPHP 1.1 through 1.7.1 allows remote attackers to execute arbitrary code via a crafted response.",
"id": "GHSA-p6w4-r2qv-79v8",
"modified": "2022-05-17T04:38:52Z",
"published": "2022-05-17T04:38:52Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2014-1999"
},
{
"type": "WEB",
"url": "http://fuelphp.com/security-advisories"
},
{
"type": "WEB",
"url": "http://jvn.jp/en/jp/JVN94791545/index.html"
},
{
"type": "WEB",
"url": "http://jvndb.jvn.jp/jvndb/JVNDB-2014-000082"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-P6W4-XGMF-8R7G
Vulnerability from github – Published: 2022-05-24 17:47 – Updated: 2022-05-24 17:47Eaton Intelligent Power Manager (IPM) prior to 1.69 is vulnerable to unauthenticated remote code execution vulnerability. IPM software does not sanitize the date provided via coverterCheckList action in meta_driver_srv.js class. Attackers can send a specially crafted packet to make IPM connect to rouge SNMP server and execute attacker-controlled code.
{
"affected": [],
"aliases": [
"CVE-2021-23281"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-04-13T19:15:00Z",
"severity": "CRITICAL"
},
"details": "Eaton Intelligent Power Manager (IPM) prior to 1.69 is vulnerable to unauthenticated remote code execution vulnerability. IPM software does not sanitize the date provided via coverterCheckList action in meta_driver_srv.js class. Attackers can send a specially crafted packet to make IPM connect to rouge SNMP server and execute attacker-controlled code.",
"id": "GHSA-p6w4-xgmf-8r7g",
"modified": "2022-05-24T17:47:15Z",
"published": "2022-05-24T17:47:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-23281"
},
{
"type": "WEB",
"url": "https://www.eaton.com/content/dam/eaton/company/news-insights/cybersecurity/security-bulletins/eaton-intelligent-power-manager-ipm-vulnerability-advisory.pdf"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-P6WJ-GVR2-45FC
Vulnerability from github – Published: 2022-05-02 03:52 – Updated: 2022-05-02 03:52DAZ Studio 2.3.3.161, 2.3.3.163, and 3.0.1.135 allows remote attackers to execute arbitrary JavaScript code via a (1) .ds, (2) .dsa, (3) .dse, or (4) .dsb file, as demonstrated by code that loads the WScript.Shell ActiveX control, related to a "script injection vulnerability."
{
"affected": [],
"aliases": [
"CVE-2009-4148"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2009-12-04T19:30:00Z",
"severity": "HIGH"
},
"details": "DAZ Studio 2.3.3.161, 2.3.3.163, and 3.0.1.135 allows remote attackers to execute arbitrary JavaScript code via a (1) .ds, (2) .dsa, (3) .dse, or (4) .dsb file, as demonstrated by code that loads the WScript.Shell ActiveX control, related to a \"script injection vulnerability.\"",
"id": "GHSA-p6wj-gvr2-45fc",
"modified": "2022-05-02T03:52:15Z",
"published": "2022-05-02T03:52:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2009-4148"
},
{
"type": "WEB",
"url": "http://www.coresecurity.com/content/dazstudio-scripting-injection"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/508192/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/37176"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-P6X5-P4XF-CC4R
Vulnerability from github – Published: 2026-04-17 22:31 – Updated: 2026-05-12 13:32Impact
String literal content passed to cg.parse() is injected verbatim into a new Function() body without sanitization. This allows an attacker to execute arbitrary system commands when user-controlled input reaches the parser. Any application exposing a math evaluation endpoint where user input flows into cg.parse() is vulnerable to full RCE.
Patches
The vulnerability is addressed by using JSON.stringify() on string literal values in lib/node/ConstantNode.js to ensure they are treated as data rather than code. Users should upgrade to version 0.4.3 or later.
Workarounds
Avoid passing un-sanitized user input to the parser or manually escape string literals in the input.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "math-codegen"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.4.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-41507"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2026-04-17T22:31:45Z",
"nvd_published_at": "2026-05-08T14:16:34Z",
"severity": "CRITICAL"
},
"details": "### Impact\n\nString literal content passed to `cg.parse()` is injected verbatim into a `new Function()` body without sanitization. This allows an attacker to execute arbitrary system commands when user-controlled input reaches the parser. Any application exposing a math evaluation endpoint where user input flows into `cg.parse()` is vulnerable to full RCE.\n \n### Patches\n\nThe vulnerability is addressed by using `JSON.stringify()` on string literal values in `lib/node/ConstantNode.js` to ensure they are treated as data rather than code. Users should upgrade to version 0.4.3 or later.\n \n### Workarounds\n\nAvoid passing un-sanitized user input to the parser or manually escape string literals in the input.",
"id": "GHSA-p6x5-p4xf-cc4r",
"modified": "2026-05-12T13:32:44Z",
"published": "2026-04-17T22:31:45Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/mauriciopoppe/math-codegen/security/advisories/GHSA-p6x5-p4xf-cc4r"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-41507"
},
{
"type": "WEB",
"url": "https://github.com/mauriciopoppe/math-codegen/pull/11"
},
{
"type": "WEB",
"url": "https://github.com/mauriciopoppe/math-codegen/commit/4bb52d3030683362b3559ee8dd91350555a05f6b"
},
{
"type": "WEB",
"url": "https://github.com/hits3134"
},
{
"type": "PACKAGE",
"url": "https://github.com/mauriciopoppe/math-codegen"
}
],
"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": "Remote Code Execution (RCE) via String Literal Injection into math-codegen"
}
GHSA-P73X-RPGM-3V56
Vulnerability from github – Published: 2024-04-03 12:31 – Updated: 2025-03-31 13:35Lack of sanitization during Installation Process in Dolibarr ERP CRM up to version 19.0.0 allows an attacker with adjacent access to the network to execute arbitrary code via a specifically crafted input.
{
"affected": [
{
"package": {
"ecosystem": "Packagist",
"name": "dolibarr/dolibarr"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "19.0.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2024-29477"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2024-04-03T18:04:19Z",
"nvd_published_at": "2024-04-03T12:15:13Z",
"severity": "MODERATE"
},
"details": "Lack of sanitization during Installation Process in Dolibarr ERP CRM up to version 19.0.0 allows an attacker with adjacent access to the network to execute arbitrary code via a specifically crafted input.",
"id": "GHSA-p73x-rpgm-3v56",
"modified": "2025-03-31T13:35:17Z",
"published": "2024-04-03T12:31:06Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-29477"
},
{
"type": "PACKAGE",
"url": "https://github.com/Dolibarr/dolibarr"
},
{
"type": "WEB",
"url": "https://github.com/alexbsec/CVEs/blob/master/2024/CVE-2024-29477.md"
},
{
"type": "WEB",
"url": "http://dolibarr.com"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:A/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Dolibarr ERP CRM Code Injection vulnerability during installation"
}
GHSA-P75R-4C9J-53M6
Vulnerability from github – Published: 2022-05-17 05:43 – Updated: 2022-05-17 05:43awstats.cgi in AWStats before 7.0 accepts a configdir parameter in the URL, which allows remote attackers to execute arbitrary commands via a crafted configuration file located on a (1) WebDAV server or (2) NFS server.
{
"affected": [],
"aliases": [
"CVE-2010-4367"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-12-02T16:22:00Z",
"severity": "HIGH"
},
"details": "awstats.cgi in AWStats before 7.0 accepts a configdir parameter in the URL, which allows remote attackers to execute arbitrary commands via a crafted configuration file located on a (1) WebDAV server or (2) NFS server.",
"id": "GHSA-p75r-4c9j-53m6",
"modified": "2022-05-17T05:43:23Z",
"published": "2022-05-17T05:43:23Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-4367"
},
{
"type": "WEB",
"url": "http://awstats.sourceforge.net/docs/awstats_changelog.txt"
},
{
"type": "WEB",
"url": "http://www.exploitdevelopment.com/Vulnerabilities/2010-WEB-001.html"
},
{
"type": "WEB",
"url": "http://www.mandriva.com/security/advisories?name=MDVSA-2011:033"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-P7HF-43G5-XHVW
Vulnerability from github – Published: 2024-10-25 21:31 – Updated: 2024-10-29 21:30MangoOS before 5.2.0 was discovered to contain an authenticated remote code execution (RCE) vulnerability via the Active Process Command feature.
{
"affected": [],
"aliases": [
"CVE-2024-37845"
],
"database_specific": {
"cwe_ids": [
"CWE-78",
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-10-25T19:15:03Z",
"severity": "HIGH"
},
"details": "MangoOS before 5.2.0 was discovered to contain an authenticated remote code execution (RCE) vulnerability via the Active Process Command feature.",
"id": "GHSA-p7hf-43g5-xhvw",
"modified": "2024-10-29T21:30:48Z",
"published": "2024-10-25T21:31:27Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-37845"
},
{
"type": "WEB",
"url": "https://github.com/herombey/Disclosures/blob/main/CVE-2024-37845%20RCE.pdf"
},
{
"type": "WEB",
"url": "https://github.com/herombey/Disclosures/tree/main"
}
],
"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"
}
]
}
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.