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.
8379 vulnerabilities reference this CWE, most recent first.
GHSA-446C-58C3-Q6JP
Vulnerability from github – Published: 2022-05-13 01:19 – Updated: 2022-05-13 01:19IBM WebSphere Commerce 9.0.0.0 through 9.0.0.6 could allow some server-side code injection due to inadequate input control. IBM X-Force ID: 149828.
{
"affected": [],
"aliases": [
"CVE-2018-1808"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2018-11-13T15:29:00Z",
"severity": "HIGH"
},
"details": "IBM WebSphere Commerce 9.0.0.0 through 9.0.0.6 could allow some server-side code injection due to inadequate input control. IBM X-Force ID: 149828.",
"id": "GHSA-446c-58c3-q6jp",
"modified": "2022-05-13T01:19:32Z",
"published": "2022-05-13T01:19:32Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-1808"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/149828"
},
{
"type": "WEB",
"url": "https://www-01.ibm.com/support/docview.wss?uid=ibm10735905"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id/1042034"
}
],
"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-447V-97C3-8W6X
Vulnerability from github – Published: 2022-05-17 04:16 – Updated: 2022-05-17 04:16The client in iPass Open Mobile before 2.4.5 on Windows allows remote authenticated users to execute arbitrary code via a DLL pathname in a crafted Unicode string that is improperly handled by a subprocess reached through a named pipe, as demonstrated by a UNC share pathname.
{
"affected": [],
"aliases": [
"CVE-2015-0925"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2015-01-22T14:02:00Z",
"severity": "HIGH"
},
"details": "The client in iPass Open Mobile before 2.4.5 on Windows allows remote authenticated users to execute arbitrary code via a DLL pathname in a crafted Unicode string that is improperly handled by a subprocess reached through a named pipe, as demonstrated by a UNC share pathname.",
"id": "GHSA-447v-97c3-8w6x",
"modified": "2022-05-17T04:16:57Z",
"published": "2022-05-17T04:16:57Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2015-0925"
},
{
"type": "WEB",
"url": "http://www.kb.cert.org/vuls/id/110652"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-44G8-Q969-2XJ9
Vulnerability from github – Published: 2022-05-17 02:09 – Updated: 2022-05-17 02:09PHP remote file inclusion vulnerability in include/template.php in Uiga Proxy, when register_globals is enabled, allows remote attackers to execute arbitrary PHP code via a URL in the content parameter.
{
"affected": [],
"aliases": [
"CVE-2010-1528"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-04-26T18:30:00Z",
"severity": "MODERATE"
},
"details": "PHP remote file inclusion vulnerability in include/template.php in Uiga Proxy, when register_globals is enabled, allows remote attackers to execute arbitrary PHP code via a URL in the content parameter.",
"id": "GHSA-44g8-q969-2xj9",
"modified": "2022-05-17T02:09:09Z",
"published": "2022-05-17T02:09:09Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-1528"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/57515"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/39313"
},
{
"type": "WEB",
"url": "http://www.exploit-db.com/exploits/12049"
},
{
"type": "WEB",
"url": "http://www.osvdb.org/63528"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/39365"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-44GX-XMFM-5XJV
Vulnerability from github – Published: 2022-05-01 23:28 – Updated: 2022-05-01 23:28PHP remote file inclusion vulnerability in VisionBurst vcart 3.3.2 allows remote attackers to execute arbitrary PHP code via a URL in the abs_path parameter to (1) index.php and (2) checkout.php.
{
"affected": [],
"aliases": [
"CVE-2008-0287"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-01-16T02:00:00Z",
"severity": "MODERATE"
},
"details": "PHP remote file inclusion vulnerability in VisionBurst vcart 3.3.2 allows remote attackers to execute arbitrary PHP code via a URL in the abs_path parameter to (1) index.php and (2) checkout.php.",
"id": "GHSA-44gx-xmfm-5xjv",
"modified": "2022-05-01T23:28:51Z",
"published": "2022-05-01T23:28:51Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-0287"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/39616"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/4889"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/28424"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/27231"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-44HJ-4M45-FRJ3
Vulnerability from github – Published: 2026-06-26 16:32 – Updated: 2026-06-26 16:32Fluentd allows dynamically constructing file paths using the ${tag} placeholder.
It was discovered that validation for this placeholder was insufficient.
If a Fluentd instance is configured to receive logs from untrusted sources and uses the ${tag} placeholder in file configurations (such as the path parameter in the out_file plugin), an attacker can inject path traversal characters (e.g., ../).
When combined with certain formatting options, this vulnerability allows an attacker to write arbitrary files or overwrite existing files on the system with attacker-controlled content, bypassing intended directory restrictions.
Impact
This vulnerability allows for Arbitrary File Write, which can be directly escalated to full Remote Code Execution (RCE). An attacker could achieve RCE by overwriting critical system files, injecting executable plugins, or modifying configuration files. The impact is Critical as it can lead to full system compromise without any authentication, depending on the Fluentd configuration and the privileges of the Fluentd process.
Patches
v1.19.3
Workarounds
If an immediate upgrade is not possible, users are strongly advised to apply the following mitigations:
- Restrict Network Access
- Ensure that Fluentd input ports (such as
in_forwardon default port24224) are deployed within a closed, trusted network. Use firewall rules (e.g., iptables, AWS Security Groups) to block access from untrusted networks or instances. - Run Fluentd as a non-root user
- Dropping privileges prevents Fluentd from writing to sensitive system directories (e.g.,
/etc/), significantly mitigating the risk of system-wide RCE. - Revise configurations
- Do not use the
${tag}placeholder in thepathparameter of output plugins (likeout_file) if the tag originates from an untrusted source. - Filter incoming tags
- Strictly validate and filter incoming tags at the input layer (e.g., using
fluent-plugin-rewrite-tag-filter) to drop any tags containing.or/characters.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 1.19.2"
},
"package": {
"ecosystem": "RubyGems",
"name": "fluentd"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.19.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-44024"
],
"database_specific": {
"cwe_ids": [
"CWE-22",
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2026-06-26T16:32:05Z",
"nvd_published_at": null,
"severity": "CRITICAL"
},
"details": "Fluentd allows dynamically constructing file paths using the `${tag}` placeholder.\nIt was discovered that validation for this placeholder was insufficient.\n\nIf a Fluentd instance is configured to receive logs from untrusted sources and uses the `${tag}` placeholder in file configurations (such as the `path` parameter in the `out_file` plugin), an attacker can inject path traversal characters (e.g., `../`).\n\nWhen combined with certain formatting options, this vulnerability allows an attacker to write arbitrary files or overwrite existing files on the system with attacker-controlled content, bypassing intended directory restrictions.\n\n### Impact\nThis vulnerability allows for **Arbitrary File Write**, which can be directly escalated to full **Remote Code Execution (RCE)**.\nAn attacker could achieve RCE by overwriting critical system files, injecting executable plugins, or modifying configuration files.\nThe impact is Critical as it can lead to full system compromise without any authentication, depending on the Fluentd configuration and the privileges of the Fluentd process.\n\n### Patches\nv1.19.3\n\n### Workarounds\nIf an immediate upgrade is not possible, users are strongly advised to apply the following mitigations:\n\n1. Restrict Network Access\n * Ensure that Fluentd input ports (such as `in_forward` on default port `24224`) are deployed within a closed, trusted network. Use firewall rules (e.g., iptables, AWS Security Groups) to block access from untrusted networks or instances.\n2. Run Fluentd as a non-root user\n * Dropping privileges prevents Fluentd from writing to sensitive system directories (e.g., `/etc/`), significantly mitigating the risk of system-wide RCE.\n3. Revise configurations\n * Do not use the `${tag}` placeholder in the `path` parameter of output plugins (like `out_file`) if the tag originates from an untrusted source.\n4. Filter incoming tags\n * Strictly validate and filter incoming tags at the input layer (e.g., using `fluent-plugin-rewrite-tag-filter`) to drop any tags containing `.` or `/` characters.",
"id": "GHSA-44hj-4m45-frj3",
"modified": "2026-06-26T16:32:05Z",
"published": "2026-06-26T16:32:05Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/fluent/fluentd/security/advisories/GHSA-44hj-4m45-frj3"
},
{
"type": "PACKAGE",
"url": "https://github.com/fluent/fluentd"
},
{
"type": "WEB",
"url": "https://github.com/fluent/fluentd/releases/tag/v1.19.3"
}
],
"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": "Fluentd is Vulnerable to Remote Code Execution (RCE) via Arbitrary File Write in `${tag}` Placeholder"
}
GHSA-44PW-F9WR-W46W
Vulnerability from github – Published: 2022-05-02 03:45 – Updated: 2022-05-02 03:45Adobe Shockwave Player before 11.5.2.602 allows remote attackers to execute arbitrary code via crafted Shockwave content on a web site, related to an "invalid pointer vulnerability," a different issue than CVE-2009-3464. NOTE: some of these details are obtained from third party information.
{
"affected": [],
"aliases": [
"CVE-2009-3465"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2009-11-04T15:30:00Z",
"severity": "HIGH"
},
"details": "Adobe Shockwave Player before 11.5.2.602 allows remote attackers to execute arbitrary code via crafted Shockwave content on a web site, related to an \"invalid pointer vulnerability,\" a different issue than CVE-2009-3464. NOTE: some of these details are obtained from third party information.",
"id": "GHSA-44pw-f9wr-w46w",
"modified": "2022-05-02T03:45:28Z",
"published": "2022-05-02T03:45:28Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2009-3465"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/54120"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A5722"
},
{
"type": "WEB",
"url": "http://securitytracker.com/id?1023123"
},
{
"type": "WEB",
"url": "http://www.adobe.com/support/security/bulletins/apsb09-16.html"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/36905"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2009/3134"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-44QV-X6F8-2JWM
Vulnerability from github – Published: 2022-12-22 12:30 – Updated: 2022-12-29 18:30In JetBrains IntelliJ IDEA before 2022.3.1 code Templates were vulnerable to SSTI attacks.
{
"affected": [],
"aliases": [
"CVE-2022-47896"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-12-22T11:15:00Z",
"severity": "HIGH"
},
"details": "In JetBrains IntelliJ IDEA before 2022.3.1 code Templates were vulnerable to SSTI attacks.",
"id": "GHSA-44qv-x6f8-2jwm",
"modified": "2022-12-29T18:30:24Z",
"published": "2022-12-22T12:30:16Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-47896"
},
{
"type": "WEB",
"url": "https://www.jetbrains.com/privacy-security/issues-fixed"
}
],
"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-44V6-JHGM-P3M4
Vulnerability from github – Published: 2026-04-29 21:21 – Updated: 2026-05-08 01:31Impact
An authenticated user with permission to create or modify workflows containing a Python Code Node could escape the sandbox and achieve arbitrary code execution on the task runner container.
- This issue only affects instances where the Python Task Runner is enabled.
Patches
The issue has been fixed in n8n versions 1.123.32, 2.17.4, and 2.18.1. Users should upgrade to one of these versions or later to remediate the vulnerability.
Workarounds
If upgrading is not immediately possible, administrators should consider the following temporary mitigations:
- Limit workflow creation and editing permissions to fully trusted users only.
- Disable the Python Code node by adding n8n-nodes-base.code to the NODES_EXCLUDE environment variable, or disable the Python Task Runner entirely.
These workarounds do not fully remediate the risk and should only be used as short-term mitigation measures.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "n8n"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.123.32"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "npm",
"name": "n8n"
},
"ranges": [
{
"events": [
{
"introduced": "2.18.0"
},
{
"fixed": "2.18.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "npm",
"name": "n8n"
},
"ranges": [
{
"events": [
{
"introduced": "2.17.0"
},
{
"fixed": "2.17.4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-42234"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2026-04-29T21:21:50Z",
"nvd_published_at": "2026-05-04T19:16:06Z",
"severity": "HIGH"
},
"details": "## Impact\nAn authenticated user with permission to create or modify workflows containing a Python Code Node could escape the sandbox and achieve arbitrary code execution on the task runner container.\n\n- This issue only affects instances where the Python Task Runner is enabled.\n\n## Patches\nThe issue has been fixed in n8n versions 1.123.32, 2.17.4, and 2.18.1. Users should upgrade to one of these versions or later to remediate the vulnerability.\n\n## Workarounds\nIf upgrading is not immediately possible, administrators should consider the following temporary mitigations:\n- Limit workflow creation and editing permissions to fully trusted users only.\n- Disable the Python Code node by adding `n8n-nodes-base.code` to the `NODES_EXCLUDE` environment variable, or disable the Python Task Runner entirely.\n\nThese workarounds do not fully remediate the risk and should only be used as short-term mitigation measures.",
"id": "GHSA-44v6-jhgm-p3m4",
"modified": "2026-05-08T01:31:22Z",
"published": "2026-04-29T21:21:50Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/n8n-io/n8n/security/advisories/GHSA-44v6-jhgm-p3m4"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-42234"
},
{
"type": "PACKAGE",
"url": "https://github.com/n8n-io/n8n"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "n8n has a Python Task Runner Sandbox Escape Vulnerability"
}
GHSA-44VG-5WV2-H2HG
Vulnerability from github – Published: 2026-03-13 20:56 – Updated: 2026-06-08 19:47Impact
If the objects passed in as names to SimpleEval have modules or other disallowed / dangerous objects available as attrs.
Additionally, dangerous functions or modules could be accessed by passing them as callbacks to other safe functions to call.
Examples (found by @ByamB4):
Any module where non-underscore attribute chains reach os or sys: - os.path, pathlib, shutil, glob (direct .os / .sys attributes) - statistics (has .sys) - numpy (has .ctypeslib.os and .f2py.sys) - urllib.parse (has .warnings.sys)
Patches
The latest version 1.0.5 has this issue fixed.
Workarounds
Don't pass in objects or modules which have direct attributes to potentially dangerous items. Use a wrapper to wrap the potentially vulnerable items (See the ModuleWrapper in version 1.0.5)
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "simpleeval"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.0.5"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-32640"
],
"database_specific": {
"cwe_ids": [
"CWE-915",
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2026-03-13T20:56:26Z",
"nvd_published_at": "2026-03-16T14:19:40Z",
"severity": "HIGH"
},
"details": "### Impact\nIf the objects passed in as `names` to SimpleEval have modules or other disallowed / dangerous objects available as attrs.\nAdditionally, dangerous functions or modules could be accessed by passing them as callbacks to other safe functions to call.\n\nExamples (found by @ByamB4):\n\nAny module where non-underscore attribute chains reach os or sys:\n- os.path, pathlib, shutil, glob (direct .os / .sys attributes)\n- statistics (has .sys)\n- numpy (has .ctypeslib.os and .f2py.sys)\n- urllib.parse (has .warnings.sys)\n\n### Patches\nThe latest version 1.0.5 has this issue fixed.\n\n### Workarounds\nDon\u0027t pass in objects or modules which have direct attributes to potentially dangerous items.\nUse a wrapper to wrap the potentially vulnerable items (See the ModuleWrapper in version 1.0.5)",
"id": "GHSA-44vg-5wv2-h2hg",
"modified": "2026-06-08T19:47:08Z",
"published": "2026-03-13T20:56:26Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/danthedeckie/simpleeval/security/advisories/GHSA-44vg-5wv2-h2hg"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-32640"
},
{
"type": "PACKAGE",
"url": "https://github.com/danthedeckie/simpleeval"
},
{
"type": "WEB",
"url": "https://github.com/danthedeckie/simpleeval/releases/tag/1.0.5"
},
{
"type": "WEB",
"url": "https://github.com/pypa/advisory-database/tree/main/vulns/simpleeval/PYSEC-2026-132.yaml"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2026/04/msg00023.html"
}
],
"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"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "SimpleEval: Objects (including modules) can leak dangerous modules through to direct access inside the sandbox"
}
GHSA-4522-GJ56-9PV6
Vulnerability from github – Published: 2022-05-24 17:11 – Updated: 2022-05-24 17:11An issue was discovered in ONAP SDC through Dublin. By accessing port 6000 of demo-sdc-sdc-fe pod, an unauthenticated attacker (who already has access to pod-to-pod communication) may execute arbitrary code inside that pod. All ONAP Operations Manager (OOM) setups are affected.
{
"affected": [],
"aliases": [
"CVE-2019-12116"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2020-03-18T19:15:00Z",
"severity": "HIGH"
},
"details": "An issue was discovered in ONAP SDC through Dublin. By accessing port 6000 of demo-sdc-sdc-fe pod, an unauthenticated attacker (who already has access to pod-to-pod communication) may execute arbitrary code inside that pod. All ONAP Operations Manager (OOM) setups are affected.",
"id": "GHSA-4522-gj56-9pv6",
"modified": "2022-05-24T17:11:46Z",
"published": "2022-05-24T17:11:46Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2019-12116"
},
{
"type": "WEB",
"url": "https://jira.onap.org/browse/OJSI-10"
}
],
"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.