CWEweakness
CWE-77 Improper Neutralization of Special Elements used in a Command
High
Official page ↗
- Alternate terms
- Command injection
- Abstraction
- Class
- Structure
- Simple
- Status
- Draft
- Likelihood of exploit
- High
- Languages
- Not Language-Specific
- CWE version
- 5.0
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.
Extended description
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
• Integrity, Confidentiality, Availability: Execute 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 would not otherwise have.
Potential mitigations
• [Architecture and Design] If at all possible, use library calls rather than external processes to recreate the desired functionality.
• [Implementation] If possible, ensure that all external commands called from the program are statically created.
• [Implementation] Assume 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 of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
• [Operation] Run time: Run time policy enforcement may be used in an allowlist fashion to prevent use of any non-sanctioned commands.
• [System Configuration] Assign permissions that prevent the user from accessing/opening privileged files.
Detection methods
• Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Observed examples
• CVE-2026-27806: Device management product allows injection of Tcl/expect commands
• CVE-2022-1509: injection of sed script syntax ("sed injection")
• CVE-2024-5184: ML-based email analysis product uses an
API service that allows a malicious user to inject a
direct prompt and take over the service logic, forcing
it to leak the standard hard-coded system prompts
and/or execute unwanted prompts to leak sensitive
data.
• CVE-2020-11698: anti-spam product allows injection of SNMP commands into configuration file
• CVE-2019-12921: image program allows injection of commands in "Magick Vector Graphics (MVG)" language.
• CVE-2022-36069: Python-based dependency management tool avoids OS command injection when generating Git commands but allows injection of optional arguments with input beginning with a dash (CWE-88), potentially allowing for code execution.
• CVE-1999-0067: Canonical example of OS command injection. CGI program does not neutralize "|" metacharacter when invoking a phonebook program.
• CVE-2020-9054: Chain: improper input validation (CWE-20) in username parameter, leading to OS command injection (CWE-78), as exploited in the wild per CISA KEV.
• CVE-2021-41282: injection of sed script syntax ("sed injection")
• CVE-2019-13398: injection of sed script syntax ("sed injection")
Related
Attack pattern · CAPEC (8)
- CAPEC-136 LDAP Injection attack pattern
- CAPEC-15 Command Delimiters attack pattern
- CAPEC-183 IMAP/SMTP Command Injection attack pattern
- CAPEC-248 Command Injection attack pattern
- CAPEC-40 Manipulating Writeable Terminal Devices attack pattern
- CAPEC-43 Exploiting Multiple Input Interpretation Layers attack pattern
- CAPEC-75 Manipulating Writeable Configuration Files attack pattern
- CAPEC-76 Manipulating Web Input to File System Calls attack pattern
Observed example · CVE (10)
- CVE-2026-27806 Fleet is open source device management software. vulnerability
- CVE-2024-5184 The EmailGPT service contains a prompt injection vulnerability. vulnerability
- CVE-2022-36069 Poetry is a dependency manager for Python. vulnerability
- CVE-2022-1509 Command Injection Vulnerability in GitHub repository hestiacp/hestiacp prior to 1.5.12. vulnerability
- CVE-2021-41282 diag_routes.php in pfSense 2.5.2 allows sed data injection. vulnerability
- CVE-2020-11698 An issue was discovered in Titan SpamTitan 7.07. vulnerability
- CVE-2019-12921 In GraphicsMagick before 1.3.32, the text filename component allows remote attackers to read arbitrary files via a crafted image because of… vulnerability
- CVE-2020-9054 Multiple ZyXEL network-attached storage (NAS) devices running firmware version 5.21 contain a pre-authentication command injection… vulnerability
- CVE-2019-13398 Dynacolor FCM-MB40 v1.2.0.0 devices allow remote attackers to execute arbitrary commands via a crafted parameter to a CGI script, as… vulnerability
- CVE-1999-0067 phf CGI program allows remote command execution through shell metacharacters. vulnerability
Child of · CWE (1)
- CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component weakness
Referenced by CAPEC · weakness (8)
- CAPEC-136 LDAP Injection attack pattern
- CAPEC-15 Command Delimiters attack pattern
- CAPEC-183 IMAP/SMTP Command Injection attack pattern
- CAPEC-248 Command Injection attack pattern
- CAPEC-40 Manipulating Writeable Terminal Devices attack pattern
- CAPEC-43 Exploiting Multiple Input Interpretation Layers attack pattern
- CAPEC-75 Manipulating Writeable Configuration Files attack pattern
- CAPEC-76 Manipulating Web Input to File System Calls attack pattern
Referenced by CVE · weakness (3,971)
- CVE-2026-107672 A maliciously crafted .stack.json file can trigger a trusted Markdown injection vulnerability in Autodesk Fusion Post Processor Utility… vulnerability
- CVE-2026-108303 Tanium addressed an unauthorized code execution vulnerability in Certificate Manager. vulnerability
- CVE-2026-108329 Tanium addressed an unauthorized code execution vulnerability in Threat Response. vulnerability
- CVE-2026-117511 A vulnerability has been found in desmondmorris node-tesseract up to 0.2.7. vulnerability
- CVE-2026-90465 A missing authentication vulnerability in the FireCluster Sync processing allows an attacker positioned on the cluster interconnect, such… vulnerability
- CVE-2026-93865 A missing authentication vulnerability in the Fireware OS FireCluster synchronization daemon allows a remote, unauthenticated attacker to… vulnerability
- CVE-2026-116102 A vulnerability was determined in QuantGeekDev docker-mcp 0.1.0/0.2.0. vulnerability
- CVE-2026-116109 A vulnerability has been found in continuedev Continue 2.0.0. vulnerability
- CVE-2026-116118 A vulnerability has been found in Z.ai Zcode up to 3.14.3/3.15.1. vulnerability
- CVE-2026-116369 A vulnerability was identified in Sunwood-ai-labs github-kanban-mcp-server up to 0.4.0. vulnerability
- CVE-2026-116504 A vulnerability has been found in TOTOLINK A950RG 4.1.2cu.5268_B20221104. vulnerability
- CVE-2026-116505 A vulnerability was found in TOTOLINK A950RG 4.1.2cu.5268_B20221104. vulnerability
- CVE-2026-116506 A vulnerability was determined in TOTOLINK A950RG 4.1.2cu.5268_B20221104. vulnerability
- CVE-2026-116053 A weakness has been identified in dbcli mycli up to 2.29.4/2.30.1. vulnerability
- CVE-2026-115969 A flaw has been found in Travisun Opptrix 0.4.0. vulnerability
- CVE-2026-115995 A security vulnerability has been detected in Unitree Robotics Unitree Go2 up to 1.1.11.4. vulnerability
- CVE-2026-105014 Improper neutralization of special elements used in a command ('command injection') in Azure Pipelines allows an unauthorized attacker to… vulnerability
- CVE-2026-114575 A flaw has been found in TOTOLINK A950RG 4.1.2cu.5268_B20221104. vulnerability
- CVE-2026-79857 There is a command injection vulnerability in the PAPI protocol (Aruba's access point management protocol) of AOS-8 that could lead to… vulnerability
- CVE-2026-79890 There are command injection vulnerabilities in AOS-8 that could lead to unauthenticated remote code execution by sending specially crafted… vulnerability
- CVE-2026-79956 A vulnerability in the CLI command handling of the AOS-8 web interface could allow an authenticated remote attacker to execute arbitrary… vulnerability
- CVE-2026-95705 Command injection vulnerabilities in the affected interface of AOS-8 could allow an authenticated remote attacker with high privileges to… vulnerability
- CVE-2026-95706 Command injection vulnerabilities in the affected interface of AOS-8 could allow an authenticated remote attacker with high privileges to… vulnerability
- CVE-2026-95708 Command injection vulnerabilities exist in the affected interface of AOS-10 that could allow an authenticated remote attacker with high… vulnerability
- CVE-2026-95709 Command injection vulnerabilities exist in the affected interface of AOS-10 that could allow an authenticated remote attacker with high… vulnerability
- CVE-2026-95715 An unauthenticated command injection vulnerability exists in the command line interface of AOS-10. vulnerability
- CVE-2026-112942 launch-editor allows users to open files with line numbers in editor from Node.js. vulnerability
- CVE-2026-113378 A security flaw has been discovered in mcollina mcp-ripgrep up to 0.4.0. vulnerability
- CVE-2026-113389 A vulnerability was detected in DrayTek Vigor2960 1.5.1.6 Revision 8218. vulnerability
- CVE-2026-113390 A flaw has been found in DrayTek Vigor2960 1.5.1.6 Revision 8218. vulnerability
Referenced by CWE · child of (5)
- CWE-1427 Improper Neutralization of Input Used for LLM Prompting weakness
- CWE-624 Executable Regular Expression Error weakness
- CWE-78 Improper Neutralization of Special Elements used in an OS Command weakness
- CWE-88 Improper Neutralization of Argument Delimiters in a Command weakness
- CWE-917 Improper Neutralization of Special Elements used in an Expression Language Statement weakness
Referenced by CWE · has member (6)
- CWE-1337 Weaknesses in the 2021 CWE Top 25 Most Dangerous Software Weaknesses view
- CWE-1340 CISQ Data Protection Measures view
- CWE-1387 Weaknesses in the 2022 CWE Top 25 Most Dangerous Software Weaknesses view
- CWE-1425 Weaknesses in the 2023 CWE Top 25 Most Dangerous Software Weaknesses view
- CWE-1430 Weaknesses in the 2024 CWE Top 25 Most Dangerous Software Weaknesses view
- CWE-1435 Weaknesses in the 2025 CWE Top 25 Most Dangerous Software Weaknesses view
Referenced by OWASP · mapped cwe (3)
- A05:2025 Injection Top 10 2025
- A03:2021 Injection Top 10 2021
- CS-OS_Command_Injection_Defense OS Command Injection Defense Cheat Sheet Cheat Sheet