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.
8287 vulnerabilities reference this CWE, most recent first.
GHSA-J738-8H8Q-6X25
Vulnerability from github – Published: 2022-05-02 06:19 – Updated: 2022-05-02 06:19Unspecified vulnerability in Safari 4 on Apple Mac OS X 10.6 allows remote attackers to execute arbitrary code via unknown vectors, as demonstrated by Charlie Miller during a Pwn2Own competition at CanSecWest 2010.
{
"affected": [],
"aliases": [
"CVE-2010-1120"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-03-25T21:00:00Z",
"severity": "HIGH"
},
"details": "Unspecified vulnerability in Safari 4 on Apple Mac OS X 10.6 allows remote attackers to execute arbitrary code via unknown vectors, as demonstrated by Charlie Miller during a Pwn2Own competition at CanSecWest 2010.",
"id": "GHSA-j738-8h8q-6x25",
"modified": "2022-05-02T06:19:11Z",
"published": "2022-05-02T06:19:11Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-1120"
},
{
"type": "WEB",
"url": "http://dvlabs.tippingpoint.com/blog/2010/02/15/pwn2own-2010"
},
{
"type": "WEB",
"url": "http://news.cnet.com/8301-27080_3-20001126-245.html"
},
{
"type": "WEB",
"url": "http://twitter.com/thezdi/statuses/11002504493"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-J739-G4JP-G7R6
Vulnerability from github – Published: 2025-04-03 21:32 – Updated: 2025-04-04 18:30insightsoftware Spark JDBC 2.6.21 has a remote code execution vulnerability. Attackers can inject malicious parameters into the JDBC URL, triggering JNDI injection during the process when the JDBC Driver uses this URL to connect to the database. This can further lead to remote code execution.
{
"affected": [],
"aliases": [
"CVE-2024-45198"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-04-03T20:15:23Z",
"severity": "HIGH"
},
"details": "insightsoftware Spark JDBC 2.6.21 has a remote code execution vulnerability. Attackers can inject malicious parameters into the JDBC URL, triggering JNDI injection during the process when the JDBC Driver uses this URL to connect to the database. This can further lead to remote code execution.",
"id": "GHSA-j739-g4jp-g7r6",
"modified": "2025-04-04T18:30:53Z",
"published": "2025-04-03T21:32:59Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-45198"
},
{
"type": "WEB",
"url": "https://gist.github.com/azraelxuemo/ef11311ae0633cbd3d794f73c64e3877"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-J744-J5X2-W49P
Vulnerability from github – Published: 2022-02-09 00:00 – Updated: 2022-02-09 00:00iCMS <= 8.0.0 allows users to add and render a comtom template, which has a SSTI vulnerability which causes remote code execution.
{
"affected": [],
"aliases": [
"CVE-2021-44978"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-02-04T16:15:00Z",
"severity": "CRITICAL"
},
"details": "iCMS \u003c= 8.0.0 allows users to add and render a comtom template, which has a SSTI vulnerability which causes remote code execution.",
"id": "GHSA-j744-j5x2-w49p",
"modified": "2022-02-09T00:00:37Z",
"published": "2022-02-09T00:00:37Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-44978"
},
{
"type": "WEB",
"url": "https://gem-love.com/2021/12/10/ICMS-8-0-0%E5%90%8E%E5%8F%B0%E6%A8%A1%E6%9D%BF%E6%B3%A8%E5%85%A5%E5%AF%BC%E8%87%B4%E8%BF%9C%E7%A8%8B%E4%BB%A3%E7%A0%81%E6%89%A7%E8%A1%8C0day%E6%BC%8F%E6%B4%9E%E5%88%86%E6%9E%90"
},
{
"type": "WEB",
"url": "https://www.icmsdev.com"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-J75V-99XR-7X47
Vulnerability from github – Published: 2026-04-07 18:31 – Updated: 2026-04-09 15:35Koha Library before 23.05.10 fails to sanitize user-controllable filenames prior to unzipping, leading to remote code execution. The line "qx/unzip $filename -d $dirname/;" in upload-cover-image.pl is vulnerable to command injection via shell metacharacters because input data can be controlled by an attacker and is directly included in a system command, i.e., an attack can occur via malicious filenames after uploading a .zip file and clicking Process Images.
{
"affected": [],
"aliases": [
"CVE-2024-36057"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-04-07T16:16:21Z",
"severity": "CRITICAL"
},
"details": "Koha Library before 23.05.10 fails to sanitize user-controllable filenames prior to unzipping, leading to remote code execution. The line \"qx/unzip $filename -d $dirname/;\" in upload-cover-image.pl is vulnerable to command injection via shell metacharacters because input data can be controlled by an attacker and is directly included in a system command, i.e., an attack can occur via malicious filenames after uploading a .zip file and clicking Process Images.",
"id": "GHSA-j75v-99xr-7x47",
"modified": "2026-04-09T15:35:06Z",
"published": "2026-04-07T18:31:35Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-36057"
},
{
"type": "WEB",
"url": "https://github.com/hacklantic/Research/tree/main/CVE-2024-36057"
},
{
"type": "WEB",
"url": "https://gitlab.com/koha-community/Koha/-/blob/23.05.x/misc/release_notes/release_notes_23_05_10.md"
},
{
"type": "WEB",
"url": "https://gitlab.com/koha-community/Koha/-/blob/23.05.x/misc/release_notes/release_notes_23_05_11.md"
},
{
"type": "WEB",
"url": "https://koha-community.org/koha-22-05-22-released"
}
],
"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-J76J-5P5G-9WFR
Vulnerability from github – Published: 2025-12-08 22:16 – Updated: 2025-12-09 21:37Summary
Arbitrary Remote Code Execution on development server via unsafe dynamic imports in @vitejs/plugin-rsc server function APIs (loadServerAction, decodeReply, decodeAction) when integrated into RSC applications that expose server function endpoints.
Impact
Attackers with network access to the development server can execute arbitrary JavaScript code with Node.js privileges, allowing them to read/modify files, exfiltrate sensitive data (source code, environment variables, credentials), or pivot to other internal services. While this affects development servers only, the risk increases when using vite --host to expose the server on all network interfaces.
Details
In the example RSC application provided in Proof of Concept, the server handles server function call through API such as loadServerAction, decodeReply, decodeAction with http request's header and body as inputs:
https://github.com/vitejs/vite-plugin-react/blob/c8af971f57f12d0190d7fd8829a429f5e4112f60/packages/plugin-rsc/examples/starter/src/framework/entry.rsc.tsx#L42-L47
During development, these API internally relies on dynamic import to load server function module, which allows executing arbitrary module including data url module.
https://github.com/vitejs/vite-plugin-react/blob/c8af971f57f12d0190d7fd8829a429f5e4112f60/packages/plugin-rsc/src/rsc.tsx#L19-L24
Proof of Concept
The example app is avialable in - https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc/examples/starter - https://stackblitz.com/edit/github-rubfqp9k?file=poc.js
Reproduction Steps:
- Stat development server
vite dev - Run a following script
node poc.js - See "REMOTE CODE EXECUTION1" and "REMOTE CODE EXECUTION2" in server console
// [poc.js]
const payload = {
0: ["$F1"],
1: { id: "data:text/javascript,console.log('REMOTE CODE EXECUTION 1')# " },
};
const fd = new FormData();
for (const key in payload) {
fd.append(key, JSON.stringify(payload[key]));
}
const serverUrl = process.argv[2] || 'http://localhost:5173/_.rsc';
const response = fetch(serverUrl, {
method: "POST",
headers: {
"x-rsc-action": "data:text/javascript,console.log('REMOTE CODE EXECUTION 2')# ",
},
body: fd,
})
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 0.5.5"
},
"package": {
"ecosystem": "npm",
"name": "@vitejs/plugin-rsc"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.5.6"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-67489"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2025-12-08T22:16:31Z",
"nvd_published_at": "2025-12-09T21:16:00Z",
"severity": "CRITICAL"
},
"details": "## Summary\n\nArbitrary Remote Code Execution on development server via unsafe dynamic imports in `@vitejs/plugin-rsc` server function APIs (`loadServerAction`, `decodeReply`, `decodeAction`) when integrated into RSC applications that expose server function endpoints.\n\n## Impact\n\nAttackers with network access to the development server can execute arbitrary JavaScript code with Node.js privileges, allowing them to read/modify files, exfiltrate sensitive data (source code, environment variables, credentials), or pivot to other internal services. While this affects development servers only, the risk increases when using `vite --host` to expose the server on all network interfaces.\n\n\n## Details\n\nIn the example RSC application provided in Proof of Concept, the server handles server function call through API such as `loadServerAction`, `decodeReply`, `decodeAction` with http request\u0027s header and body as inputs:\n\nhttps://github.com/vitejs/vite-plugin-react/blob/c8af971f57f12d0190d7fd8829a429f5e4112f60/packages/plugin-rsc/examples/starter/src/framework/entry.rsc.tsx#L42-L47\n\nDuring development, these API internally relies on dynamic import to load server function module, which allows executing arbitrary module including data url module.\n\nhttps://github.com/vitejs/vite-plugin-react/blob/c8af971f57f12d0190d7fd8829a429f5e4112f60/packages/plugin-rsc/src/rsc.tsx#L19-L24\n\n## Proof of Concept\n\nThe example app is avialable in\n- https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc/examples/starter\n- https://stackblitz.com/edit/github-rubfqp9k?file=poc.js\n\n**Reproduction Steps:**\n\n- Stat development server `vite dev`\n- Run a following script `node poc.js`\n- See \"REMOTE CODE EXECUTION1\" and \"REMOTE CODE EXECUTION2\" in server console\n\n```js\n// [poc.js]\nconst payload = {\n 0: [\"$F1\"],\n 1: { id: \"data:text/javascript,console.log(\u0027REMOTE CODE EXECUTION 1\u0027)# \" },\n};\nconst fd = new FormData();\nfor (const key in payload) {\n fd.append(key, JSON.stringify(payload[key]));\n}\n\nconst serverUrl = process.argv[2] || \u0027http://localhost:5173/_.rsc\u0027;\nconst response = fetch(serverUrl, {\n method: \"POST\",\n headers: {\n \"x-rsc-action\": \"data:text/javascript,console.log(\u0027REMOTE CODE EXECUTION 2\u0027)# \",\n },\n body: fd,\n})\n```",
"id": "GHSA-j76j-5p5g-9wfr",
"modified": "2025-12-09T21:37:59Z",
"published": "2025-12-08T22:16:31Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/vitejs/vite-plugin-react/security/advisories/GHSA-j76j-5p5g-9wfr"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-67489"
},
{
"type": "WEB",
"url": "https://github.com/vitejs/vite-plugin-react/commit/fe634b58210d0a4a146a7faae56cd71af3bb9af4"
},
{
"type": "PACKAGE",
"url": "https://github.com/vitejs/vite-plugin-react"
}
],
"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": "@vitejs/plugin-rsc Remote Code Execution through unsafe dynamic imports in RSC server function APIs on development server"
}
GHSA-J77R-P467-V78C
Vulnerability from github – Published: 2025-07-17 21:32 – Updated: 2025-07-17 21:32A code execution vulnerability has been discovered in the Robot Operating System (ROS) 'rosparam' tool, affecting ROS distributions Noetic Ninjemys and earlier. The vulnerability stems from the use of the eval() function to process unsanitized, user-supplied parameter values via special converters for angle representations in radians. This flaw allowed attackers to craft and execute arbitrary Python code.
{
"affected": [],
"aliases": [
"CVE-2024-39289"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-07-17T20:15:27Z",
"severity": "HIGH"
},
"details": "A code execution vulnerability has been discovered in the Robot Operating System (ROS) \u0027rosparam\u0027 tool, affecting ROS distributions Noetic Ninjemys and earlier. The vulnerability stems from the use of the eval() function to process unsanitized, user-supplied parameter values via special converters for angle representations in radians. This flaw allowed attackers to craft and execute arbitrary Python code.",
"id": "GHSA-j77r-p467-v78c",
"modified": "2025-07-17T21:32:14Z",
"published": "2025-07-17T21:32:14Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-39289"
},
{
"type": "WEB",
"url": "https://www.ros.org/blog/noetic-eol"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-J79J-QX45-G3GP
Vulnerability from github – Published: 2022-05-01 18:29 – Updated: 2022-05-01 18:29Eval injection vulnerability in adodb-perf-module.inc.php in ADOdb Lite 1.42 and earlier, as used in products including CMS Made Simple, SAPID CMF, Journalness, PacerCMS, and Open-Realty, allows remote attackers to execute arbitrary code via PHP sequences in the last_module parameter.
{
"affected": [],
"aliases": [
"CVE-2007-5056"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2007-09-24T22:17:00Z",
"severity": "MODERATE"
},
"details": "Eval injection vulnerability in adodb-perf-module.inc.php in ADOdb Lite 1.42 and earlier, as used in products including CMS Made Simple, SAPID CMF, Journalness, PacerCMS, and Open-Realty, allows remote attackers to execute arbitrary code via PHP sequences in the last_module parameter.",
"id": "GHSA-j79j-qx45-g3gp",
"modified": "2022-05-01T18:29:31Z",
"published": "2022-05-01T18:29:31Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2007-5056"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/36733"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/40389"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/40393"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/40395"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/40396"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/4442"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/5090"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/5091"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/5097"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/5098"
},
{
"type": "WEB",
"url": "http://osvdb.org/40596"
},
{
"type": "WEB",
"url": "http://osvdb.org/41422"
},
{
"type": "WEB",
"url": "http://osvdb.org/41426"
},
{
"type": "WEB",
"url": "http://osvdb.org/41427"
},
{
"type": "WEB",
"url": "http://osvdb.org/41428"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/26928"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/28859"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/28873"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/28874"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/28886"
},
{
"type": "WEB",
"url": "http://www.attrition.org/pipermail/vim/2007-September/001800.html"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/25768"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2007/3261"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-J79X-FMCF-99X7
Vulnerability from github – Published: 2022-05-17 03:26 – Updated: 2022-05-17 03:26Symantec Endpoint Protection Manager (SEPM) 12.1 before 12.1-RU6-MP3 allows remote attackers to execute arbitrary Java code by connecting to the console Java port.
{
"affected": [],
"aliases": [
"CVE-2015-6555"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2015-11-12T03:59:00Z",
"severity": "HIGH"
},
"details": "Symantec Endpoint Protection Manager (SEPM) 12.1 before 12.1-RU6-MP3 allows remote attackers to execute arbitrary Java code by connecting to the console Java port.",
"id": "GHSA-j79x-fmcf-99x7",
"modified": "2022-05-17T03:26:31Z",
"published": "2022-05-17T03:26:31Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2015-6555"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/77495"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id/1034139"
},
{
"type": "WEB",
"url": "http://www.symantec.com/security_response/securityupdates/detail.jsp?fid=security_advisory\u0026pvid=security_advisory\u0026year=\u0026suid=20151109_00"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-J7CR-VWG9-46XP
Vulnerability from github – Published: 2025-11-18 21:32 – Updated: 2025-11-18 21:32A command injection vulnerability exists in the AOS-CX Operating System. Successful exploitation could allow an authenticated remote attacker to conduct a Remote Code Execution (RCE) on the affected system.
{
"affected": [],
"aliases": [
"CVE-2025-37157"
],
"database_specific": {
"cwe_ids": [
"CWE-78",
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-11-18T19:15:47Z",
"severity": "MODERATE"
},
"details": "A command injection vulnerability exists in the AOS-CX Operating System. Successful exploitation could allow an authenticated remote attacker to conduct a Remote Code Execution (RCE) on the affected system.",
"id": "GHSA-j7cr-vwg9-46xp",
"modified": "2025-11-18T21:32:30Z",
"published": "2025-11-18T21:32:30Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-37157"
},
{
"type": "WEB",
"url": "https://support.hpe.com/hpesc/public/docDisplay?docId=hpesbnw04888en_us\u0026docLocale=en_US"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-J7H6-XR7G-M2C5
Vulnerability from github – Published: 2022-05-17 03:28 – Updated: 2023-08-16 09:36Apache Struts 2.0.0 through 2.3.15.1 enables Dynamic Method Invocation by default, which has unknown impact and attack vectors.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "org.apache.struts:struts2-core"
},
"ranges": [
{
"events": [
{
"introduced": "2.0.0"
},
{
"fixed": "2.3.15.2"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.apache.struts:struts2-rest-plugin"
},
"ranges": [
{
"events": [
{
"introduced": "2.0.0"
},
{
"fixed": "2.3.15.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2013-4316"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2022-11-03T22:43:48Z",
"nvd_published_at": "2013-09-30T21:55:00Z",
"severity": "HIGH"
},
"details": "Apache Struts 2.0.0 through 2.3.15.1 enables Dynamic Method Invocation by default, which has unknown impact and attack vectors.",
"id": "GHSA-j7h6-xr7g-m2c5",
"modified": "2023-08-16T09:36:55Z",
"published": "2022-05-17T03:28:23Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2013-4316"
},
{
"type": "WEB",
"url": "https://github.com/apache/struts/commit/58947c3f85ae641c1a476316a2888e53605948d1"
},
{
"type": "WEB",
"url": "https://github.com/apache/struts/commit/c643336945dda84cbcdc8a39530baa24fede28c4"
},
{
"type": "PACKAGE",
"url": "https://github.com/apache/struts"
},
{
"type": "WEB",
"url": "http://archives.neohapsis.com/archives/bugtraq/2013-09/0107.html"
},
{
"type": "WEB",
"url": "http://struts.apache.org/release/2.3.x/docs/s2-019.html"
}
],
"schema_version": "1.4.0",
"severity": [],
"summary": "Code injection in Apache Struts"
}
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.