What is CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')?+
CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection') is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string. When creating commands using interpolation into a string, developers may assume that only the arguments/options that they specify will be processed. This assumption may be even stronger when the programmer has encoded the command in a way that prevents separate commands from being provided maliciously, e.g. in the case of shell metacharacters. When constructing the command, the developer may use whitespace or other delimiters that are required to separate arguments when the command. However, if an attacker can provide an untrusted input that contains argument-separating delimiters, then the resulting command will have more arguments than intended by the developer. The attacker may then be able to change the behavior of the command. Depending on the functionality supported by the extraneous arguments, this may have security-relevant consequences.
What are the security consequences of Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')?+
If exploited, CWE-88 (Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')) it can compromise Confidentiality, Integrity, Availability and Other, leading to outcomes such as Execute Unauthorized Code or Commands, Alter Execution Logic, Read Application Data and Modify Application Data.
How do you prevent or mitigate Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')?+
Recommended mitigations for CWE-88 include: Where possible, avoid building a single string that contains the command and its arguments. Some languages or frameworks have functions that support specifying independent arguments, e.g. as an array, which is used to automatically perform the appropriate quoting or escaping while building the command. For example, in PHP, escapeshellarg() can be used to escape a single argument to system(), or exec() can be called with an array of arguments. In C, code can often be refactored from using system() - which accepts a single string - to using exec(), which requires separate function arguments for each parameter. Understand all the potential areas where untrusted inputs can enter your product: parameters or arguments, cookies, anything read from the network, environment variables, request headers as well as content, URL components, e-mail, files, databases, and any external systems that provide data to the application. Perform input validation at well-defined interfaces. Directly convert your input type into the expected data type, such as using a conversion function that translates a string into a number. After converting to the expected data type, ensure that the input's values fall within the expected range of allowable values and that multi-field consistencies are maintained.
Which programming languages are affected by Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')?+
CWE-88 commonly affects PHP and Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.
What are real-world examples of Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')?+
MITRE documents real CVEs mapped to CWE-88, including CVE-2022-36069, CVE-1999-0113, CVE-2001-0150, CVE-2001-0667 and CVE-2002-0985. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.
What is the difference between a CWE and a CVE?+
A CWE (Common Weakness Enumeration) like CWE-88 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.