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.
8378 vulnerabilities reference this CWE, most recent first.
GHSA-8W3F-4R8F-PF53
Vulnerability from github – Published: 2025-07-15 15:38 – Updated: 2025-07-15 15:38Summary
An unsafe JavaScript evaluation vulnerability in pyLoad’s CAPTCHA processing code allows unauthenticated remote attackers to execute arbitrary code in the client browser and potentially the backend server. Exploitation requires no user interaction or authentication and can result in session hijacking, credential theft, and full system rce.
Details
The vulnerable code resides in
function onCaptchaResult(result) {
eval(result); // Direct execution of attacker-controlled input
}
- The
onCaptchaResult()function directly passes CAPTCHA results (sent from the user) intoeval() - No sanitization or validation is performed on this input
- A malicious CAPTCHA result can include JavaScript such as
fetch()orchild_process.exec()in environments using NodeJS - Attackers can fully hijack sessions and pivot to remote code execution on the server if the environment allows it
Reproduction Methods
- Official Source Installation:
git clone https://github.com/pyload/pyload
cd pyload
git checkout 0.4.20
python -m pip install -e .
pyload --userdir=/tmp/pyload
- Virtual Environment:
python -m venv pyload-env
source pyload-env/bin/activate
pip install pyload==0.4.20
pyload
CAPTCHA Endpoint Verification
Technical Clarification:
1. The vulnerable endpoint is actually:
/interactive/captcha
- Complete PoC Request:
POST /interactive/captcha HTTP/1.1
Host: localhost:8000
Content-Type: application/x-www-form-urlencoded
cid=123&response=1%3Balert(document.cookie)
- Curl Command Correction:
curl -X POST "http://localhost:8000/interactive/captcha" \
-d "cid=123&response=1%3Balert(document.cookie)"
- Vulnerable Code Location:
The eval() vulnerability is confirmed in:src/pyload/webui/app/static/js/captcha-interactive.user.js
Resources
- https://github.com/pyload/pyload/commit/909e5c97885237530d1264cfceb5555870eb9546
- OWASP: Avoid
eval() - #4586
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "pyload-ng"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.20"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-53890"
],
"database_specific": {
"cwe_ids": [
"CWE-79",
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2025-07-15T15:38:10Z",
"nvd_published_at": "2025-07-15T00:15:24Z",
"severity": "CRITICAL"
},
"details": "#### Summary\nAn unsafe JavaScript evaluation vulnerability in pyLoad\u2019s CAPTCHA processing code allows **unauthenticated remote attackers** to execute **arbitrary code** in the client browser and potentially the backend server. Exploitation requires no user interaction or authentication and can result in session hijacking, credential theft, and full system rce.\n\n\n\n#### Details\nThe vulnerable code resides in \n```javascript\nfunction onCaptchaResult(result) {\n eval(result); // Direct execution of attacker-controlled input\n}\n```\n\n* The `onCaptchaResult()` function directly passes CAPTCHA results (sent from the user) into `eval()`\n* No sanitization or validation is performed on this input\n* A malicious CAPTCHA result can include JavaScript such as `fetch()` or `child_process.exec()` in environments using NodeJS\n* Attackers can fully hijack sessions and pivot to remote code execution on the server if the environment allows it\n\n\n\n### Reproduction Methods\n1. **Official Source Installation**:\n```bash\ngit clone https://github.com/pyload/pyload\ncd pyload\ngit checkout 0.4.20\npython -m pip install -e .\npyload --userdir=/tmp/pyload\n```\n\n2. **Virtual Environment**:\n```bash\npython -m venv pyload-env\nsource pyload-env/bin/activate\npip install pyload==0.4.20\npyload\n```\n\n## CAPTCHA Endpoint Verification\n\n\n**Technical Clarification**: \n1. The vulnerable endpoint is actually:\n ```\n /interactive/captcha\n ```\n\n2. Complete PoC Request:\n```http\nPOST /interactive/captcha HTTP/1.1\nHost: localhost:8000\nContent-Type: application/x-www-form-urlencoded\n\ncid=123\u0026response=1%3Balert(document.cookie)\n```\n\n3. Curl Command Correction:\n```bash\ncurl -X POST \"http://localhost:8000/interactive/captcha\" \\\n -d \"cid=123\u0026response=1%3Balert(document.cookie)\"\n```\n\n\n1. **Vulnerable Code Location**: \n The eval() vulnerability is confirmed in:\n ```\n src/pyload/webui/app/static/js/captcha-interactive.user.js\n ```\n\n\n\n### **Resources**\n\n1. https://github.com/pyload/pyload/commit/909e5c97885237530d1264cfceb5555870eb9546\n2. [OWASP: Avoid `eval()`](https://cheatsheetseries.owasp.org/cheatsheets/JavaScript_Security_Cheat_Sheet.html#eval)\n3. [#4586](https://github.com/pyload/pyload/pull/4586)",
"id": "GHSA-8w3f-4r8f-pf53",
"modified": "2025-07-15T15:38:10Z",
"published": "2025-07-15T15:38:10Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pyload/pyload/security/advisories/GHSA-8w3f-4r8f-pf53"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-53890"
},
{
"type": "WEB",
"url": "https://github.com/pyload/pyload/pull/4586"
},
{
"type": "WEB",
"url": "https://github.com/pyload/pyload/commit/909e5c97885237530d1264cfceb5555870eb9546"
},
{
"type": "PACKAGE",
"url": "https://github.com/pyload/pyload"
}
],
"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": "pyLoad vulnerable to XSS through insecure CAPTCHA "
}
GHSA-8W5W-66J4-P452
Vulnerability from github – Published: 2025-08-01 21:31 – Updated: 2025-08-01 21:31A stack-based buffer overflow vulnerability exists in Synactis PDF In-The-Box ActiveX control (PDF_IN_1.ocx), specifically the ConnectToSynactis method. When a long string is passed to this method—intended to populate the ldCmdLine argument of a WinExec call—a strcpy operation overwrites a saved TRegistry class pointer on the stack. This allows remote attackers to execute arbitrary code in the context of the user by enticing them to visit a malicious webpage that instantiates the vulnerable ActiveX control. The vulnerability was discovered via its use in third-party software such as Logic Print 2013.
{
"affected": [],
"aliases": [
"CVE-2013-10057"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-08-01T21:15:27Z",
"severity": "HIGH"
},
"details": "A stack-based buffer overflow vulnerability exists in\u00a0Synactis\u00a0PDF In-The-Box ActiveX control (PDF_IN_1.ocx), specifically the ConnectToSynactis method. When a long string is passed to this method\u2014intended to populate the ldCmdLine argument of a WinExec call\u2014a strcpy operation overwrites a saved TRegistry class pointer on the stack. This allows remote attackers to execute arbitrary code in the context of the user by enticing them to visit a malicious webpage that instantiates the vulnerable ActiveX control. The vulnerability was discovered via its use in third-party software such as Logic Print 2013.",
"id": "GHSA-8w5w-66j4-p452",
"modified": "2025-08-01T21:31:07Z",
"published": "2025-08-01T21:31:07Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2013-10057"
},
{
"type": "WEB",
"url": "https://raw.githubusercontent.com/rapid7/metasploit-framework/master/modules/exploits/windows/browser/synactis_connecttosynactis_bof.rb"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/25835"
},
{
"type": "WEB",
"url": "https://www.fortiguard.com/encyclopedia/ips/35840/synactis-pdf-in-the-box-connecttosynactic-buffer-overflow"
},
{
"type": "WEB",
"url": "https://www.synactis.com/pdf-in-the-box.htm"
},
{
"type": "WEB",
"url": "https://www.vulncheck.com/advisories/synactis-pdf-in-the-box-connectosynactic-stack-based-buffer-overflow"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-8W7R-5FHV-VWJ9
Vulnerability from github – Published: 2024-03-01 06:33 – Updated: 2024-08-06 18:30mjml-app versions 3.0.4 and 3.1.0-beta were discovered to contain a remote code execution (RCE) via the href attribute.
{
"affected": [],
"aliases": [
"CVE-2024-25293"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-03-01T06:15:48Z",
"severity": "CRITICAL"
},
"details": "mjml-app versions 3.0.4 and 3.1.0-beta were discovered to contain a remote code execution (RCE) via the href attribute.",
"id": "GHSA-8w7r-5fhv-vwj9",
"modified": "2024-08-06T18:30:48Z",
"published": "2024-03-01T06:33:06Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-25293"
},
{
"type": "WEB",
"url": "https://github.com/EQSTLab/PoC/tree/main/2024/LCE/CVE-2024-25293"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-8W85-PVH2-GQ59
Vulnerability from github – Published: 2025-12-08 21:30 – Updated: 2025-12-11 15:30Client-side template injection (CSTI) in Azuriom CMS admin dashboard allows a low-privilege user to execute arbitrary template code in the context of an administrator's session. This can occur via plugins or dashboard components that render untrusted user input, potentially enabling privilege escalation to an administrative account. Fixed in Azuriom 1.2.7.
{
"affected": [],
"aliases": [
"CVE-2025-65271"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-12-08T19:15:50Z",
"severity": "HIGH"
},
"details": "Client-side template injection (CSTI) in Azuriom CMS admin dashboard allows a low-privilege user to execute arbitrary template code in the context of an administrator\u0027s session. This can occur via plugins or dashboard components that render untrusted user input, potentially enabling privilege escalation to an administrative account. Fixed in Azuriom 1.2.7.",
"id": "GHSA-8w85-pvh2-gq59",
"modified": "2025-12-11T15:30:31Z",
"published": "2025-12-08T21:30:22Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-65271"
},
{
"type": "WEB",
"url": "https://github.com/Azuriom/Azuriom/commit/0289175547319add814dcb526e8ba034f1ebc3ec"
},
{
"type": "WEB",
"url": "https://github.com/1337Skid/CVE-2025-65271"
},
{
"type": "WEB",
"url": "https://github.com/Azuriom/Azuriom"
},
{
"type": "WEB",
"url": "https://www.github.com/Azuriom/Azuriom"
},
{
"type": "WEB",
"url": "https://www.github.com/Azuriom/Azuriom/commit/0289175547319add814dcb526e8ba034f1ebc3ec"
}
],
"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"
}
]
}
GHSA-8W8C-P944-GQJJ
Vulnerability from github – Published: 2025-04-23 09:33 – Updated: 2025-04-23 09:33A malicious third party could invoke a persistent denial of service vulnerability in FireEye EDR agent by sending a specially-crafted tamper protection event to the HX service to trigger an exception. This exception will prevent any further tamper protection events from being processed, even after a reboot of HX.
{
"affected": [],
"aliases": [
"CVE-2025-0618"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-04-23T07:15:42Z",
"severity": "MODERATE"
},
"details": "A malicious third party could invoke a persistent denial of service vulnerability in FireEye EDR agent by sending a specially-crafted tamper protection event to the HX service to trigger an exception. This exception will prevent any further tamper protection events from being processed, even after a reboot of HX.",
"id": "GHSA-8w8c-p944-gqjj",
"modified": "2025-04-23T09:33:32Z",
"published": "2025-04-23T09:33:32Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-0618"
},
{
"type": "WEB",
"url": "https://thrive.trellix.com/s/article/000014456"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-8WC9-4CRC-JR2Q
Vulnerability from github – Published: 2022-05-24 19:18 – Updated: 2022-05-24 19:18An issue was discovered in Gradle Enterprise before 2021.1.2. There is potential remote code execution via the application startup configuration. The installation configuration user interface (available to administrators) allows specifying arbitrary Java Virtual Machine startup options. Some of these options, such as -XX:OnOutOfMemoryError, allow specifying a command to be run on the host. This can be abused to run arbitrary commands on the host, should an attacker gain administrative access to the application.
{
"affected": [],
"aliases": [
"CVE-2021-41619"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-10-27T14:15:00Z",
"severity": "HIGH"
},
"details": "An issue was discovered in Gradle Enterprise before 2021.1.2. There is potential remote code execution via the application startup configuration. The installation configuration user interface (available to administrators) allows specifying arbitrary Java Virtual Machine startup options. Some of these options, such as -XX:OnOutOfMemoryError, allow specifying a command to be run on the host. This can be abused to run arbitrary commands on the host, should an attacker gain administrative access to the application.",
"id": "GHSA-8wc9-4crc-jr2q",
"modified": "2022-05-24T19:18:57Z",
"published": "2022-05-24T19:18:57Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-41619"
},
{
"type": "WEB",
"url": "https://security.gradle.com"
},
{
"type": "WEB",
"url": "https://security.gradle.com/advisory/2021-08"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-8WGG-7FPQ-C3VX
Vulnerability from github – Published: 2022-05-14 02:16 – Updated: 2025-04-11 03:41Incomplete blacklist vulnerability in config.template.php in vtiger CRM before 5.2.1 allows remote authenticated users to execute arbitrary code by using the draft save feature in the Compose Mail component to upload a file with a .phtml extension, and then accessing this file via a direct request to the file in the storage/ directory tree.
{
"affected": [],
"aliases": [
"CVE-2010-3909"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-11-26T20:00:00Z",
"severity": "MODERATE"
},
"details": "Incomplete blacklist vulnerability in config.template.php in vtiger CRM before 5.2.1 allows remote authenticated users to execute arbitrary code by using the draft save feature in the Compose Mail component to upload a file with a .phtml extension, and then accessing this file via a direct request to the file in the storage/ directory tree.",
"id": "GHSA-8wgg-7fpq-c3vx",
"modified": "2025-04-11T03:41:23Z",
"published": "2022-05-14T02:16:59Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-3909"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/42246"
},
{
"type": "WEB",
"url": "http://vtiger.com/blogs/2010/11/16/vtiger-crm-521-is-released"
},
{
"type": "WEB",
"url": "http://wiki.vtiger.com/index.php/Vtiger521:Release_Notes"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/514846/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.ush.it/team/ush/hack-vtigercrm_520/vtigercrm_520.txt"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-8WJ4-7HPQ-QJ4H
Vulnerability from github – Published: 2025-01-16 03:30 – Updated: 2025-01-16 15:32RE11S v1.11 was discovered to contain a command injection vulnerability via the L2TPUserName parameter at /goform/setWAN.
{
"affected": [],
"aliases": [
"CVE-2025-22906"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-01-16T03:15:06Z",
"severity": "CRITICAL"
},
"details": "RE11S v1.11 was discovered to contain a command injection vulnerability via the L2TPUserName parameter at /goform/setWAN.",
"id": "GHSA-8wj4-7hpq-qj4h",
"modified": "2025-01-16T15:32:09Z",
"published": "2025-01-16T03:30:31Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-22906"
},
{
"type": "WEB",
"url": "https://github.com/xyqer1/RE11S_1.11-setWAN-CommandInjection"
},
{
"type": "WEB",
"url": "https://www.edimax.com/edimax/global"
},
{
"type": "WEB",
"url": "http://re11s.com"
}
],
"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-8WJC-JQJ9-PV2V
Vulnerability from github – Published: 2021-12-27 00:00 – Updated: 2022-07-13 00:01Certain NETGEAR devices are affected by server-side injection. This affects RBK40 before 2.5.1.16, RBR40 before 2.5.1.16, RBS40 before 2.5.1.16, RBK20 before 2.5.1.16, RBR20 before 2.5.1.16, RBS20 before 2.5.1.16, RBK50 before 2.5.1.16, RBR50 before 2.5.1.16, RBS50 before 2.5.1.16, and RBS50Y before 2.6.1.40.
{
"affected": [],
"aliases": [
"CVE-2021-45660"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-12-26T01:15:00Z",
"severity": "HIGH"
},
"details": "Certain NETGEAR devices are affected by server-side injection. This affects RBK40 before 2.5.1.16, RBR40 before 2.5.1.16, RBS40 before 2.5.1.16, RBK20 before 2.5.1.16, RBR20 before 2.5.1.16, RBS20 before 2.5.1.16, RBK50 before 2.5.1.16, RBR50 before 2.5.1.16, RBS50 before 2.5.1.16, and RBS50Y before 2.6.1.40.",
"id": "GHSA-8wjc-jqj9-pv2v",
"modified": "2022-07-13T00:01:51Z",
"published": "2021-12-27T00:00:30Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-45660"
},
{
"type": "WEB",
"url": "https://kb.netgear.com/000064064/Security-Advisory-for-Server-Side-Injection-on-Some-WiFi-Systems-PSV-2019-0133"
}
],
"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-8WRQ-VXJW-X3JW
Vulnerability from github – Published: 2022-05-01 23:41 – Updated: 2025-04-09 03:53Multiple PHP remote file inclusion vulnerabilities in just another flat file (JAF) CMS 4.0 RC2 allow remote attackers to execute arbitrary PHP code via a URL in the (1) website parameter to (a) forum.php, (b) headlines.php, and (c) main.php in forum/, and (2) main_dir parameter to forum/forum.php. NOTE: other main_dir vectors are already covered by CVE-2006-7127.
{
"affected": [],
"aliases": [
"CVE-2008-1609"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-04-01T16:44:00Z",
"severity": "MODERATE"
},
"details": "Multiple PHP remote file inclusion vulnerabilities in just another flat file (JAF) CMS 4.0 RC2 allow remote attackers to execute arbitrary PHP code via a URL in the (1) website parameter to (a) forum.php, (b) headlines.php, and (c) main.php in forum/, and (2) main_dir parameter to forum/forum.php. NOTE: other main_dir vectors are already covered by CVE-2006-7127.",
"id": "GHSA-8wrq-vxjw-x3jw",
"modified": "2025-04-09T03:53:14Z",
"published": "2022-05-01T23:41:46Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-1609"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/41753"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/2474"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/5317"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/490162/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/490183/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/28476"
}
],
"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.