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,026 results · Clear filters · Feed

  • Medium 6.3

    taoCMS admin.php code injection

    A vulnerability was found in taoCMS 3.0.2. It has been classified as critical. Affected is an unknown function of the file /admin/admin.php. The manipulation leads to code injection. It is possible to launch the attack remotely. The exploit has been disclosed…

  • Medium 5.7

    An issue was identified in GitLab CE/EE affecting all versions from 1.0 prior to 15.8.5, 15.9 prior to 15.9.4, and 15.1…

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

  • Medium 6.3

    Cross-site Scripting in thorsten/phpmyfaq

    Cross-site Scripting in GitHub repository thorsten/phpmyfaq prior to 3.1.12.

  • Medium 4.7

    HkCms External Plugin code injection

    A vulnerability, which was classified as problematic, was found in HkCms 2.2.4.230206. This affects an unknown part of the file /admin.php/appcenter/local.html?type=addon of the component External Plugin Handler. The manipulation leads to code injection. It i…

  • Medium 6.0

    Code Injection in alextselegidis/easyappointments

    Code Injection in GitHub repository alextselegidis/easyappointments prior to 1.5.0.

  • Medium 6.9

    SketchSVG Arbitrary Code Injection vulnerability

    All versions of the package sketchsvg are vulnerable to Arbitrary Code Injection when invoking shell.exec without sanitization nor parametrization while concatenating the current directory as part of the command string.

  • Medium 4.1

    Code injection in GitHub Enterprise Server leading to arbitrary environment variables in GitHub Actions

    A code injection vulnerability was identified in GitHub Enterprise Server that allowed setting arbitrary environment variables from a single environment variable value in GitHub Actions when using a Windows based runner. To exploit this vulnerability, an atta…

  • Medium 5.3

    JP1016 Markdown-Electron code injection

    A vulnerability was found in JP1016 Markdown-Electron and classified as critical. Affected by this issue is some unknown functionality. The manipulation leads to code injection. Attacking locally is a requirement. The exploit has been disclosed to the public …

  • Medium 5.3

    MarkText WSH JScript code injection

    A vulnerability has been found in MarkText up to 0.17.1 on Windows and classified as critical. Affected by this vulnerability is an unknown functionality of the component WSH JScript Handler. The manipulation leads to code injection. Local access is required …

  • Medium 5.3

    Typora WSH JScript code injection

    A vulnerability, which was classified as critical, was found in Typora up to 1.5.5 on Windows. Affected is an unknown function of the component WSH JScript Handler. The manipulation leads to code injection. An attack has to be approached locally. The exploit …

  • Medium 5.6

    Security Advisory | PendingIntent hijacking vulnerability in Framework Services

    The framework service handles pendingIntent incorrectly, allowing a malicious application with certain privileges to perform privileged actions.

  • Medium 6.5

    Code Injection in thorsten/phpmyfaq

    Code Injection in GitHub repository thorsten/phpmyfaq prior to 3.1.11.

  • Medium 5.5

    NYUCCL psiTurk experiment.py special elements used in a template engine

    A vulnerability has been found in NYUCCL psiTurk up to 3.2.0 and classified as critical. This vulnerability affects unknown code of the file psiturk/experiment.py. The manipulation of the argument mode leads to improper neutralization of special elements used…

  • Medium —

    XML-RPC for PHP's `Wrapper::buildClientWrapperCode` method allows code injection via malicious `$client` argument

    In order for this weakness to be exploited, the following conditions have to apply, at the same time: - method `Wrapper::buildClientWrapperCode`, or any methods which depend on it, such as `Wrapper::wrapXmlrpcServer`, `Wrapper::wrapXmlrpcMethod` or `Wrapper::…

  • Medium 5.5

    nterchange code_caller_controller.php getContent code injection

    A vulnerability was found in nterchange up to 4.1.0. It has been rated as critical. This issue affects the function getContent of the file app/controllers/code_caller_controller.php. The manipulation of the argument q with the input %5C%27%29;phpinfo%28%29;/*…

  • Medium 6.3

    LinkedIn dustjs prototype pollution

    A vulnerability was found in LinkedIn dustjs up to 2.x and classified as problematic. Affected by this issue is some unknown functionality. The manipulation leads to improperly controlled modification of object prototype attributes ('prototype pollution'). Th…

  • Medium 6.3

    Furqan node-whois index.coffee prototype pollution

    A vulnerability classified as critical has been found in Furqan node-whois. Affected is an unknown function of the file index.coffee. The manipulation leads to improperly controlled modification of object prototype attributes ('prototype pollution'). It is po…

  • Medium 6.8

    Hidden functionality vulnerability in Buffalo network devices allows a network-adjacent attacker with an administrative…

  • Medium 6.1

    editor.js contains Code Injection

    Editor.js is a block-style editor with clean JSON output. Versions prior to 2.26.0 are vulnerable to Code Injection via pasted input. The processHTML method passes pasted input into wrapper’s innerHTML. This issue is patched in version 2.26.0.

  • Medium 5.8

    Code Injection

    The package snyk before 1.1064.0 are vulnerable to Code Injection when analyzing a project. An attacker who can convince a user to scan a malicious project can include commands in a build file such as build.gradle or gradle-wrapper.jar, which will be executed…

  • Medium 6.8
    CVE-2022-41223 Exploited · Ransomware EPSS 11%

    The Director database component of MiVoice Connect through 19.3 (22.22.6100.0) could allow an authenticated attacker to…

    KEV Feb 21, 2023
  • Medium 6.5

    Remote Code Execution (RCE) vulnerability in super-xray via URL input

    super-xray is a vulnerability scanner (xray) GUI launcher. In version 0.1-beta, the URL is not filtered and directly spliced ​​into the command, resulting in a possible RCE vulnerability. Users should upgrade to super-xray 0.2-beta.

  • Medium 6.6

    Nextcloud Desktop vulnerable to code injection via malicious link

    The Nextcloud Desktop Client is a tool to synchronize files from Nextcloud Server with your computer. In version 3.6.0, if a user received a malicious file share and has it synced locally or the virtual filesystem enabled and clicked a nc://open/ link it will…

  • Medium 5.5

    SAP GUI allows an authenticated attacker to execute scripts in the local network. On successful exploitation, the attac…

  • Medium 6.5
    CVE-2022-3869 Scanner template

    Code Injection in froxlor/froxlor

    Code Injection in GitHub repository froxlor/froxlor prior to 0.10.38.2.

  • Medium 6.2

    October CMS Safe Mode bypass leads to authenticated RCE (Remote Code Execution)

    October is a self-hosted Content Management System (CMS) platform based on the Laravel PHP Framework. This vulnerability only affects installations that rely on the safe mode restriction, commonly used when providing public access to the admin panel. Assuming…

  • Medium 4.3

    Code Injection in display of tag title on saving tags in microweber/microweber

    HTML injection attack is closely related to Cross-site Scripting (XSS). HTML injection uses HTML to deface the page. XSS, as the name implies, injects JavaScript into the page. Both attacks exploit insufficient validation of user input.

  • Medium 4.3
    CVE-2022-3242 Scanner template

    HTML code Injection in template search keyword in microweber/microweber

    Code Injection in GitHub repository microweber/microweber prior to 1.3.2.

  • Medium 6.7
    CVE-2021-4178 Public exploit

    fabric8 kubernetes-client vulnerable

    A arbitrary code execution flaw was found in the Fabric 8 Kubernetes client affecting versions 5.0.0-beta-1 and above. Due to an improperly configured YAML parsing, this will allow a local and privileged attacker to supply malicious YAML.

  • Medium 4.4

    A vulnerability using PendingIntent in DeX for PC prior to SMR Aug-2022 Release 1 allows attackers to access files with…

  • Medium 4.0

    A vulnerability using PendingIntent in Knox VPN prior to SMR Aug-2022 Release 1 allows attackers to access content prov…

  • Medium 4.1

    In JetBrains Rider before 2022.2 Trust and Open Project dialog could be bypassed, leading to local code execution

  • Medium 4.8

    WooCommerce < 6.6.0 - Admin+ Stored HTML Injection

    The WooCommerce WordPress plugin before 6.6.0 is vulnerable to stored HTML injection due to lack of escaping and sanitizing in the payment gateway titles

  • Medium 6.3

    Simple Ads Manager Plugin code injection

    A vulnerability classified as critical was found in Simple Ads Manager Plugin. This vulnerability affects unknown code. The manipulation leads to code injection. The attack can be initiated remotely.

  • Medium 6.3

    VaultPress Plugin code injection

    A vulnerability, which was classified as critical, was found in VaultPress Plugin 1.8.4. This affects an unknown part. The manipulation leads to code injection. It is possible to initiate the attack remotely.

  • Medium 6.3

    Elefant CMS layout code injection

    A vulnerability was found in Elefant CMS 1.3.12-RC. It has been declared as critical. Affected by this vulnerability is an unknown functionality of the file /designer/add/layout. The manipulation leads to code injection. The attack can be launched remotely. U…

  • Medium 5.3

    Code Injection in publify/publify

    Code Injection in GitHub repository publify/publify prior to 9.2.8.

  • Medium 6.9

    In JetBrains Rider before 2022.1 local code execution via links in ReSharper Quick Documentation was possible

  • Medium 6.9

    In JetBrains IntelliJ IDEA before 2022.1 local code execution via links in Quick Documentation was possible