Skip to content
OpenAdvisories

Weakness (CWE)

CWE-78: OS Command Injection

Base Improper Neutralization of Special Elements used in an OS Command

The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command before it is sent to a downstream component.

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

    If at all possible, use library calls rather than external processes to recreate the desired functionality.

  2. Architecture and Design, Operation

    Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software.

    OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations.

    This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise.

    Be careful to avoid CWE-243 and other weaknesses related to jails.

  3. Architecture and Design

    For any data that will be used to generate a command to be executed, keep as much of that data out of external control as possible. For example, in web applications, this may require storing the data locally in the session's state instead of sending it out to the client in a hidden form field.

  4. Architecture and Design

    For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.

  5. Architecture and Design

    Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.

    For example, consider using the ESAPI Encoding control [REF-45] or a similar tool, library, or framework. These will help the programmer encode outputs in a manner less prone to error.

  6. Implementation

    While it is risky to use dynamically-generated query strings, code, or commands that mix control and data together, sometimes it may be unavoidable. Properly quote arguments and escape any special characters within those arguments. The most conservative approach is to escape or filter all characters that do not pass an extremely strict allowlist (such as everything that is not alphanumeric or white space). If some special characters are still needed, such as white space, wrap each argument in quotes after the escaping/filtering step. Be careful of argument injection (CWE-88).

  7. Implementation

    If the program to be executed allows arguments to be specified within an input file or from standard input, then consider using that mode to pass arguments instead of the command line.

  8. Architecture and Design

    If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated.

    Some languages offer multiple functions that can be used to invoke commands. Where possible, identify any function that invokes a command shell using a single string, and replace it with a function that requires individual arguments. These functions typically perform appropriate quoting and filtering of arguments. For example, in C, the system() function accepts a string that contains the entire command to be executed, whereas execl(), execve(), and others require an array of strings, one for each argument. In Windows, CreateProcess() only accepts one command at a time. In Perl, if system() is provided with an array of arguments, then it will quote each of the arguments.

Source: MITRE CWE-78

2,705 results · Clear filters · Feed

  • High 7.8

    Jhead 3.06.0.1 allows attackers to execute arbitrary OS commands by placing them in a JPEG filename and then using the …

  • High 8.8

    Dell Container Storage Modules 1.2 contains an OS Command Injection in goiscsi and gobrick libraries. A remote unauthen…

  • High 8.4

    Puppetlabs-mysql Command Injection

    Command injection is possible in the puppetlabs-mysql module prior to version 13.0.0. A malicious actor is able to exploit this vulnerability only if they are able to provide unsanitized input to the module. This condition is rare in most deployments of Puppe…

  • High 8.4

    Puppetlabs-apt Command Injection

    Command injection is possible in the puppetlabs-apt module prior to version 9.0.0. A malicious actor is able to exploit this vulnerability only if they are able to provide unsanitized input to the module. This condition is rare in most deployments of Puppet a…

  • High 7.8

    Snyk CLI affected by Command Injection vulnerability

    Snyk CLI before 1.996.0 allows arbitrary command execution, affecting Snyk IDE plugins and the snyk npm package. Exploitation could follow from the common practice of viewing untrusted files in the Visual Studio Code editor, for example. The original demonstr…

  • High 8.8

    Unsanitized input when setting a locale file leads to shell injection in mIPC camera firmware 5.3.1.2003161406. This al…

  • High 7.0

    Arbitrary shell execution when extracting or listing files contained in a malicious rpm.

    Arr-pm is an RPM reader/writer library written in Ruby. Versions prior to 0.0.12 are subject to OS command injection resulting in shell execution if the RPM contains a malicious "payload compressor" field. This vulnerability impacts the `extract` and `files` …

  • High 7.2

    Vulnerabilities in the ClearPass Policy Manager web-based management interface allow remote authenticated users to run …

  • High 7.2

    Vulnerabilities in the ClearPass Policy Manager web-based management interface allow remote authenticated users to run …

  • High 7.2

    Vulnerabilities in the ClearPass Policy Manager web-based management interface allow remote authenticated users to run …

  • High 7.0

    OS Command Injection in jgraph/drawio

    OS Command Injection in GitHub repository jgraph/drawio prior to 20.3.0.

  • High 7.2

    OS Command Injection Vulnerability in RAID Manager Storage Replication Adapter

    OS Command Injection vulnerability in Hitachi RAID Manager Storage Replication Adapter allows remote authenticated users to execute arbitrary OS commands. This issue affects: Hitachi RAID Manager Storage Replication Adapter 02.01.04 versions prior to 02.03.02…

  • High 8.1

    Command Injection on tinygltf

    The tinygltf library uses the C library function wordexp() to perform file path expansion on untrusted paths that are provided from the input file. This function allows for command injection by using backticks. An attacker could craft an untrusted path input …

  • High 8.8

    Dell Container Storage Modules 1.2 contains an OS command injection in goiscsi and gobrick libraries. A remote authenti…

  • High 8.6

    SmartFabric storage software version 1.0.0 contains a Command-Injection vulnerability. A remote unauthenticated attacke…

  • High 7.8
    CVE-2022-36510 EPSS 11%

    H3C GR2200 MiniGR1A0V100R014 was discovered to contain a command injection vulnerability via the param parameter at Del…

  • High 7.8
    CVE-2022-36509 EPSS 11%

    H3C GR3200 MiniGR1B0V100R014 was discovered to contain a command injection vulnerability via the param parameter at Del…

  • High 8.8
    CVE-2022-36804 Exploited Public exploit Scanner template EPSS 99%

    Multiple API endpoints in Atlassian Bitbucket Server and Data Center 7.0.0 before version 7.6.17, from version 7.7.0 be…

    KEV Sep 30, 2022
  • High 8.2

    Command injection vulnerability in Linksys MR8300 router while Registration to DDNS Service. By specifying username and password, an attacker connected to the router's web interface can execute arbitrary OS commands.

    Command injection vulnerability in Linksys MR8300 router while Registration to DDNS Service. By specifying username and password, an attacker connected to the router's web interface can execute arbitrary OS commands. The username and password fields are not s…

  • High 7.3

    A potential vulnerability was reported in Lenovo PCManager prior to version 5.0.10.4191 that may allow code execution w…

  • High 8.0

    Remote Code Execution in Device42 ApplianceManager console

    OS Command Injection vulnerability in the db_optimize component of Device42 Asset Management Appliance allows an authenticated attacker to execute remote code on the device. This issue affects: Device42 CMDB version 18.01.00 and prior versions.

  • High 7.2

    Improper neutralization of special elements used in an OS command ('OS Command Injection') vulnerability in webapi comp…

  • High 7.2

    Improper neutralization of special elements used in an OS command ('OS Command Injection') vulnerability in task manage…

  • High 8.6

    Arbitrary Code Execution

    This affects the package thenify before 3.3.1. The name argument provided to the package can be controlled by users without any sanitization, and this is provided to the eval function without any sanitization.

  • High 8.0
    CVE-2022-2488 Scanner template EPSS 33%

    WAVLINK WN535K2/WN535K3 touchlist_sync.cgi os command injection

    A vulnerability was found in WAVLINK WN535K2 and WN535K3 and classified as critical. This issue affects some unknown processing of the file /cgi-bin/touchlist_sync.cgi. The manipulation of the argument IP leads to os command injection. The exploit has been di…

  • High 8.0
    CVE-2022-2487 Scanner template EPSS 79%

    WAVLINK WN535K2/WN535K3 nightled.cgi os command injection

    A vulnerability has been found in WAVLINK WN535K2 and WN535K3 and classified as critical. This vulnerability affects unknown code of the file /cgi-bin/nightled.cgi. The manipulation of the argument start_hour leads to os command injection. The exploit has bee…

  • High 8.0
    CVE-2022-2486 Scanner template EPSS 30%

    WAVLINK WN535K2/WN535K3 os command injection

    A vulnerability, which was classified as critical, was found in WAVLINK WN535K2 and WN535K3. This affects an unknown part of the file /cgi-bin/mesh.cgi?page=upgrade. The manipulation of the argument key leads to os command injection. The exploit has been disc…

  • High 8.8
    CVE-2022-33891 Exploited Public exploit Scanner template EPSS 93%

    Apache Spark shell command injection vulnerability via Spark UI

    The Apache Spark UI offers the possibility to enable ACLs via the configuration option spark.acls.enable. With an authentication filter, this checks whether a user has access permissions to view or modify the application. If ACLs are enabled, a code path in H…

    KEV Mar 7, 2023
  • High 8.8
    CVE-2022-34753 Scanner template EPSS 71%

    A CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') vulnerability exis…

  • High 8.8
    CVE-2022-31138 Public exploit

    OS Command Injection in mailcow

    mailcow is a mailserver suite. Prior to mailcow-dockerized version 2022-06a, an extended privilege vulnerability can be exploited by manipulating the custom parameters regexmess, skipmess, regexflag, delete2foldersonly, delete2foldersbutnot, regextrans2, pipe…

  • High 7.5
    CVE-2022-28171 Public exploit EPSS 52%

    The web module in some Hikvision Hybrid SAN/Cluster Storage products have the following security vulnerability. Due to …

  • High 8.8
    CVE-2022-33140 Public exploit

    Improper Neutralization of Command Elements in Shell User Group Provider

    The optional ShellUserGroupProvider in Apache NiFi 1.10.0 to 1.16.2 and Apache NiFi Registry 0.6.0 to 1.16.2 does not neutralize arguments for group resolution commands, allowing injection of operating system commands on Linux and macOS platforms. The ShellUs…

  • High 8.8

    Command injection via Advanced Networking route add functionality

    An authenticated attacker can send a specially crafted route to the “edit_route.cgi” binary and have it execute shell commands. This vulnerability impacts products based on HID Mercury Intelligent Controllers LP1501, LP1502, LP2500, LP4502, and EP4502 which c…

  • High 8.1

    Command Injection

    The package cookiecutter before 2.1.1 are vulnerable to Command Injection via hg argument injection. When calling the cookiecutter function from Python code with the checkout parameter, it is passed to the hg checkout command in a way that additional flags ca…

  • High 8.8

    OS Command Injection in lifion-verify-deps

    lifion-verify-dependencies through 1.1.0 is vulnerable to OS command injection via a crafted dependency name on the scanned project's package.json file.

  • High —

    OS Command injection in ssl-utils

    OS Command Injection vulnerability in es128 ssl-utils 1.0.0 for Node.js allows attackers to execute arbitrary commands via unsanitized shell metacharacters provided to the createCertRequest() and the createCert() functions.

  • High 8.8

    OS Command Injection in gitsome

    OS Command Injection vulnerability in bbultman gitsome through 0.2.3 allows attackers to execute arbitrary commands via a crafted tag name of the target git repository.

  • High —

    OS Command Injection in proctree

    OS Command Injection vulnerability in allenhwkim proctree through 0.1.1 and commit 0ac10ae575459457838f14e21d5996f2fa5c7593 for Node.js, allows attackers to execute arbitrary commands via the fix function.

  • High —

    OS Command Injection in s3-uploader

    OS command injection vulnerability in Turistforeningen node-s3-uploader through 2.0.3 for Node.js allows attackers to execute arbitrary commands via the metadata() function.

  • High 8.1

    Command injection in google-it

    Google-it is a Node.js package which allows its users to send search queries to Google and receive the results in a JSON format. When using the 'Open in browser' option in versions up to 1.6.2, google-it will unsafely concat the result's link retrieved from g…