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

  • Critical 9.8
    CVE-2023-46980 Public exploit

    An issue in Best Courier Management System v.1.0 allows a remote attacker to execute arbitrary code and escalate privil…

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

  • Unscored —
    CVE-2023-43352 Public exploit

    An issue in CMSmadesimple v.2.2.18 allows a local attacker to execute arbitrary code via a crafted payload to the Conte…

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

  • Critical 9.8
    CVE-2023-33831 Public exploit Scanner template EPSS 26%

    A remote command execution (RCE) vulnerability in the /api/runscript endpoint of FUXA

    A remote command execution (RCE) vulnerability in the /api/runscript endpoint of FUXA 1.1.13 allows attackers to execute arbitrary commands via a crafted POST request.

  • Critical 10.0
    CVE-2023-41892 Public exploit Scanner template EPSS 94%

    Craft CMS Remote Code Execution vulnerability

    Craft CMS is a platform for creating digital experiences. This is a high-impact, low-complexity attack vector. Users running Craft installations before 4.4.15 are encouraged to update to at least that version to mitigate the issue. This issue has been fixed i…

  • Low 3.5
    CVE-2023-4547 Public exploit Scanner template EPSS 60%

    SPA-Cart eCommerce CMS search cross site scripting

    A flaw has been found in SPA-Cart eCommerce CMS 1.9.0.3. The affected element is an unknown function of the file /search. This manipulation of the argument filter[brandid]/filter[price] causes cross site scripting. The attack is possible to be carried out rem…

  • Critical 9.8
    CVE-2023-36281 Public exploit

    langchain vulnerable to arbitrary code execution

    An issue in langchain v.0.0.171 allows a remote attacker to execute arbitrary code via a JSON file to load_prompt. This is related to __subclasses__ or a template.

  • Medium 6.5
    CVE-2023-20209 Public exploit EPSS 40%

    A vulnerability in the web-based management interface of Cisco Expressway Series and Cisco TelePresence Video Communica…

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

  • Critical 9.8
    CVE-2023-3519 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    Unauthenticated remote code execution

    KEV Jul 19, 2023
  • 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…

  • Unscored —
    CVE-2022-42045 Public exploit

    Certain Zemana products are vulnerable to Arbitrary code injection. This affects Watchdog Anti-Malware 4.1.422 and Zema…

  • Critical 9.8
    CVE-2023-37582 Public exploit Scanner template EPSS 90%

    Apache RocketMQ: Possible remote code execution when using the update configuration function

    The RocketMQ NameServer component still has a remote command execution vulnerability as the CVE-2023-33246 issue was not completely fixed in version 5.1.1. When NameServer address are leaked on the extranet and lack permission verification, an attacker can ex…

  • 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
  • Unscored —
    CVE-2023-35813 Public exploit Scanner template EPSS 87%

    Multiple Sitecore products allow remote code execution. This affects Experience Manager, Experience Platform, and Exper…

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

  • Critical 9.8
    CVE-2020-36708 Public exploit Scanner template EPSS 65%

    Epsilon Framework Themes (Various Versions) - Function Injection

    The following themes for WordPress are vulnerable to Function Injections in versions up to and including Shapely <= 1.2.7, NewsMag <= 2.4.1, Activello <= 1.4.0, Illdy <= 2.1.4, Allegiant <= 1.2.2, Newspaper X <= 1.3.1, Pixova Lite <= 2.0.5, Brilliance <= 1.2.…

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

  • Critical 9.8
    CVE-2023-32692 Public exploit

    Remote Code Execution Vulnerability in Validation Placeholders

    CodeIgniter is a PHP full-stack web framework. This vulnerability allows attackers to execute arbitrary code when you use Validation Placeholders. The vulnerability exists in the Validation library, and validation methods in the controller and in-model valida…

  • Medium 6.3
    CVE-2023-2928 Public exploit EPSS 51%

    DedeCMS article_allowurl_edit.php code injection

    A vulnerability was found in DedeCMS up to 5.7.106. It has been declared as critical. Affected by this vulnerability is an unknown functionality of the file uploads/dede/article_allowurl_edit.php. The manipulation of the argument allurls leads to code injecti…

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

  • Critical 9.8
    CVE-2023-30145 Public exploit EPSS 46%

    Server-Side Template Injection in Camaleon CMS

    Camaleon CMS v2.7.0 was discovered to contain a Server-Side Template Injection (SSTI) vulnerability via the formats parameter.

  • Critical 9.8
    CVE-2023-33246 Exploited Public exploit Scanner template EPSS 97%

    Apache RocketMQ: Possible remote code execution vulnerability when using the update configuration function

    For RocketMQ versions 5.1.0 and below, under certain conditions, there is a risk of remote command execution.  Several components of RocketMQ, including NameServer, Broker, and Controller, are leaked on the extranet and lack permission verification, an attack…

    KEV Sep 6, 2023
  • 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.

  • Critical 9.8
    CVE-2020-29007 Public exploit

    The Score extension through 0.3.0 for MediaWiki has a remote code execution vulnerability due to improper sandboxing of…

  • Critical 9.8
    CVE-2023-24538 Public exploit

    Backticks not treated as string delimiters in html/template

    Templates do not properly consider backticks (`) as Javascript string delimiters, and do not escape them as expected. Backticks are used, since ES6, for JS template literals. If a template contains a Go template action within a Javascript template literal, th…

  • Medium 6.3
    CVE-2023-1773 Public exploit

    Rockoa Configuration File webmainConfig.php code injection

    A vulnerability was found in Rockoa 2.3.2. It has been declared as critical. This vulnerability affects unknown code of the file webmainConfig.php of the component Configuration File Handler. The manipulation leads to code injection. The attack can be initiat…

  • Unscored —
    CVE-2023-25261 Public exploit

    Certain Stimulsoft GmbH products are affected by: Remote Code Execution. This affects Stimulsoft Designer (Desktop) 202…

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

  • Critical 9.8
    CVE-2021-36394 Public exploit

    Moodle Session Fixation vulnerability

    In Moodle, a remote code execution risk was identified in the Shibboleth authentication plugin.

  • Critical 9.8
    CVE-2022-36231 Public exploit

    Code injection in pdf_info

    pdf_info 0.5.3 is vulnerable to Command Execution because the Ruby code uses backticks instead of Open3.

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

  • Critical 9.8
    CVE-2023-22855 Public exploit EPSS 15%

    Kardex Mlog MCC 5.7.12+0-a203c2a213-master allows remote code execution. It spawns a web interface listening on port 80…