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

    Command-injection Vulnerability in Certificate Management

    TN-4900 Series firmware versions v1.2.4 and prior and TN-5900 Series firmware versions v3.3 and prior are vulnerable to the command injection vulnerability. This vulnerability stems from inadequate input validation in the certificate management function, whic…

  • High 8.8

    A post-authentication command injection vulnerability in the NTP feature of Zyxel NBG6604 firmware version V1.01(ABIR.1…

  • High 7.2

    The Dataprobe iBoot PDU running firmware version 1.43.03312023 or earlier is vulnerable to command injection via the `u…

  • High 8.8

    Command injection via active checks and REST API

    Improper neutralization of active check command arguments in Checkmk < 2.1.0p32, < 2.0.0p38, < 2.2.0p4 leads to arbitrary command execution for authenticated users.

  • High 8.8

    A SQL injection vulnerability exists in the “logging export” feature of the ScienceLogic SL1 that takes unsanitized use…

  • High 8.8

    A SQL injection vulnerability exists in the “message viewer iframe” feature of the ScienceLogic SL1 that takes unsaniti…

  • High 8.8

    A SQL injection vulnerability exists in the “message viewer print” feature of the ScienceLogic SL1 that takes unsanitiz…

  • High 8.8

    A SQL injection vulnerability exists in the “network print report” feature of the ScienceLogic SL1 that takes unsanitiz…

  • High 8.8

    A SQL injection vulnerability exists in the “notes view” feature of the ScienceLogic SL1 that takes unsanitized user‐co…

  • High 8.8

    A SQL injection vulnerability exists in the “reporter events type” feature of the ScienceLogic SL1 that takes unsanitiz…

  • High 8.8

    A SQL injection vulnerability exists in the “reporter events type date” feature of the ScienceLogic SL1 that takes unsa…

  • High 8.8

    A SQL injection vulnerability exists in the “ticket event report” feature of the ScienceLogic SL1 that takes unsanitize…

  • High 8.8

    A SQL injection vulnerability exists in the “ticket queue watchers” feature of the ScienceLogic SL1 that takes unsaniti…

  • High 8.8

    A SQL injection vulnerability exists in the “ticket template watchers” feature of the ScienceLogic SL1 that takes unsan…

  • High 8.8

    A SQL injection vulnerability exists in the “ticket watchers email” feature of the ScienceLogic SL1 that takes unsaniti…

  • High 8.8

    A SQL injection vulnerability exists in the “topology data service” feature of the ScienceLogic SL1 that takes unsaniti…

  • High 8.8

    A SQL injection vulnerability exists in the vendor_country parameter of the “vendor print report” feature of the Scienc…

  • High 8.8

    A SQL injection vulnerability exists in the vendor_state parameter of the “vendor print report” feature of the ScienceL…

  • High 8.8

    A SQL injection vulnerability exists in the “admin dynamic app mib errors” feature of the ScienceLogic SL1 that takes u…

  • High 8.8

    A SQL injection vulnerability exists in the “reporting job editor” feature of the ScienceLogic SL1 that takes unsanitiz…

  • High 8.8

    A SQL injection vulnerability exists in the “schedule editor decoupled” feature of the ScienceLogic SL1 that takes unsa…

  • High 8.8

    A SQL injection vulnerability exists in the “schedule editor” feature of the ScienceLogic SL1 that takes unsanitized us…

  • High 8.8

    A SQL injection vulnerability exists in the “json walker” feature of the ScienceLogic SL1 that takes unsanitized user‐c…

  • High 8.8

    A SQL injection vulnerability exists in the “admin brand portal” feature of the ScienceLogic SL1 that takes unsanitized…

  • High 8.8

    A command injection vulnerability exists in the download and convert report feature of the ScienceLogic SL1 that takes …

  • High 8.8

    A command injection vulnerability exists in the dashboard scheduler feature of the ScienceLogic SL1 that takes unsaniti…

  • High 8.8

    A command injection vulnerability exists in the ticket report generate feature of the ScienceLogic SL1 that takes unsan…

  • High 8.8

    A command injection vulnerability exists in the “dash export” feature of the ScienceLogic SL1 that takes unsanitized us…

  • High 8.8

    A command injection vulnerability exists in the ARP ping device tool feature of the ScienceLogic SL1 that takes unsanit…

  • High 7.2

    PHOENIX CONTACT: OS Command Injection in WP 6xxx Web panels

    In PHOENIX CONTACTs WP 6xxx series web panels in versions prior to 4.0.10 a remote attacker with SNMPv2 write privileges may use an a special SNMP request to gain full access to the device.

  • High 8.8

    PHOENIX CONTACT: OS Command Injection in WP 6xxx Web panels

    In PHOENIX CONTACTs WP 6xxx series web panels in versions prior to 4.0.10 an authenticated remote attacker can execute code with root permissions with a specially crafted HTTP POST when uploading a certificate to the device.

  • High 8.8
    CVE-2023-37569 Public exploit EPSS 34%

    OS Command Injection Vulnerability in Emagic Data Center Management Suite

    This vulnerability exists in ESDS Emagic Data Center Management Suit due to lack of input sanitization in its Ping component. A remote authenticated attacker could exploit this by injecting OS commands on the targeted system. Successful exploitation of this v…

  • High 8.8

    PHOENIX CONTACT: OS Command Injection in WP 6xxx Web panels

    In PHOENIX CONTACTs WP 6xxx series web panels in versions prior to 4.0.10 a remote attacker with low privileges may use a specific HTTP DELETE request to gain full access to the device.

  • High 8.8

    PHOENIX CONTACT: OS Command Injection in WP 6xxx Web panels

    In PHOENIX CONTACTs WP 6xxx series web panels in versions prior to 4.0.10 a remote attacker with low privileges may use a specific HTTP POST releated to certificate operations to gain full access to the device.

  • High 8.8

    PHOENIX CONTACT: Command Injection in WP 6xxx Web panels

    In PHOENIX CONTACTs WP 6xxx series web panels in versions prior to 4.0.10 a remote attacker with low privileges may use a command injection in a HTTP POST request releated to font configuration operations to gain full access to the device.

  • High 7.2

    Non-sanitized user input could lead to arbitrary code execution during Access Control configuration in AXIS License Plate Verifier

    User provided input is not sanitized in the “Settings > Access Control” configuration interface allowing for arbitrary code execution.

  • High 7.2

    Non-sanitized user input could lead to arbitrary code execution in AXIS License Plate Verifier

    User provided input is not sanitized on the AXIS License Plate Verifier specific “api.cgi” allowing for arbitrary code execution.

  • High 7.0

    Xiaomi router external request interface has command injection

    Xiaomi routers have an external interface that can lead to command injection. The vulnerability is caused by lax filtering of responses from external interfaces. Attackers can exploit this vulnerability to gain access to the router by hijacking the ISP or upp…

  • High 8.8

    OS Command Injection in mlflow/mlflow

    OS Command Injection in GitHub repository mlflow/mlflow prior to 2.6.0.

  • High 7.2

    IBM Security Verify Governance command execution

    IBM Security Verify Governance, Identity Manager 10.0 could allow a remote authenticated attacker to execute arbitrary commands on the system by sending a specially crafted request. IBM X-Force ID: 257873.