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 8.8

    Synel SYnergy Fingerprint Terminals - CWE-78: 'OS Command Injection'

    Synel SYnergy Fingerprint Terminals - CWE-78: 'OS Command Injection'

  • High 8.3

    OS Command Injection in jgraph/drawio

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

  • High 7.2

    Code execution via System Configuration

    Improper Neutralization of commands allowed to be executed via OTRS System Configuration e.g. SchedulerCronTaskModule using UnitTests modules allows any authenticated attacker with admin privileges local execution of Code.This issue affects OTRS: from 7.0.X b…

  • High 7.2

    Command injection in firewall ip functionality in 1Panel

    1Panel is an open source Linux server operation and maintenance management panel. An OS command injection vulnerability exists in 1Panel firewall functionality. A specially-crafted HTTP request can lead to arbitrary command execution. An attacker can make an …

  • High 8.0

    A command injection vulnerability in the access point (AP) management feature of the Zyxel ATP series firmware versions…

  • High 8.8

    A command injection vulnerability in the Free Time WiFi hotspot feature of the Zyxel USG FLEX series firmware versions …

  • High 8.0

    A command injection vulnerability in the hotspot management feature of the Zyxel ATP series firmware versions 4.60 thro…

  • High 8.8
    CVE-2023-33012 Public exploit

    A command injection vulnerability in the configuration parser of the Zyxel ATP series firmware versions 5.10 through 5.…

  • High 8.8

    The configuration parser fails to sanitize user-controlled input in the Zyxel ATP series firmware versions 5.10 through…

  • High 8.8
    CVE-2023-34127 Public exploit EPSS 86%

    Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') vulnerability in SonicWall G…

  • High 8.2

    Improper input validation in the Zoom Desktop Client for Windows before version 5.15.0 may allow an unauthorized user t…

  • High 7.2

    An improper neutralization of special elements used in an OS command ('OS Command Injection') vulnerability [CWE-78] in…

  • High 7.2

    An OS command injection vulnerability exists in the ys_thirdparty check_system_user functionality of Milesight UR32L v3…

  • High 8.8

    An OS command injection vulnerability exists in the vtysh_ubus _get_fw_logs functionality of Milesight UR32L v32.3.0.5.…

  • High 7.2

    An OS command injection vulnerability exists in the ys_thirdparty system_user_script functionality of Milesight UR32L v…

  • High 8.8

    An OS command injection vulnerability exists in the vtysh_ubus tcpdump_start_cb functionality of Milesight UR32L v32.3.…

  • High 7.2

    Two OS command injection vulnerabilities exist in the zebra vlan_name functionality of Milesight UR32L v32.3.0.5. A spe…

  • High 7.2

    Two OS command injection vulnerabilities exist in the zebra vlan_name functionality of Milesight UR32L v32.3.0.5. A spe…

  • High 8.1

    A vulnerability arises out of a failure to comprehensively sanitize the processing of a zip file(s). Incomplete neutral…

  • High 7.8

    An OS common injection vulnerability exists in the ESM certificate API, whereby incorrectly neutralized special element…

  • High 7.2

    A valid, authenticated LXCA user with elevated privileges may be able to execute command injections through crafted cal…

  • High 7.7

    Remote inventory task command injection when using ssh command mode

    The GLPI Agent is a generic management agent. Prior to version 1.5, if glpi-agent is running remoteinventory task against an Unix platform with ssh command, an administrator user on the remote can manage to inject a command in a specific workflow the agent wo…

  • High 8.6

    Livebook Desktop's protocol handler can be exploited to execute arbitrary command on Windows

    Livebook is a web application for writing interactive and collaborative code notebooks. On Windows, it is possible to open a `livebook://` link from a browser which opens Livebook Desktop and triggers arbitrary code execution on victim's machine. Any user usi…

  • High 7.2
    CVE-2023-24261 EPSS 19%

    A vulnerability in GL.iNET GL-E750 Mudi before firmware v3.216 allows authenticated attackers to execute arbitrary code…

  • High 7.8

    KioWare for Windows through v8.33 was discovered to contain an incomplete blacklist filter for blocked dialog boxes on …

  • High 7.2

    IBM Security Directory Suite VA command execution

    IBM Security Directory Suite VA 8.0.1 through 8.0.1.19 could allow a remote authenticated attacker to execute arbitrary commands on the system by sending a specially crafted request. IBM X-Force ID: 228439.

  • High 7.8

    Multiple improper neutralization of special elements used in an os command ('OS Command Injection') vulnerabilties [CWE…

  • High 8.1

    OS command injection vulnerability exists in WPS Office version 10.8.0.6186. If a remote attacker who can conduct a man…

  • High 7.2

    OS command injection vulnerability exists in Wi-Fi AP UNIT allows. If this vulnerability is exploited, a remote authent…

  • High 7.2

    AMI BMC contains a vulnerability in the SPX REST API, where an attacker with the required privileges can inject arbitra…

  • High 7.2

    AMI BMC contains a vulnerability in the SPX REST API, where an attacker with the required privileges can inject arbitra…

  • High 7.5
    CVE-2023-34105 Scanner template

    SRS has command injection vulnerability in demonstration api-server for HTTP callback.

    SRS is a real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181. Prior to versions 5.0.157, 5.0-b1, and 6.0.48, SRS's `api-server` server is vulnerable to a drive-by command injection. An attacker may send a request to the …

  • High 8.8

    Manipulation of Internal Dovecot Variables in mailcow via crafted Passwords

    mailcow is a mail server suite based on Dovecot, Postfix and other open source software, that provides a modern web UI for user/server administration. A vulnerability has been discovered in mailcow which allows an attacker to manipulate internal Dovecot varia…

  • High 7.2
    CVE-2023-33381 Public exploit EPSS 22%

    A command injection vulnerability was found in the ping functionality of the MitraStar GPT-2741GNAC router (firmware ve…

  • High 8.8

    Furbo dog camera - Command Injection

    Furbo dog camera has insufficient filtering for special parameter of device log management function. An unauthenticated remote attacker in the Bluetooth network with normal user privileges can exploit this vulnerability to perform command injection attack to …

  • High 8.8

    ASUS RT-AC86U - Command Injection

    ASUS RT-AC86U does not filter special characters for parameters in specific web URLs. A remote attacker with normal user privileges can exploit this vulnerability to perform command injection attack to execute arbitrary system commands, disrupt system or term…

  • High 7.2

    Hitron Technologies Inc. CODA-5310 - Remote Command Execution

    Hitron CODA-5310 has insufficient filtering for specific parameters in the connection test function. A remote attacker authenticated as an administrator, can use the management page to perform command injection attacks, to execute arbitrary system command, ma…

  • High 7.2

    The post-authentication command injection vulnerability in the Zyxel NAS326 firmware versions prior to V5.21(AAZF.13)C0…

  • High 8.8
    CVE-2023-30253 Public exploit EPSS 82%

    Dolibarr vulnerable to remote code execution via uppercase manipulation

    Dolibarr before 17.0.1 allows remote code execution by an authenticated user via an uppercase manipulation: <?PHP instead of <?php in injected data.

  • High 7.8

    n158 vulnerable to Command Injection due to improper input sanitization in the 'module.exports' function

    All versions of the package n158 are vulnerable to Command Injection due to improper input sanitization in the 'module.exports' function. **Note:** To execute the code snippet and potentially exploit the vulnerability, the attacker needs to have the ability t…