Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CWE-78 (OS命令中使用的特殊元素转义处理不恰当(OS命令注入)) — Vulnerability Class 4016

4016 vulnerabilities classified as CWE-78 (OS命令中使用的特殊元素转义处理不恰当(OS命令注入)). AI Chinese analysis included.

CWE-78 represents a critical input validation weakness where software constructs operating system commands using untrusted external data without proper sanitization. Attackers typically exploit this by injecting malicious shell metacharacters, such as semicolons or pipes, into user-supplied fields like form inputs or URL parameters. This manipulation allows the attacker to alter the intended command structure, enabling arbitrary code execution, data exfiltration, or complete system compromise. To mitigate this risk, developers must strictly avoid passing user input directly to OS command interpreters. Instead, they should utilize safe, language-specific APIs that do not invoke the shell, or implement rigorous input validation and parameterization techniques. By treating all external data as inherently untrusted and applying strict allow-list filtering, organizations can effectively neutralize special elements and prevent command injection vulnerabilities.

MITRE CWE Description
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 when it is sent to a downstream component. This weakness can lead to a vulnerability in environments in which the attacker does not have direct access to the operating system, such as in web applications. Alternately, if the weakness occurs in a privileged program, it could allow the attacker to specify commands that normally would not be accessible, or to call alternate commands with privileges that the attacker does not have. The problem is exacerbated if the compromised process does not follow the principle of least privilege, because the attacker-controlled commands may run with special system privileges that increases the amount of damage. There are at least two subtypes of OS command injection: The application intends to execute a single, fixed program that is under its own control. It intends to use externally-supplied inputs as arguments to that program. For example, the program might use system("nslookup [HOSTNAME]") to run nslookup and allow the user to supply a HOSTNAME, which is used as an argument. Attackers cannot prevent nslookup from executing. However, if the program does not remove command separators from the HOSTNAME argument, attackers could place the separators into the arguments, which allows them to execute their own program afte…
Common Consequences (1)
Confidentiality, Integrity, Availability, Non-Repudiation Execute Unauthorized Code or Commands, DoS: Crash, Exit, or Restart, Read Files or Directories, Modify Files or Directories, Read Application Data, Modify Application Data, Hide Activities
Attackers could execute unauthorized operating system commands, which could then be used to disable the product, or read and modify data for which the attacker does not have permissions to access directly. Since the targeted application is directly executing the commands instead of the attacker, any…
Mitigations (5)
Architecture and Design If at all possible, use library calls rather than external processes to recreate the desired functionality.
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 ex…
Effectiveness: Limited
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.
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.
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.
Examples (2)
This example code intends to take the name of a user and list the contents of that user's home directory. It is subject to the first variant of OS command injection.
$userName = $_POST["user"]; $command = 'ls -l /home/' . $userName; system($command);
Bad · PHP
;rm -rf /
Attack
The following simple program accepts a filename as a command line argument and displays the contents of the file back to the user. The program is installed setuid root because it is intended for use as a learning tool to allow system administrators in-training to inspect privileged system files without giving them the ability to modify them or damage the system.
int main(int argc, char** argv) { char cmd[CMD_MAX] = "/usr/bin/cat "; strcat(cmd, argv[1]); system(cmd); }
Bad · C
CVE ID Title CVSS Severity Published
CVE-2021-40409 Reolink Rlc-410W 操作系统命令注入漏洞 — n/a 9.8 - 2022-01-28
CVE-2021-40407 Reolink Rlc-410W 操作系统命令注入漏洞 — n/a 9.8 - 2022-01-28
CVE-2021-40408 Reolink Rlc-410W 操作系统命令注入漏洞 — n/a 9.8 - 2022-01-28
CVE-2021-32849 Arbitrary command execution in Gerapy — gerapy 8.8 High 2022-01-26
CVE-2021-36296 Dell Vnx2 Oe For File 操作系统命令注入漏洞 — VNX Control Station 7.2 High 2022-01-25
CVE-2021-36295 Dell Vnx2 Oe For File 操作系统命令注入漏洞 — VNX Control Station 7.2 High 2022-01-25
CVE-2021-31854 Code injection vulnerability in McAfee Agent — McAfee Agent for Windows 7.7 High 2022-01-19
CVE-2022-22991 Command injection through unsecured HTTP calls on Western Digital My Cloud devices — My Cloud 7.8 High 2022-01-13
CVE-2021-35032 Zyxel GS1900 操作系统命令注入漏洞 — GS1900 series firmware 6.4 Medium 2021-12-28
CVE-2021-35031 ZyXEL GS1900 操作系统命令注入漏洞 — GS1900 series firmware 6.8 Medium 2021-12-28
CVE-2021-43857 Gerapy may contain remote code execution vulnerability — Gerapy 9.8 Critical 2021-12-27
CVE-2021-3584 Foreman 操作系统命令注入漏洞 — foreman 7.2 - 2021-12-23
CVE-2021-43981 mySCADA myPRO — myPRO 10.0 Critical 2021-12-23
CVE-2021-43984 mySCADA myPRO — myPRO 10.0 Critical 2021-12-23
CVE-2021-44453 mySCADA myPRO — myPRO 10.0 Critical 2021-12-23
CVE-2021-22657 mySCADA myPRO — myPRO 10.0 Critical 2021-12-23
CVE-2021-23198 mySCADA myPRO — myPRO 10.0 Critical 2021-12-23
CVE-2021-4144 TP-Link TL-WR802N 操作系统命令注入漏洞 — TL-WR802N V4(JP) 8.8 - 2021-12-23
CVE-2021-21888 Lantronix PremierWave 2050 操作系统命令注入漏洞 — Lantronix 9.1 - 2021-12-22
CVE-2021-21884 Lantronix PremierWave 2050 操作系统命令注入漏洞 — Lantronix 9.1 - 2021-12-22
CVE-2021-21883 Lantronix PremierWave 2050 操作系统命令注入漏洞 — Lantronix 9.9 - 2021-12-22
CVE-2021-21881 Lantronix PremierWave 2050 操作系统命令注入漏洞 — Lantronix 9.1 - 2021-12-22
CVE-2021-21882 Lantronix PremierWave 操作系统命令注入漏洞 — Lantronix 9.1 - 2021-12-22
CVE-2021-21877 Lantronix PremierWave 2050 操作系统命令注入漏洞 — Lantronix 9.9 - 2021-12-22
CVE-2021-21875 Lantronix PremierWave 2050 操作系统命令注入漏洞 — Lantronix 9.1 - 2021-12-22
CVE-2021-21876 Lantronix PremierWave 2050 操作系统命令注入漏洞 — Lantronix 9.9 - 2021-12-22
CVE-2021-21874 Lantronix PremierWave 2050 操作系统命令注入漏洞 — Lantronix 9.1 - 2021-12-22
CVE-2021-21873 Lantronix PremierWave 2050 操作系统命令注入漏洞 — Lantronix 9.1 - 2021-12-22
CVE-2021-21872 Lantronix PremierWave 2050 操作系统命令注入漏洞 — Lantronix 9.9 - 2021-12-22
CVE-2020-8105 Command Execution due to unsanitized input — iota All-In-One Security Kit 9.6 Critical 2021-12-20

Vulnerabilities classified as CWE-78 (OS命令中使用的特殊元素转义处理不恰当(OS命令注入)) represent 4016 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.