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

200 results · Clear filters · Feed

  • 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…

  • High 7.2
    CVE-2023-46818 Public exploit Scanner template EPSS 19%

    An issue was discovered in ISPConfig before 3.2.11p1. PHP code injection can be achieved in the language file editor by…

  • High 7.6
    CVE-2023-5044 Public exploit EPSS 54%

    Code injection via nginx.ingress.kubernetes.io/permanent-redirect annotation

    Code injection via nginx.ingress.kubernetes.io/permanent-redirect annotation.

  • High 8.6
    CVE-2023-41898 Public exploit

    Arbitrary URL load in Android WebView in `MyActivity.kt` in Home Assistant Companion for Android

    Home assistant is an open source home automation. The Home Assistant Companion for Android app up to version 2023.8.2 is vulnerable to arbitrary URL loading in a WebView. This enables all sorts of attacks, including arbitrary JavaScript execution, limited nat…

  • 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 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.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.8
    CVE-2023-33131 Public exploit

    Microsoft Outlook Remote Code Execution Vulnerability

    Microsoft Outlook Remote Code Execution Vulnerability

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

  • High 7.5
    CVE-2022-47879 Public exploit

    A Remote Code Execution (RCE) vulnerability in /be/rpc.php in Jedox 2020.2.5 allows remote authenticated users to load …

  • High 7.2
    CVE-2023-24955 Exploited · Ransomware Public exploit EPSS 85%

    Microsoft SharePoint Server Remote Code Execution Vulnerability

    Microsoft SharePoint Server Remote Code Execution Vulnerability

    KEV Mar 26, 2024
  • High 7.1
    CVE-2023-2591 Public exploit

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in nilsteampassnet/teampass

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in GitHub repository nilsteampassnet/teampass prior to 3.0.7.

  • High 7.5
    CVE-2023-24709 Public exploit EPSS 44%

    An issue found in Paradox Security Systems IPR512 allows attackers to cause a denial of service via the login.html and …

  • High 8.8
    CVE-2023-24078 Public exploit EPSS 53%

    Real Time Logic FuguHub v8.1 and earlier was discovered to contain a remote code execution (RCE) vulnerability via the …

  • High 7.3
    CVE-2023-24059 Public exploit

    Grand Theft Auto V for PC allows attackers to achieve partial remote code execution or modify files on a PC, as exploit…

  • High 8.8
    CVE-2023-22952 Exploited Public exploit Scanner template EPSS 80%

    In SugarCRM before 12.0. Hotfix 91155, a crafted request can inject custom PHP code through the EmailTemplates because …

    KEV Feb 2, 2023
  • High 8.1
    CVE-2022-24439 Public exploit

    Remote Code Execution (RCE)

    All versions of package gitpython are vulnerable to Remote Code Execution (RCE) due to improper user input validation, which makes it possible to inject a maliciously crafted remote URL into the clone command. Exploiting this vulnerability is possible because…

  • High 8.1
    CVE-2022-46166 Public exploit

    Spring Boot Admins integrated notifier support allows arbitrary code execution

    Spring boot admins is an open source administrative user interface for management of spring boot applications. All users who run Spring Boot Admin Server, having enabled Notifiers (e.g. Teams-Notifier) and write access to environment variables via UI are affe…

  • High 8.8
    CVE-2022-40127 Public exploit Scanner template EPSS 86%

    Apache Airflow <2.4.0 has an RCE in a bash example

    A vulnerability in Example Dags of Apache Airflow allows an attacker with UI access who can trigger DAGs, to execute arbitrary commands via manually provided run_id parameter. This issue affects Apache Airflow Apache Airflow versions prior to 2.4.0.

  • High 8.8
    CVE-2022-43571 Public exploit EPSS 19%

    Remote Code Execution through dashboard PDF generation component in Splunk Enterprise

    In Splunk Enterprise versions below 8.2.9, 8.1.12, and 9.0.2, an authenticated user can execute arbitrary code through the dashboard PDF generation component.

  • High 8.8
    CVE-2022-41544 Public exploit EPSS 14%

    GetSimple CMS v3.3.16 was discovered to contain a remote code execution (RCE) vulnerability via the edited_file paramet…

  • High 8.8
    CVE-2022-29221 Public exploit

    PHP Code Injection by malicious block or filename in Smarty

    Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. Prior to versions 3.1.45 and 4.1.1, template authors could inject php code by choosing a malicious {block} name or {include} file name. Sites t…

  • High 8.8
    CVE-2022-24780 Public exploit

    Code Injection in Combodo iTop

    Combodo iTop is a web based IT Service Management tool. In versions prior to 2.7.6 and 3.0.0, users of the iTop user portal can send TWIG code to the server by forging specific http queries, and execute arbitrary code on the server using http server user priv…

  • High 8.8
    CVE-2022-0811 Public exploit EPSS 19%

    Code Injection in CRI-O

    A flaw was found in CRI-O in the way it set kernel options for a pod. This issue allows anyone with rights to deploy a pod on a Kubernetes cluster that uses the CRI-O runtime to achieve a container escape and arbitrary code execution as root on the cluster no…

  • High 7.2
    CVE-2022-24734 Public exploit EPSS 78%

    Remote code execution in mybb

    MyBB is a free and open source forum software. In affected versions the Admin CP's Settings management module does not validate setting types correctly on insertion and update, making it possible to add settings of supported type `php` with PHP code, executed…

  • High 8.8
    CVE-2022-23642 Public exploit EPSS 74%

    Code Injection in Sourcegraph

    Sourcegraph is a code search and navigation engine. Sourcegraph prior to version 3.37 is vulnerable to remote code execution in the `gitserver` service. The service acts as a git exec proxy, and fails to properly restrict calling `git config`. This allows an …

  • High 8.8
    CVE-2022-23614 Public exploit

    Code injection in Twig

    Twig is an open source template language for PHP. When in a sandbox mode, the `arrow` parameter of the `sort` filter must be a closure to avoid attackers being able to run arbitrary PHP functions. In affected versions this constraint was not properly enforced…

  • High 7.8
    CVE-2021-43811 Public exploit

    Code injection via unsafe YAML loading

    Sockeye is an open-source sequence-to-sequence framework for Neural Machine Translation built on PyTorch. Sockeye uses YAML to store model and data configurations on disk. Versions below 2.3.24 use unsafe YAML loading, which can be made to execute arbitrary c…

  • High 7.6
    CVE-2021-22053 Public exploit Scanner template EPSS 13%

    Code injection in spring-cloud-netflix-hystrix-dashboard

    Applications using both `spring-cloud-netflix-hystrix-dashboard` and `spring-boot-starter-thymeleaf` expose a way to execute code submitted within the request URI path during the resolution of view templates. When a request is made at `/hystrix/monitor;[user-…

  • High 8.3
    CVE-2021-42694 Public exploit

    An issue was discovered in the character definitions of the Unicode Specification through 14.0. The specification allow…

  • High 8.5
    CVE-2021-39144 Exploited Public exploit Scanner template EPSS 98%

    XStream is vulnerable to a Remote Command Execution attack

    XStream is a simple library to serialize objects to XML and back again. In affected versions this vulnerability may allow a remote attacker has sufficient rights to execute commands of the host only by manipulating the processed input stream. No user is affec…

    KEV Mar 10, 2023
  • High 7.6
    CVE-2021-32706 Public exploit EPSS 60%

    (Authenticated) Remote Code Execution Possible in Web Interface 5.5

    Pi-hole's Web interface provides a central location to manage a Pi-hole instance and review performance statistics. Prior to Pi-hole Web interface version 5.5.1, the `validDomainWildcard` preg_match filter allows a malicious character through that can be used…

  • High 7.5
    CVE-2021-1585 Public exploit EPSS 20%

    Cisco Adaptive Security Device Manager Remote Code Execution Vulnerability

    A vulnerability in the Cisco Adaptive Security Device Manager (ASDM) Launcher could allow an unauthenticated, remote attacker to execute arbitrary code on a user's operating system. This vulnerability is due to a lack of proper signature verification for spec…

  • High 7.5
    CVE-2021-29505 Public exploit Scanner template EPSS 77%

    XStream is vulnerable to a Remote Command Execution attack

    XStream is software for serializing Java objects to XML and back again. A vulnerability in XStream versions prior to 1.4.17 may allow a remote attacker has sufficient rights to execute commands of the host only by manipulating the processed input stream. No u…

  • High 8.8
    CVE-2021-31181 Public exploit EPSS 29%

    Microsoft SharePoint Remote Code Execution Vulnerability

    Microsoft SharePoint Remote Code Execution Vulnerability