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

1,737 results · Clear filters · Feed

  • High 7.5

    pf4j vulnerable to remote code execution via the zippluginPath parameter

    An issue in pf4j pf4j v.3.9.0 and before allows a remote attacker to obtain sensitive information and execute arbitrary code via the zippluginPath parameter.

  • High 7.5

    pf4j vulnerable to remote code execution via expandIfZip method in the extract function

    An issue in pf4j pf4j v.3.9.0 and before allows a remote attacker to obtain sensitive information and execute arbitrary code via the expandIfZip method in the extract function.

  • High 7.8

    Command injection in pagekit

    An issue in Pagekit pagekit v.1.0.18 alows a remote attacker to execute arbitrary code via thedownloadAction and updateAction functions in UpdateController.php

  • High 7.2

    Authenticated Remote Code Execution in EdgeConnect SD-WAN Orchestrator Web-Based Management Interface

    A vulnerability in the web-based management interface of EdgeConnect SD-WAN Orchestrator could allow an authenticated remote attacker to run arbitrary commands on the underlying host. Successful exploitation of this vulnerability allows an attacker to execute…

  • High 8.1

    Unauthenticated Remote Code Execution in EdgeConnect SD-WAN Orchestrator Web-Based Management Interface

    A vulnerability in the web-based management interface of EdgeConnect SD-WAN Orchestrator could allow an unauthenticated remote attacker to run arbitrary commands on the underlying host if certain preconditions outside of the attacker's control are met. Succes…

  • High —

    pandasai vulnerable to prompt injection

    An issue in Gaberiele Venturi pandasai v.0.8.0 and before allows a remote attacker to execute arbitrary code via a crafted request to the prompt function.

  • High 7.1

    Disable BeanShell Interpreter Remote Server Mode

    A BeanShell interpreter in remote server mode runs in OpenMNS Horizon versions earlier than 32.0.2 and in related Meridian versions which could allow arbitrary remote Java code execution. The solution is to upgrade to Meridian 2023.1.6, 2022.1.19, 2021.1.30, …

  • High 7.8

    Code Injection vulnerability in SAP PowerDesigner

    SAP SQLA for PowerDesigner 17 bundled with SAP PowerDesigner 16.7 SP06 PL03, allows an attacker with local access to the system, to place a malicious library, that can be executed by the application. An attacker could thereby control the behavior of the appli…

  • High 8.0

    WP Ultimate CSV Importer <= 7.9.8 - Authenticated (Author+) Remote Code Execution

    The WP Ultimate CSV Importer plugin for WordPress is vulnerable to Remote Code Execution in versions up to, and including, 7.9.8 via the '->cus1' parameter. This allows authenticated attackers with author-level permissions or above, if the administrator previ…

  • High 8.0

    WP Ultimate CSV Importer <= 7.9.8 - Authenticated (Author+) PHP File Creation to Remote Code Execution

    The WP Ultimate CSV Importer plugin for WordPress is vulnerable to Remote Code Execution in versions up to, and including, 7.9.8 via the '->cus2' parameter. This allows authenticated attackers with author-level permissions or above, if the administrator previ…

  • High 8.8
    CVE-2023-36542 Public exploit

    Apache NiFi: Potential Code Injection with Properties Referencing Remote Resources

    Apache NiFi 0.0.2 through 1.22.0 include Processors and Controller Services that support HTTP URL references for retrieving drivers, which allows an authenticated and authorized user to configure a location that enables custom code execution. The resolution i…

  • High 7.5

    This High severity Injection and RCE (Remote Code Execution) vulnerability known as CVE-2023-22506 was introduced in ve…

  • High 8.2

    Code injection via Dynamic Redfish Extension interface

    AMI SPx contains a vulnerability in the BMC where a user may inject code which could be executed via a Dynamic Redfish Extension interface. A successful exploit of this vulnerability may lead to a loss of confidentiality, integrity, and availability.

  • High 7.6

    Python code execution sandbox escape in non-docker version in Auto-GPT

    Auto-GPT is an experimental open-source application showcasing the capabilities of the GPT-4 language model. When Auto-GPT is executed directly on the host system via the provided run.sh or run.bat files, custom Python code execution is sandboxed using a temp…

  • High 8.1
    CVE-2023-37273 Public exploit

    Docker escape in Auto-GPT when running from docker-compose.yml included in git repo

    Auto-GPT is an experimental open-source application showcasing the capabilities of the GPT-4 language model. Running Auto-GPT version prior to 0.4.3 by cloning the git repo and executing `docker compose run auto-gpt` in the repo root uses a different docker-c…

  • High 8.8

    MediaWiki PandocUpload Extension Remote Code Execution Vulnerability

    MediaWiki PandocUpload Extension Remote Code Execution Vulnerability

  • High 8.8
    CVE-2023-33157 EPSS 38%

    Microsoft SharePoint Remote Code Execution Vulnerability

    Microsoft SharePoint Remote Code Execution Vulnerability

  • High 8.8

    PiiGAB M-Bus Code Injection

    PiiGAB M-Bus SoftwarePack 900S does not correctly sanitize user input, which could allow an attacker to inject arbitrary commands.

  • High 8.6
    CVE-2023-30990 Public exploit

    IBM i command execution

    IBM i 7.2, 7.3, 7.4, and 7.5 could allow a remote attacker to execute CL commands as QUSER, caused by an exploitation of DDM architecture. IBM X-Force ID: 254036.

    IBM i
  • High 8.0

    AWS data.all vulnerable to RCE through user injection of Python Commands

    AWS data.all is an open source development framework to help users build a data marketplace on Amazon Web Services. data.all versions 1.2.0 through 1.5.1 do not prevent remote code execution when a user injects Python commands into the ‘Template’ field when c…

  • High 8.0

    Code Injection in fossbilling/fossbilling

    Code Injection in GitHub repository fossbilling/fossbilling prior to 0.5.1.

  • High 8.1

    Insecure sandbox in Backstage Scaffolder plugin

    Backstage is an open platform for building developer portals. The Backstage scaffolder-backend plugin uses a templating library that requires sandbox, as it by design allows for code injection. The library used for this sandbox so far has been `vm2`, but in l…

  • High 7.1

    Attackers with access to the "documentconverterws" API were able to inject serialized Java objects, that were not prope…

  • High 7.2

    An issue discovered in Pluck CMS v.4.7.10-dev2 allows a remote attacker to execute arbitrary php code via the hidden pa…

  • High 8.8

    Grav vulnerable to Server-side Template Injection (SSTI) via Denylist Bypass

    Grav is a flat-file content management system. Prior to version 1.7.42, the denylist introduced in commit 9d6a2d to prevent dangerous functions from being executed via injection of malicious templates was insufficient and could be easily subverted in multiple…

  • High 8.8

    Grav Server-side Template Injection via Insufficient Validation in filterFilter

    Grav is a flat-file content management system. Prior to version 1.7.42, there is a logic flaw in the `GravExtension.filterFilter()` function whereby validation against a denylist of unsafe functions is only performed when the argument passed to filter is a st…

  • High 7.8

    A CWE-94: Improper Control of Generation of Code ('Code Injection') vulnerability exists that could cause execution of …

  • High 8.8
    CVE-2023-33131 Public exploit

    Microsoft Outlook Remote Code Execution Vulnerability

    Microsoft Outlook Remote Code Execution Vulnerability

  • High 8.1
    CVE-2023-3224 EPSS 59%

    Code Injection in nuxt/nuxt

    Code Injection in GitHub repository nuxt/nuxt prior to 3.5.3.

  • High 7.2

    CraftCMS version 3.7.59 is vulnerable to Server-Side Template Injection (SSTI). An authenticated attacker can inject Tw…

  • High 8.8
    CVE-2023-34468 Public exploit EPSS 62%

    Apache NiFi: Potential Code Injection with Database Services using H2

    The DBCPConnectionPool and HikariCPConnectionPool Controller Services in Apache NiFi 0.0.2 through 1.21.0 allow an authenticated and authorized user to configure a Database URL with the H2 driver that enables custom code execution. The resolution validates th…

  • High 7.8

    A potential security vulnerability has been identified with a version of the HP Softpaq installer that can lead to arbi…

  • High 8.1

    Remote code execution via specially crafted script settings in SABnzbd

    SABnzbd is an open source automated Usenet download tool. A design flaw was discovered in SABnzbd that could allow remote code execution. Manipulating the Parameters setting in the Notification Script functionality allows code execution with the privileges of…

  • High 7.2

    In Advantech WebAccss/SCADA v9.1.3 and prior, there is an arbitrary file overwrite vulnerability, which could allow an …

  • High 7.8
    CVE-2023-33733 Public exploit

    Reportlab vulnerable to remote code execution

    Reportlab up to v3.6.12 allows attackers to execute arbitrary code via supplying a crafted PDF file.

  • High 7.8

    An issue was discovered in South River Technologies TitanFTP NextGen server that allows for a vertical privilege escala…

  • High 8.4

    Dell NetWorker 19.6.1.2, contains an OS command injection Vulnerability in the NetWorker client. A remote unauthenticat…

  • High 7.2
    CVE-2023-33440 Public exploit Scanner template EPSS 15%

    Sourcecodester Faculty Evaluation System v1.0 is vulnerable to arbitrary code execution via /eval/ajax.php?action=save_…

  • High 7.1
    CVE-2023-2859 Public exploit

    Code Injection in nilsteampassnet/teampass

    Code Injection in GitHub repository nilsteampassnet/teampass prior to 3.0.9.

  • High 8.8
    CVE-2023-32697 Public exploit

    Sqlite-jdbc vulnerable to remote code execution when JDBC url is attacker controlled

    SQLite JDBC is a library for accessing and creating SQLite database files in Java. Sqlite-jdbc addresses a remote code execution vulnerability via JDBC URL. This issue impacting versions 3.6.14.1 through 3.41.2.1 and has been fixed in version 3.41.2.2.