Skip to content
OpenAdvisories

Weakness (CWE)

CWE-94: Improper Control of Generation of Code

Base 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.

How to prevent it (7 mitigations)
  1. Architecture and Design

    Refactor your program so that you do not have to dynamically generate code.

  2. Architecture and Design

    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.

  3. Implementation

    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().

  4. Testing

    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.

  5. Operation

    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).

  6. Operation

    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).

  7. Implementation

    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].

Source: MITRE CWE-94

575 results · Clear filters · Feed

  • Medium 6.3
    CVE-2024-31974 Public exploit

    The com.solarized.firedown (aka Solarized FireDown Browser & Downloader) application 1.0.76 for Android allows a remote…

  • Critical 9.9
    CVE-2024-33644 Public exploit

    WordPress Customify Site Library plugin <= 0.0.9 - Remote Code Execution (RCE) vulnerability

    Improper Control of Generation of Code ('Code Injection') vulnerability in WPCustomify Customify Site Library allows Code Injection.This issue affects Customify Site Library: from n/a through 0.0.9.

  • Medium 6.1
    CVE-2024-34225 Public exploit

    Cross Site Scripting vulnerability in php-lms/admin/?page=system_info in Computer Laboratory Management System using PH…

  • High 8.8
    CVE-2024-30973 Public exploit

    An issue in V-SOL G/EPON ONU HG323AC-B with firmware version V2.0.08-210715 allows an attacker to execute arbtirary cod…

  • High 7.6
    CVE-2024-31621 Public exploit Scanner template EPSS 60%

    Flowise vulnerable to code injection via api/v1

    An issue in FlowiseAI Inc Flowise v.1.6.2 and before allows a remote attacker to execute arbitrary code via a crafted script to the api/v1 component.

  • Critical 9.8
    CVE-2024-31666 Public exploit

    An issue in flusity-CMS v.2.33 allows a remote attacker to execute arbitrary code via a crafted script to the edit_addo…

  • Critical 9.8
    CVE-2024-3660 Public exploit

    Arbitrary code injection vulnerability in Keras framework < 2.13

    A arbitrary code injection vulnerability in TensorFlow's Keras framework (<2.13) allows attackers to execute arbitrary code with the same permissions as the application using a model that allow arbitrary code irrespective of the application.

  • High 7.6
    CVE-2024-29399 Public exploit

    An issue was discovered in GNU Savane v.3.13 and before, allows a remote attacker to execute arbitrary code and escalat…

  • High 7.8
    CVE-2024-25376 Public exploit

    An issue discovered in Thesycon Software Solutions Gmbh & Co. KG TUSBAudio MSI-based installers before 5.68.0 allows a …

  • High 7.2
    CVE-2024-22722 Public exploit

    Server Side Template Injection (SSTI) vulnerability in Form Tools 3.1.1 allows attackers to run arbitrary commands via …

  • Critical 10.0
    CVE-2024-31982 Public exploit Scanner template EPSS 35%

    XWiki Platform: Remote code execution as guest via DatabaseSearch

    XWiki Platform is a generic wiki platform. Starting in version 2.4-milestone-1 and prior to versions 4.10.20, 15.5.4, and 15.10-rc-1, XWiki's database search allows remote code execution through the search text. This allows remote code execution for any visit…

  • Critical 9.8
    CVE-2024-31819 Public exploit EPSS 16%

    WWBN AVideo Remote Code Execution

    An issue in WWBN AVideo v.12.4 through v.14.2 allows a remote attacker to execute arbitrary code via the systemRootPath parameter of the submitIndex.php component.

  • Critical 9.1
    CVE-2023-36645 Public exploit

    SQL injection vulnerability in ITB-GmbH TradePro v9.5, allows remote attackers to run SQL queries via oordershow compon…

  • Critical 10.0
    CVE-2024-25096 Public exploit

    WordPress canto plugin <= 3.0.7 - Unauth. Remote Code Execution (RCE) vulnerability

    Improper Control of Generation of Code ('Code Injection') vulnerability in Canto Inc. Canto allows Code Injection.This issue affects Canto: from n/a through 3.0.7.

  • High 8.4
    CVE-2024-23727 Public exploit

    The YI Smart Kami Vision com.kamivision.yismart application through 1.0.0_20231219 for Android allows a remote attacker…

  • High 8.8
    CVE-2024-28116 Public exploit

    Server-Side Template Injection (SSTI) with Grav CMS security sandbox bypass

    Grav is an open-source, flat-file content management system. Grav CMS prior to version 1.7.45 is vulnerable to a Server-Side Template Injection (SSTI), which allows any authenticated user (editor permissions are sufficient) to execute arbitrary code on the re…

  • Critical 9.3
    CVE-2024-25293 Public exploit

    mjml-app versions 3.0.4 and 3.1.0-beta were discovered to contain a remote code execution (RCE) via the href attribute.

  • Critical 9.8
    CVE-2024-22891 Public exploit

    Nteract Remote Code Execution vulnerability

    Nteract v.0.28.0 was discovered to contain a remote code execution (RCE) vulnerability via the Markdown link.

  • Critical 9.8
    CVE-2023-51801 Public exploit

    SQL Injection vulnerability in the Simple Student Attendance System v.1.0 allows a remote attacker to execute arbitrary…

  • Critical 9.8
    CVE-2024-25291 Public exploit

    Deskfiler v1.2.3 allows attackers to execute arbitrary code via uploading a crafted plugin.

  • Critical 9.8
    CVE-2024-25180 Public exploit

    An issue discovered in pdfmake 0.2.9 allows remote attackers to run arbitrary code via crafted POST request to the /pdf…

  • Medium 6.1
    CVE-2024-25202 Public exploit

    Cross Site Scripting vulnerability in Phpgurukul User Registration & Login and User Management System 1.0 allows attack…

  • High 7.5
    CVE-2023-51770 Public exploit

    Apache DolphinScheduler: Arbitrary File Read Vulnerability

    Arbitrary File Read Vulnerability in Apache Dolphinscheduler. This issue affects Apache DolphinScheduler: before 3.2.1. We recommend users to upgrade Apache DolphinScheduler to version 3.2.1, which fixes the issue.

  • Critical 9.8
    CVE-2023-49109 Public exploit

    Remote Code Execution in Apache Dolphinscheduler

    Exposure of Remote Code Execution in Apache Dolphinscheduler. This issue affects Apache DolphinScheduler: before 3.2.1. We recommend users to upgrade Apache DolphinScheduler to version 3.2.1, which fixes the issue.

  • High 8.8
    CVE-2024-21378 Public exploit EPSS 11%

    Microsoft Outlook Remote Code Execution Vulnerability

    Microsoft Outlook Remote Code Execution Vulnerability

  • High 8.8
    CVE-2024-22514 Public exploit

    An issue discovered in iSpyConnect.com Agent DVR 5.1.6.0 allows attackers to run arbitrary files by restoring a crafted…

  • Medium 6.1
    CVE-2024-24396 Public exploit

    Stimulsoft Dashboard.JS Cross Site Scripting vulnerability

    Cross Site Scripting vulnerability in Stimulsoft GmbH Stimulsoft Dashboard.JS before v.2024.1.2 allows a remote attacker to execute arbitrary code via a crafted payload to the search bar component.

  • Critical 9.8
    CVE-2024-23746 Public exploit

    Miro Desktop 0.8.18 on macOS allows local Electron code injection via a complex series of steps that might be usable in…

  • High 8.8
    CVE-2024-22899 Public exploit

    Vinchin Backup & Recovery v7.2 was discovered to contain an authenticated remote code execution (RCE) vulnerability via…

  • Unscored —
    CVE-2024-23742 Public exploit

    An issue in Loom on macOS version 0.196.1 and before, allows remote attackers to execute arbitrary code via the RunAsNo…

  • Critical 9.8
    CVE-2024-23741 Public exploit

    An issue in Hyper on macOS version 3.4.1 and before, allows remote attackers to execute arbitrary code via the RunAsNod…

  • High 8.8
    CVE-2023-52251 Public exploit Scanner template EPSS 87%

    An issue discovered in provectus kafka-ui 0.4.0 through 0.7.2 allows remote attackers to execute arbitrary code via the…

  • High 7.8
    CVE-2024-23208 Public exploit

    The issue was addressed with improved memory handling. This issue is fixed in iOS 17.3 and iPadOS 17.3, macOS Sonoma 14…

  • Medium 6.3
    CVE-2024-0195 Public exploit Scanner template EPSS 19%

    spider-flow FunctionController.java FunctionService.saveFunction code injection

    A vulnerability, which was classified as critical, was found in spider-flow 0.4.3. Affected is the function FunctionService.saveFunction of the file src/main/java/org/spiderflow/controller/FunctionController.java. The manipulation leads to code injection. It …

  • Critical 9.9
    CVE-2023-47840 Public exploit

    WordPress Qode Essential Addons Plugin <= 1.5.2 is vulnerable to Remote Code Execution (RCE)

    Improper Control of Generation of Code ('Code Injection') vulnerability in Qode Interactive Qode Essential Addons.This issue affects Qode Essential Addons: from n/a through 1.5.2.

  • Critical 9.8
    CVE-2023-43481 Public exploit

    An issue in Shenzhen TCL Browser TV Web BrowseHere (aka com.tcl.browser) 6.65.022_dab24cc6_231221_gp allows a remote at…

  • Critical 9.8
    CVE-2023-6553 Public exploit Scanner template EPSS 98%

    Backup Migration <= 1.3.7 - Unauthenticated Remote Code Execution

    The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1.3.7 via the /includes/backup-heart.php file. This is due to an attacker being able to control the values passed to an include, and subsequ…

  • Critical 9.8
    CVE-2023-43364 Public exploit

    Searchor CLI's Search vulnerable to Arbitrary Code using Eval

    main.py in Searchor before 2.4.2 uses eval on CLI input, which may cause unexpected code execution.

  • Unscored —
    CVE-2023-49070 Public exploit Scanner template EPSS 95%

    Pre-auth RCE in Apache Ofbiz 18.12.09 due to XML-RPC still present

    Pre-auth RCE in Apache Ofbiz 18.12.09. It's due to XML-RPC no longer maintained still present. This issue affects Apache OFBiz: before 18.12.10.  Users are recommended to upgrade to version 18.12.10

  • Critical 9.9
    CVE-2023-46404 Public exploit

    PCRS <= 3.11 (d0de1e) “Questions” page and “Code editor” page are vulnerable to remote code execution (RCE) by escaping…