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.
8321 vulnerabilities reference this CWE, most recent first.
GHSA-C4GH-RV8H-Q9VW
Vulnerability from github – Published: 2026-07-17 19:53 – Updated: 2026-07-17 19:53Summary
The TypeScript Prompty loader used gray-matter without overriding executable frontmatter engines. gray-matter supports JavaScript frontmatter blocks such as ---js and evaluates them while parsing. An attacker-controlled .prompty file could therefore execute arbitrary JavaScript during prompt loading.
Affected package
- npm
@prompty/corev2 prerelease line:>= 2.0.0-alpha.1 < 2.0.0-beta.3 - Fixed in
@prompty/core@2.0.0-beta.3
The legacy v1 JavaScript runtime had a historical hardening change for this issue. During the v2 TypeScript runtime rebuild, the loader again called gray-matter directly and the vulnerable behavior was present in the v2 prerelease packages until 2.0.0-beta.3.
Impact
Applications that load untrusted .prompty files, user-provided prompt paths, or prompt bundles from less-trusted locations could execute arbitrary JavaScript in the host Node.js process during frontmatter parsing.
Remediation
Upgrade @prompty/core to 2.0.0-beta.3 or later.
The fix explicitly overrides the js and javascript gray-matter engines and rejects JavaScript frontmatter in .prompty files. Prompty frontmatter is YAML-only; executable frontmatter is unsupported. A regression test now verifies that ---js frontmatter is rejected and not evaluated.
Fix details
Fixed by commit c27402da2487075be577f06aa79df627fb9d6853 and released via typescript/2.0.0-beta.3.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@prompty/core"
},
"ranges": [
{
"events": [
{
"introduced": "2.0.0-alpha.1"
},
{
"fixed": "2.0.0-beta.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-53597"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2026-07-17T19:53:34Z",
"nvd_published_at": "2026-07-16T16:19:12Z",
"severity": "HIGH"
},
"details": "## Summary\nThe TypeScript Prompty loader used `gray-matter` without overriding executable frontmatter engines. `gray-matter` supports JavaScript frontmatter blocks such as `---js` and evaluates them while parsing. An attacker-controlled `.prompty` file could therefore execute arbitrary JavaScript during prompt loading.\n\n## Affected package\n- npm `@prompty/core` v2 prerelease line: `\u003e= 2.0.0-alpha.1 \u003c 2.0.0-beta.3`\n- Fixed in `@prompty/core@2.0.0-beta.3`\n\nThe legacy v1 JavaScript runtime had a historical hardening change for this issue. During the v2 TypeScript runtime rebuild, the loader again called `gray-matter` directly and the vulnerable behavior was present in the v2 prerelease packages until `2.0.0-beta.3`.\n\n## Impact\nApplications that load untrusted `.prompty` files, user-provided prompt paths, or prompt bundles from less-trusted locations could execute arbitrary JavaScript in the host Node.js process during frontmatter parsing.\n\n## Remediation\nUpgrade `@prompty/core` to `2.0.0-beta.3` or later.\n\nThe fix explicitly overrides the `js` and `javascript` gray-matter engines and rejects JavaScript frontmatter in `.prompty` files. Prompty frontmatter is YAML-only; executable frontmatter is unsupported. A regression test now verifies that `---js` frontmatter is rejected and not evaluated.\n\n## Fix details\nFixed by commit `c27402da2487075be577f06aa79df627fb9d6853` and released via `typescript/2.0.0-beta.3`.",
"id": "GHSA-c4gh-rv8h-q9vw",
"modified": "2026-07-17T19:53:34Z",
"published": "2026-07-17T19:53:34Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/microsoft/prompty/security/advisories/GHSA-c4gh-rv8h-q9vw"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-53597"
},
{
"type": "WEB",
"url": "https://github.com/microsoft/prompty/commit/c27402da2487075be577f06aa79df627fb9d6853"
},
{
"type": "PACKAGE",
"url": "https://github.com/microsoft/prompty"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Prompty: Arbitrary code execution via JavaScript frontmatter in TypeScript loader"
}
GHSA-C4GR-3X85-J99F
Vulnerability from github – Published: 2025-02-07 03:32 – Updated: 2025-02-11 00:31An issue in deep-diver LLM-As-Chatbot before commit 99c2c03 allows a remote attacker to execute arbitrary code via the modelsbyom.py component.
{
"affected": [],
"aliases": [
"CVE-2024-55241"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-02-06T22:15:38Z",
"severity": "MODERATE"
},
"details": "An issue in deep-diver LLM-As-Chatbot before commit 99c2c03 allows a remote attacker to execute arbitrary code via the modelsbyom.py component.",
"id": "GHSA-c4gr-3x85-j99f",
"modified": "2025-02-11T00:31:47Z",
"published": "2025-02-07T03:32:02Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-55241"
},
{
"type": "WEB",
"url": "https://diamond-bath-fd4.notion.site/Remote-Code-Execution-vulnerability-in-load_model-in-deep-diver-LLM-As-Chatbot-14d4a5b4bb28806795e8e5e8ef9ae27b"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-C4JF-V948-GHJ9
Vulnerability from github – Published: 2023-09-11 09:31 – Updated: 2024-04-04 07:34The wave.ai.browser application through 1.0.35 for Android allows a remote attacker to execute arbitrary JavaScript code via a crafted intent. It contains a manifest entry that exports the wave.ai.browser.ui.splash.SplashScreen activity. This activity uses a WebView component to display web content and doesn't adequately validate or sanitize the URI or any extra data passed in the intent by a third party application (with no permissions).
{
"affected": [],
"aliases": [
"CVE-2023-42471"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-09-11T08:15:07Z",
"severity": "CRITICAL"
},
"details": "The wave.ai.browser application through 1.0.35 for Android allows a remote attacker to execute arbitrary JavaScript code via a crafted intent. It contains a manifest entry that exports the wave.ai.browser.ui.splash.SplashScreen activity. This activity uses a WebView component to display web content and doesn\u0027t adequately validate or sanitize the URI or any extra data passed in the intent by a third party application (with no permissions).",
"id": "GHSA-c4jf-v948-ghj9",
"modified": "2024-04-04T07:34:38Z",
"published": "2023-09-11T09:31:44Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-42471"
},
{
"type": "WEB",
"url": "https://github.com/actuator/cve/blob/main/CVE-2023-42471"
},
{
"type": "WEB",
"url": "https://github.com/actuator/wave.ai.browser/blob/main/CWE-94.md"
},
{
"type": "WEB",
"url": "https://github.com/actuator/wave.ai.browser/blob/main/poc.apk"
}
],
"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-C4P5-W53Q-QMGH
Vulnerability from github – Published: 2022-05-14 02:39 – Updated: 2022-05-14 02:39** DISPUTED ** Argument injection vulnerability in Google Chrome 1.0.154.36 on Windows XP SP3 allows remote attackers to execute arbitrary commands via the --renderer-path option in a chromehtml: URI. NOTE: a third party disputes this issue, stating that Chrome "will ask for user permission" and "cannot launch the applet even [if] you have given out the permission."
{
"affected": [],
"aliases": [
"CVE-2008-5749"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-12-29T15:24:00Z",
"severity": "MODERATE"
},
"details": "** DISPUTED ** Argument injection vulnerability in Google Chrome 1.0.154.36 on Windows XP SP3 allows remote attackers to execute arbitrary commands via the --renderer-path option in a chromehtml: URI. NOTE: a third party disputes this issue, stating that Chrome \"will ask for user permission\" and \"cannot launch the applet even [if] you have given out the permission.\"",
"id": "GHSA-c4p5-w53q-qmgh",
"modified": "2022-05-14T02:39:19Z",
"published": "2022-05-14T02:39:19Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-5749"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/7566"
},
{
"type": "WEB",
"url": "http://retrogod.altervista.org/9sg_chrome.html"
},
{
"type": "WEB",
"url": "http://securityreason.com/securityalert/4821"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/499570/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/499581/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/499616/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/32997"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-C4P9-95WG-Q39W
Vulnerability from github – Published: 2024-09-09 21:31 – Updated: 2024-09-10 15:31D-Link DI-8300 v16.07.26A1 is vulnerable to command injection via the msp_info_htm function.
{
"affected": [],
"aliases": [
"CVE-2024-44411"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-09-09T21:15:11Z",
"severity": "CRITICAL"
},
"details": "D-Link DI-8300 v16.07.26A1 is vulnerable to command injection via the msp_info_htm function.",
"id": "GHSA-c4p9-95wg-q39w",
"modified": "2024-09-10T15:31:04Z",
"published": "2024-09-09T21:31:23Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-44411"
},
{
"type": "WEB",
"url": "https://github.com/LYaoBoL/IOTsec/blob/main/D-Link/DI-8300A1/CVE-2024-44411"
},
{
"type": "WEB",
"url": "https://github.com/LYaoBoL/IOTsec/blob/main/D-Link/DI-8300A1/DI-8300A1-2.md"
},
{
"type": "WEB",
"url": "https://www.dlink.com/en/security-bulletin"
}
],
"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-C4PG-5GGH-VCPP
Vulnerability from github – Published: 2024-01-19 21:30 – Updated: 2026-01-22 20:30Duplicate Advisory
This advisory has been withdrawn because it is a duplicate of GHSA-98hq-4wmw-98w9. This link is maintained to preserve external references.
Original Description
Artemis Java Test Sandbox versions before 1.11.2 are vulnerable to a sandbox escape when an attacker loads untrusted libraries using System.load or System.loadLibrary. An attacker can abuse this issue to execute arbitrary Java when a victim executes the supposedly sandboxed code.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "de.tum.in.ase:artemis-java-test-sandbox"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.11.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-284",
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2024-01-22T21:25:12Z",
"nvd_published_at": "2024-01-19T21:15:10Z",
"severity": "HIGH"
},
"details": "## Duplicate Advisory\nThis advisory has been withdrawn because it is a duplicate of GHSA-98hq-4wmw-98w9. This link is maintained to preserve external references.\n\n## Original Description\nArtemis Java Test Sandbox versions before 1.11.2 are vulnerable to a sandbox escape when an attacker loads untrusted libraries using System.load or System.loadLibrary. An attacker can abuse this issue to execute arbitrary Java when a victim executes the supposedly sandboxed code.",
"id": "GHSA-c4pg-5ggh-vcpp",
"modified": "2026-01-22T20:30:53Z",
"published": "2024-01-19T21:30:36Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/ls1intum/Ares/security/advisories/GHSA-98hq-4wmw-98w9"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-23681"
},
{
"type": "ADVISORY",
"url": "https://github.com/advisories/GHSA-98hq-4wmw-98w9"
},
{
"type": "PACKAGE",
"url": "https://github.com/ls1intum/Ares"
},
{
"type": "WEB",
"url": "https://vulncheck.com/advisories/vc-advisory-GHSA-98hq-4wmw-98w9"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Duplicate Advisory: Sandbox escape in Artemis Java Test Sandbox",
"withdrawn": "2026-01-22T20:30:53Z"
}
GHSA-C4Q8-68WP-MG94
Vulnerability from github – Published: 2022-05-02 03:45 – Updated: 2022-05-02 03:45Multiple PHP remote file inclusion vulnerabilities in justVisual 1.2 allow remote attackers to execute arbitrary PHP code via a URL in the fs_jVroot parameter to (1) sites/site/pages/index.php, (2) sites/test/pages/contact.php, (3) system/pageTemplate.php, and (4) system/utilities.php.
{
"affected": [],
"aliases": [
"CVE-2009-3511"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2009-10-01T14:30:00Z",
"severity": "HIGH"
},
"details": "Multiple PHP remote file inclusion vulnerabilities in justVisual 1.2 allow remote attackers to execute arbitrary PHP code via a URL in the fs_jVroot parameter to (1) sites/site/pages/index.php, (2) sites/test/pages/contact.php, (3) system/pageTemplate.php, and (4) system/utilities.php.",
"id": "GHSA-c4q8-68wp-mg94",
"modified": "2022-05-02T03:45:57Z",
"published": "2022-05-02T03:45:57Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2009-3511"
},
{
"type": "WEB",
"url": "http://www.exploit-db.com/exploits/9308"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-C4R5-FXQW-VH93
Vulnerability from github – Published: 2026-03-27 19:43 – Updated: 2026-03-31 18:41Summary
The rubyLsp.branch VS Code workspace setting was interpolated without sanitization into a generated Gemfile, allowing arbitrary Ruby code execution when a user opens a project containing a malicious .vscode/settings.json.
Other editors that support workspace setting that get automatically applied upon opening the editor and trusting the workspace are also impacted since the server is the component that performs the interpolation.
Details
The branch CLI argument passed to the ruby-lsp server was interpolated in the generated .ruby-lsp/Gemfile without sanitization. Editors that allow defining settings saved at the workspace level (e.g.: .vscode/settings.json) that gets automatically applied open the possibility to craft a malicious repository that once opened and trusted in the editor would run arbitrary code.
Impact
Code execution with the privileges of the user who opens the malicious project. Ruby LSP assumes workspace code is trusted and so opening the editor on an untrusted workspace can lead to executing potentially dangerous code.
Remediation
The rubyLsp.branch setting has been removed entirely. VS Code extensions auto-update by default, so most users will receive the fix without action. Users who have disabled auto-updates should update to extension version >= 0.10.2.
The branch CLI flag was also entirely removed from the ruby-lsp gem. For users that don't add ruby-lsp to their Gemfiles, the server should auto-update. Users with the ruby-lsp in the Gemfile and locked to a specific version should update to >= 0.26.9.
{
"affected": [
{
"package": {
"ecosystem": "RubyGems",
"name": "ruby-lsp"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.26.9"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-34060"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2026-03-27T19:43:14Z",
"nvd_published_at": "2026-03-31T03:15:58Z",
"severity": "HIGH"
},
"details": "**Summary**\n\nThe `rubyLsp.branch` VS Code workspace setting was interpolated without sanitization into a generated Gemfile, allowing arbitrary Ruby code execution when a user opens a project containing a malicious `.vscode/settings.json`.\n\nOther editors that support workspace setting that get automatically applied upon opening the editor and trusting the workspace are also impacted since the server is the component that performs the interpolation.\n\n**Details**\n\nThe `branch` CLI argument passed to the `ruby-lsp` server was interpolated in the generated `.ruby-lsp/Gemfile` without sanitization. Editors that allow defining settings saved at the workspace level (e.g.: `.vscode/settings.json`) that gets automatically applied open the possibility to craft a malicious repository that once opened and trusted in the editor would run arbitrary code.\n\n**Impact**\n\nCode execution with the privileges of the user who opens the malicious project. Ruby LSP assumes workspace code is trusted and so opening the editor on an untrusted workspace can lead to executing potentially dangerous code.\n\n**Remediation**\n\nThe `rubyLsp.branch` setting has been removed entirely. VS Code extensions auto-update by default, so most users will receive the fix without action. Users who have disabled auto-updates should update to extension version \u003e= 0.10.2.\n\nThe `branch` CLI flag was also entirely removed from the `ruby-lsp` gem. For users that don\u0027t add `ruby-lsp` to their Gemfiles, the server should auto-update. Users with the `ruby-lsp` in the Gemfile and locked to a specific version should update to \u003e= 0.26.9.",
"id": "GHSA-c4r5-fxqw-vh93",
"modified": "2026-03-31T18:41:33Z",
"published": "2026-03-27T19:43:14Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/Shopify/ruby-lsp/security/advisories/GHSA-c4r5-fxqw-vh93"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-34060"
},
{
"type": "PACKAGE",
"url": "https://github.com/Shopify/ruby-lsp"
},
{
"type": "WEB",
"url": "https://github.com/Shopify/ruby-lsp/releases/tag/v0.26.9"
},
{
"type": "WEB",
"url": "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/ruby-lsp/CVE-2026-34060.yml"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Ruby LSP has arbitrary code execution through branch setting"
}
GHSA-C4VQ-6W73-6RM7
Vulnerability from github – Published: 2024-04-04 00:33 – Updated: 2024-08-28 21:31Cross Site Scripting vulnerability in Leantime v3.0.6 allows attackers to execute arbitrary code via upload of crafted PDF file to the files/browse endpoint.
{
"affected": [],
"aliases": [
"CVE-2024-27705"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-04-03T22:15:06Z",
"severity": "HIGH"
},
"details": "Cross Site Scripting vulnerability in Leantime v3.0.6 allows attackers to execute arbitrary code via upload of crafted PDF file to the files/browse endpoint.",
"id": "GHSA-c4vq-6w73-6rm7",
"modified": "2024-08-28T21:31:27Z",
"published": "2024-04-04T00:33:10Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-27705"
},
{
"type": "WEB",
"url": "https://github.com/b-hermes/vulnerability-research/tree/main/CVE-2024-27705"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L",
"type": "CVSS_V3"
}
]
}
GHSA-C4W7-GHH7-WP3J
Vulnerability from github – Published: 2022-05-01 18:39 – Updated: 2022-05-01 18:39PHP remote file inclusion vulnerability in index.php in datecomm Social Networking Script (aka Myspace Clone Script) allows remote attackers to execute arbitrary PHP code via a URL in the pg parameter.
{
"affected": [],
"aliases": [
"CVE-2007-6057"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2007-11-20T20:46:00Z",
"severity": "MODERATE"
},
"details": "PHP remote file inclusion vulnerability in index.php in datecomm Social Networking Script (aka Myspace Clone Script) allows remote attackers to execute arbitrary PHP code via a URL in the pg parameter.",
"id": "GHSA-c4w7-ghh7-wp3j",
"modified": "2022-05-01T18:39:10Z",
"published": "2022-05-01T18:39:10Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2007-6057"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/38539"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/4628"
},
{
"type": "WEB",
"url": "http://marc.info/?l=bugtraq\u0026m=119531803703691\u0026w=2"
},
{
"type": "WEB",
"url": "http://osvdb.org/38733"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/27723"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/26607"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2007/3905"
}
],
"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.