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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

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

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

CWE-77 represents a critical input validation weakness where software constructs commands using untrusted data without properly sanitizing special characters. Attackers typically exploit this by injecting malicious payloads, such as semicolons or pipe operators, into user-supplied fields to alter the intended command structure. This allows them to execute arbitrary system commands, potentially leading to full system compromise, data exfiltration, or denial of service. To prevent such vulnerabilities, developers must strictly validate and sanitize all external inputs, ensuring that only expected data formats are processed. Utilizing parameterized APIs or safe command execution libraries instead of direct string concatenation significantly reduces risk. Additionally, implementing the principle of least privilege for application processes limits the potential impact of successful injection attempts, thereby enhancing overall system security against command injection attacks.

MITRE CWE Description
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. Many protocols and products have their own custom command language. While OS or shell command strings are frequently discovered and targeted, developers may not realize that these other command languages might also be vulnerable to attacks.
Common Consequences (1)
Integrity, Confidentiality, AvailabilityExecute Unauthorized Code or Commands
If a malicious user injects a character (such as a semi-colon) that delimits the end of one command and the beginning of another, it may be possible to then insert an entirely new and unrelated command that was not intended to be executed. This gives an attacker a privilege or capability that they w…
Mitigations (5)
Architecture and DesignIf at all possible, use library calls rather than external processes to recreate the desired functionality.
ImplementationIf possible, ensure that all external commands called from the program are statically created.
ImplementationAssume 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…
OperationRun time: Run time policy enforcement may be used in an allowlist fashion to prevent use of any non-sanctioned commands.
System ConfigurationAssign permissions that prevent the user from accessing/opening privileged files.
Examples (2)
Consider a "CWE Differentiator" application that uses an an LLM generative AI based "chatbot" to explain the difference between two weaknesses. As input, it accepts two CWE IDs, constructs a prompt string, sends the prompt to the chatbot, and prints the results. The prompt string effectively acts as a command to the chatbot component. Assume that invokeChatbot() calls the chatbot and returns the …
prompt = "Explain the difference between {} and {}".format(arg1, arg2) result = invokeChatbot(prompt) resultHTML = encodeForHTML(result) print resultHTML
Bad · Python
Explain the difference between CWE-77 and CWE-78
Informative
Consider the following program. It intends to perform an "ls -l" on an input filename. The validate_name() subroutine performs validation on the input to make sure that only alphanumeric and "-" characters are allowed, which avoids path traversal (CWE-22) and OS command injection (CWE-78) weaknesses. Only filenames like "abc" or "d-e-f" are intended to be allowed.
my $arg = GetArgument("filename"); do_listing($arg); sub do_listing { my($fname) = @_; if (! validate_name($fname)) { print "Error: name is not well-formed!\n"; return; } # build command my $cmd = "/bin/ls -l $fname"; system($cmd); } sub validate_name { my($name) = @_; if ($name =~ /^[\w\-]+$/) { return(1); } else { return(0); } }
Bad · Perl
if ($name =~ /^\w[\w\-]+$/) ...
Good · Perl
CVE IDTitleCVSSSeverityPublished
CVE-2018-0217 Cisco ASR 5000 Series Aggregation Services Routers StarOS操作系统CLI 命令注入漏洞 — Cisco StarOS 6.7 -2018-03-08
CVE-2018-0224 Cisco ASR 5000 Series Aggregation Services Routers StarOS操作系统命令注入漏洞 — Cisco StarOS 6.7 -2018-03-08
CVE-2018-5439 Nortek Linear eMerge E3 series 命令注入漏洞 — Nortek Linear eMerge E3 Series 9.8 -2018-02-19
CVE-2017-15889 Synology DiskStation Manager 命令注入漏洞 — DiskStation Manager (DSM) 8.8 -2017-12-04
CVE-2017-12329 多款Cisco产品Multilayer Director Switches和Firepower Extensible Operating System 安全漏洞 — Cisco FXOS and NX-OS 8.7 -2017-11-30
CVE-2017-12330 Cisco产品Cisco NX-OS System Software 命令注入漏洞 — Cisco Nexus Series Switches 8.7 -2017-11-30
CVE-2017-12335 多款Cisco产品Cisco NX-OS System Software 命令注入漏洞 — Cisco NX-OS 8.7 -2017-11-30
CVE-2017-12339 多款Cisco产品Cisco NX-OS System Software 命令注入漏洞 — Cisco NX-OS 8.7 -2017-11-30
CVE-2017-12341 多款Cisco产品Cisco NX-OS System Software 命令注入漏洞 — Cisco NX-OS 6.7 -2017-11-30
CVE-2017-12352 Cisco Application Policy Infrastructure Controller 命令注入漏洞 — Cisco Application Policy Infrastructure Controller 6.7 -2017-11-30
CVE-2017-12305 Cisco IP Phone 8800系列debug界面命令注入漏洞 — Cisco IP Phone 8800 Series 6.7 -2017-11-16
CVE-2017-6048 Satel Iberia SenNet Data Logger和Electricity Meters 命令注入漏洞 — Satel Iberia SenNet Data Logger and Electricity Meters 8.8 -2017-05-19
CVE-2016-10329 Synology Photo Station 命令注入漏洞 — Synology Photo Station 9.8 -2017-05-12
CVE-2014-9188 Schneider Electric ProClima Command Injection — ProClima 9.8 -2014-12-27
CVE-2014-0773 Advantech WebAccess Command Injection — WebAccess 8.1 -2014-04-12

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