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.
8335 vulnerabilities reference this CWE, most recent first.
GHSA-Q8V6-VC7Q-RPFX
Vulnerability from github – Published: 2022-05-01 18:32 – Updated: 2022-05-01 18:32Multiple PHP remote file inclusion vulnerabilities in ELSEIF CMS Beta 0.6 allow remote attackers to execute arbitrary PHP code via a URL in the (1) contenus parameter to (a) contenus.php; the (2) tpelseifportalrepertoire parameter to (b) votes.php, (c) espaceperso.php, (d) enregistrement.php, (e) commentaire.php, and (f) coeurusr.php in utilisateurs/, and (g) articles/fonctions.php and (h) depot/fonctions.php in moduleajouter/; the (3) corpsdesign parameter to (i) articles/usrarticles.php and (j) depot/usrdepot.php in moduleajouter/; and possibly other files.
{
"affected": [],
"aliases": [
"CVE-2007-5305"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2007-10-09T18:17:00Z",
"severity": "HIGH"
},
"details": "Multiple PHP remote file inclusion vulnerabilities in ELSEIF CMS Beta 0.6 allow remote attackers to execute arbitrary PHP code via a URL in the (1) contenus parameter to (a) contenus.php; the (2) tpelseifportalrepertoire parameter to (b) votes.php, (c) espaceperso.php, (d) enregistrement.php, (e) commentaire.php, and (f) coeurusr.php in utilisateurs/, and (g) articles/fonctions.php and (h) depot/fonctions.php in moduleajouter/; the (3) corpsdesign parameter to (i) articles/usrarticles.php and (j) depot/usrdepot.php in moduleajouter/; and possibly other files.",
"id": "GHSA-q8v6-vc7q-rpfx",
"modified": "2022-05-01T18:32:01Z",
"published": "2022-05-01T18:32:01Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2007-5305"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/37011"
},
{
"type": "WEB",
"url": "http://osvdb.org/38649"
},
{
"type": "WEB",
"url": "http://osvdb.org/38650"
},
{
"type": "WEB",
"url": "http://osvdb.org/38651"
},
{
"type": "WEB",
"url": "http://osvdb.org/38652"
},
{
"type": "WEB",
"url": "http://osvdb.org/38653"
},
{
"type": "WEB",
"url": "http://osvdb.org/38654"
},
{
"type": "WEB",
"url": "http://osvdb.org/38655"
},
{
"type": "WEB",
"url": "http://osvdb.org/38656"
},
{
"type": "WEB",
"url": "http://osvdb.org/38657"
},
{
"type": "WEB",
"url": "http://osvdb.org/38658"
},
{
"type": "WEB",
"url": "http://securityreason.com/securityalert/3204"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/481683/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/25951"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-Q8VQ-355X-4874
Vulnerability from github – Published: 2022-05-17 00:28 – Updated: 2022-05-17 00:28A Code Injection issue was discovered in CyberVision Kaa IoT Platform, Version 0.7.4. An insufficient-encapsulation vulnerability has been identified, which may allow remote code execution.
{
"affected": [],
"aliases": [
"CVE-2017-7911"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2017-05-06T00:29:00Z",
"severity": "HIGH"
},
"details": "A Code Injection issue was discovered in CyberVision Kaa IoT Platform, Version 0.7.4. An insufficient-encapsulation vulnerability has been identified, which may allow remote code execution.",
"id": "GHSA-q8vq-355x-4874",
"modified": "2022-05-17T00:28:46Z",
"published": "2022-05-17T00:28:46Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2017-7911"
},
{
"type": "WEB",
"url": "https://ics-cert.us-cert.gov/advisories/ICSA-17-122-02"
},
{
"type": "WEB",
"url": "https://www.tenable.com/security/research/tra-2017-19"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/98256"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-Q8VW-H86H-VFJ9
Vulnerability from github – Published: 2022-05-17 01:01 – Updated: 2022-05-17 01:01The appendChild function in Mozilla Firefox before 3.6.20, Thunderbird 3.x before 3.1.12, SeaMonkey 2.x, and possibly other products does not properly handle DOM objects, which allows remote attackers to execute arbitrary code via unspecified vectors that lead to dereferencing of a "dangling pointer."
{
"affected": [],
"aliases": [
"CVE-2011-2378"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2011-08-18T18:55:00Z",
"severity": "HIGH"
},
"details": "The appendChild function in Mozilla Firefox before 3.6.20, Thunderbird 3.x before 3.1.12, SeaMonkey 2.x, and possibly other products does not properly handle DOM objects, which allows remote attackers to execute arbitrary code via unspecified vectors that lead to dereferencing of a \"dangling pointer.\"",
"id": "GHSA-q8vw-h86h-vfj9",
"modified": "2022-05-17T01:01:04Z",
"published": "2022-05-17T01:01:04Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2011-2378"
},
{
"type": "WEB",
"url": "https://bugzilla.mozilla.org/show_bug.cgi?id=648065"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A14163"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2011-08/msg00023.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2011-08/msg00027.html"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2011/dsa-2295"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2011/dsa-2296"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2011/dsa-2297"
},
{
"type": "WEB",
"url": "http://www.mandriva.com/security/advisories?name=MDVSA-2011:127"
},
{
"type": "WEB",
"url": "http://www.mozilla.org/security/announce/2011/mfsa2011-30.html"
},
{
"type": "WEB",
"url": "http://www.redhat.com/support/errata/RHSA-2011-1164.html"
},
{
"type": "WEB",
"url": "http://www.redhat.com/support/errata/RHSA-2011-1166.html"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-Q92J-8JHC-9PM7
Vulnerability from github – Published: 2023-07-28 15:30 – Updated: 2024-04-04 06:25university compass v2.2.0 and below was discovered to contain a code injection vulnerability in the component org.compass.core.executor.DefaultExecutorManager.configure. This vulnerability is exploited via passing an unchecked argument.
{
"affected": [],
"aliases": [
"CVE-2023-39023"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-07-28T15:15:13Z",
"severity": "CRITICAL"
},
"details": "university compass v2.2.0 and below was discovered to contain a code injection vulnerability in the component org.compass.core.executor.DefaultExecutorManager.configure. This vulnerability is exploited via passing an unchecked argument.",
"id": "GHSA-q92j-8jhc-9pm7",
"modified": "2024-04-04T06:25:01Z",
"published": "2023-07-28T15:30:23Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-39023"
},
{
"type": "WEB",
"url": "https://github.com/LetianYuan/My-CVE-Public-References/tree/main/org_compass-project_compass"
}
],
"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-Q92J-GRW3-H492
Vulnerability from github – Published: 2025-03-12 19:28 – Updated: 2025-11-03 21:33Summary
Loading a malicious schema definition in GraphQL::Schema.from_introspection (or GraphQL::Schema::Loader.load) can result in remote code execution. Any system which loads a schema by JSON from an untrusted source is vulnerable, including those that use GraphQL::Client to load external schemas via GraphQL introspection.
{
"affected": [
{
"package": {
"ecosystem": "RubyGems",
"name": "graphql"
},
"ranges": [
{
"events": [
{
"introduced": "2.4.0"
},
{
"fixed": "2.4.13"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "RubyGems",
"name": "graphql"
},
"ranges": [
{
"events": [
{
"introduced": "2.3.0"
},
{
"fixed": "2.3.21"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "RubyGems",
"name": "graphql"
},
"ranges": [
{
"events": [
{
"introduced": "2.2.0"
},
{
"fixed": "2.2.17"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "RubyGems",
"name": "graphql"
},
"ranges": [
{
"events": [
{
"introduced": "2.1.0"
},
{
"fixed": "2.1.15"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "RubyGems",
"name": "graphql"
},
"ranges": [
{
"events": [
{
"introduced": "2.0.0"
},
{
"fixed": "2.0.32"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "RubyGems",
"name": "graphql"
},
"ranges": [
{
"events": [
{
"introduced": "1.13.0"
},
{
"fixed": "1.13.24"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "RubyGems",
"name": "graphql"
},
"ranges": [
{
"events": [
{
"introduced": "1.12.0"
},
{
"fixed": "1.12.25"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "RubyGems",
"name": "graphql"
},
"ranges": [
{
"events": [
{
"introduced": "1.11.5"
},
{
"fixed": "1.11.11"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-27407"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2025-03-12T19:28:00Z",
"nvd_published_at": "2025-03-12T19:15:40Z",
"severity": "CRITICAL"
},
"details": "# Summary\n\nLoading a malicious schema definition in `GraphQL::Schema.from_introspection` (or `GraphQL::Schema::Loader.load`) can result in remote code execution. Any system which loads a schema by JSON from an untrusted source is vulnerable, including those that use [GraphQL::Client](https://github.com/github-community-projects/graphql-client) to load external schemas via GraphQL introspection.",
"id": "GHSA-q92j-grw3-h492",
"modified": "2025-11-03T21:33:11Z",
"published": "2025-03-12T19:28:00Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/rmosolgo/graphql-ruby/security/advisories/GHSA-q92j-grw3-h492"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-27407"
},
{
"type": "WEB",
"url": "https://github.com/rmosolgo/graphql-ruby/commit/28233b16c0eb9d0fb7808f4980e061dc7507c4cd"
},
{
"type": "WEB",
"url": "https://github.com/rmosolgo/graphql-ruby/commit/2d2f4ed1f79472f8eed29c864b039649e1de238f"
},
{
"type": "WEB",
"url": "https://github.com/rmosolgo/graphql-ruby/commit/5c5a7b9a9bdce143be048074aea50edb7bb747be"
},
{
"type": "WEB",
"url": "https://github.com/rmosolgo/graphql-ruby/commit/6eca16b9fa553aa957099a30dbde64ddcdac52ca"
},
{
"type": "WEB",
"url": "https://github.com/rmosolgo/graphql-ruby/commit/d0963289e0dab4ea893bbecf12bb7d89294957bb"
},
{
"type": "WEB",
"url": "https://github.com/rmosolgo/graphql-ruby/commit/d1117ae0361d9ed67e0795b07f5c3e98e62f3c7c"
},
{
"type": "WEB",
"url": "https://github.com/rmosolgo/graphql-ruby/commit/e3b33ace05391da2871c75ab4d3b66e29133b367"
},
{
"type": "WEB",
"url": "https://github.com/rmosolgo/graphql-ruby/commit/e58676c70aa695e3052ba1fbc787efee4ba7d67e"
},
{
"type": "WEB",
"url": "https://about.gitlab.com/releases/2025/03/12/patch-release-gitlab-17-9-2-released"
},
{
"type": "WEB",
"url": "https://github.com/github-community-projects/graphql-client"
},
{
"type": "PACKAGE",
"url": "https://github.com/rmosolgo/graphql-ruby"
},
{
"type": "WEB",
"url": "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/graphql/CVE-2025-27407.yml"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2025/08/msg00002.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "graphql allows remote code execution when loading a crafted GraphQL schema"
}
GHSA-Q937-6MG8-6RGC
Vulnerability from github – Published: 2022-05-14 03:29 – Updated: 2022-05-14 03:29modules/bamegamenu/ajax_phpcode.php in the Responsive Mega Menu (Horizontal+Vertical+Dropdown) Pro module 1.0.32 for PrestaShop 1.5.5.0 through 1.7.2.5 allows remote attackers to execute arbitrary PHP code via the code parameter.
{
"affected": [],
"aliases": [
"CVE-2018-8823"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2018-03-28T02:29:00Z",
"severity": "CRITICAL"
},
"details": "modules/bamegamenu/ajax_phpcode.php in the Responsive Mega Menu (Horizontal+Vertical+Dropdown) Pro module 1.0.32 for PrestaShop 1.5.5.0 through 1.7.2.5 allows remote attackers to execute arbitrary PHP code via the code parameter.",
"id": "GHSA-q937-6mg8-6rgc",
"modified": "2022-05-14T03:29:34Z",
"published": "2022-05-14T03:29:34Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-8823"
},
{
"type": "WEB",
"url": "https://ia-informatica.com/it/CVE-2018-8823"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-Q97P-69VQ-FVH2
Vulnerability from github – Published: 2022-05-17 04:17 – Updated: 2022-05-17 04:17Unrestricted file upload vulnerability in plog-admin/plog-upload.php in Plogger 1.0 RC1 and earlier allows remote authenticated users to execute arbitrary code by uploading a ZIP file that contains a PHP file and a non-zero length PNG file, then accessing the PHP file via a direct request to it in plog-content/uploads/archive/.
{
"affected": [],
"aliases": [
"CVE-2014-2223"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2014-09-11T14:16:00Z",
"severity": "HIGH"
},
"details": "Unrestricted file upload vulnerability in plog-admin/plog-upload.php in Plogger 1.0 RC1 and earlier allows remote authenticated users to execute arbitrary code by uploading a ZIP file that contains a PHP file and a non-zero length PNG file, then accessing the PHP file via a direct request to it in plog-content/uploads/archive/.",
"id": "GHSA-q97p-69vq-fvh2",
"modified": "2022-05-17T04:17:54Z",
"published": "2022-05-17T04:17:54Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2014-2223"
},
{
"type": "WEB",
"url": "https://www.sysdream.com/CVE-2014-2223_CVE-2014-2224"
},
{
"type": "WEB",
"url": "https://www.sysdream.com/system/files/PLOGGER-1.0RC1-advisory.pdf"
},
{
"type": "WEB",
"url": "http://packetstormsecurity.com/files/128029/Plogger-Authenticated-Arbitrary-File-Upload.html"
},
{
"type": "WEB",
"url": "http://seclists.org/oss-sec/2014/q1/443"
},
{
"type": "WEB",
"url": "http://seclists.org/oss-sec/2014/q1/446"
},
{
"type": "WEB",
"url": "http://www.exploit-db.com/exploits/34447"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-Q97Q-GH89-MJ43
Vulnerability from github – Published: 2022-05-17 05:33 – Updated: 2025-04-11 03:52PHP remote file inclusion vulnerability in ardeaCore/lib/core/ardeaInit.php in ardeaCore PHP Framework 2.2 allows remote attackers to execute arbitrary PHP code via a URL in the pathForArdeaCore parameter. NOTE: some of these details are obtained from third party information.
{
"affected": [],
"aliases": [
"CVE-2010-4998"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2011-11-02T21:55:00Z",
"severity": "HIGH"
},
"details": "PHP remote file inclusion vulnerability in ardeaCore/lib/core/ardeaInit.php in ardeaCore PHP Framework 2.2 allows remote attackers to execute arbitrary PHP code via a URL in the pathForArdeaCore parameter. NOTE: some of these details are obtained from third party information.",
"id": "GHSA-q97q-gh89-mj43",
"modified": "2025-04-11T03:52:36Z",
"published": "2022-05-17T05:33:54Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-4998"
},
{
"type": "WEB",
"url": "http://packetstormsecurity.org/1006-exploits/ardeacore-rfi.txt"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/40207"
},
{
"type": "WEB",
"url": "http://securityreason.com/securityalert/8503"
},
{
"type": "WEB",
"url": "http://www.exploit-db.com/exploits/13832"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/40811"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2010/1444"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-Q98G-XP96-F3CM
Vulnerability from github – Published: 2022-05-14 02:37 – Updated: 2022-05-14 02:37PHP remote file inclusion vulnerability in search_wA.php in OpenPro 1.3.1 allows remote attackers to execute arbitrary PHP code via a URL in the LIBPATH parameter.
{
"affected": [],
"aliases": [
"CVE-2008-7087"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2009-08-26T14:24:00Z",
"severity": "HIGH"
},
"details": "PHP remote file inclusion vulnerability in search_wA.php in OpenPro 1.3.1 allows remote attackers to execute arbitrary PHP code via a URL in the LIBPATH parameter.",
"id": "GHSA-q98g-xp96-f3cm",
"modified": "2022-05-14T02:37:45Z",
"published": "2022-05-14T02:37:45Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-7087"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/52898"
},
{
"type": "WEB",
"url": "http://osvdb.org/51466"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/494426/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/30264"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-Q98Q-V2PG-CGX3
Vulnerability from github – Published: 2023-03-14 06:30 – Updated: 2023-03-29 09:30An attacker authenticated as a user with a non-administrative role and a common remote execution authorization in SAP Solution Manager and ABAP managed systems (ST-PI) - versions 2088_1_700, 2008_1_710, 740, can use a vulnerable interface to execute an application function to perform actions which they would not normally be permitted to perform. Depending on the function executed, the attack can read or modify any user or application data and can make the application unavailable.
{
"affected": [],
"aliases": [
"CVE-2023-27893"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-03-14T06:15:00Z",
"severity": "HIGH"
},
"details": "An attacker authenticated as a user with a non-administrative role and a common remote execution authorization in SAP Solution Manager and ABAP managed systems (ST-PI) - versions 2088_1_700, 2008_1_710, 740, can use a vulnerable interface to execute an application function to perform actions which they would not normally be permitted to perform. Depending on the function executed, the attack can read or modify any user or application data and can make the application unavailable.",
"id": "GHSA-q98q-v2pg-cgx3",
"modified": "2023-03-29T09:30:32Z",
"published": "2023-03-14T06:30:16Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-27893"
},
{
"type": "WEB",
"url": "https://launchpad.support.sap.com/#/notes/3296476"
},
{
"type": "WEB",
"url": "https://www.sap.com/documents/2022/02/fa865ea4-167e-0010-bca6-c68f7e60039b.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"
}
]
}
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.