ClassDraft
CWE-138Improper Neutralization of Special Elements
Category: other
Description
The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as control elements or syntactic markers when they are sent to a downstream component.
Most languages and protocols have their own special elements such as characters and reserved words. These special elements can carry control implications. If product does not prevent external control or influence over the inclusion of such special elements, the control flow of the program may be altered from what was intended. For example, both Unix and Windows interpret the symbol < ("less than") as meaning "read input from a file".
Common consequences· 1
- Confidentiality / Integrity / Availability / Other — Execute Unauthorized Code or Commands, Alter Execution Logic, DoS: Crash, Exit, or Restart
Potential mitigations· 5
- [Implementation]Developers should anticipate that special elements (e.g. delimiters, symbols) will be injected into input vectors of their product. One defense is to create an allowlist (e.g. a regular expression) that defines valid input according to the requirements specifications. Strictly filter any input that does not match against the allowlist. Properly encode your output, and quote any elements that have special meaning to the component with which you are communicating.
- [Implementation]
- [Implementation]Use and specify an appropriate output encoding to ensure that the special elements are well-defined. A normal byte sequence in one encoding could be a special element in another.
- [Implementation]Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.
- [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).
Related CAPEC attack patterns· 3
References
Exploits (incoming)3
| Type | Target | Confidence | Tier |
|---|---|---|---|
| AttackPattern | HTTP Request Splittingcapec-105 | 100% | live |
| AttackPattern | HTTP Response Splittingcapec-34 | 100% | live |
| AttackPattern | Command Delimiterscapec-15 | 100% | live |
(incoming)7
| Type | Target | Confidence | Tier |
|---|---|---|---|
| KEVEntry | Nagios XI OS Command Injectionkev-cve-2021-25296 | 0% | live |
| KEVEntry | Nagios XI OS Command Injectionkev-cve-2021-25297 | 0% | live |
| KEVEntry | Nagios XI OS Command Injectionkev-cve-2021-25298 | 0% | live |
| KEVEntry | Accellion FTA SQL Injection Vulnerabilitykev-cve-2021-27101 | 0% | live |
| KEVEntry | Realtek Jungle SDK Remote Code Execution Vulnerabilitykev-cve-2021-35394 | 0% | live |
| KEVEntry | dotCMS Unrestricted Upload of File Vulnerabilitykev-cve-2022-26352 | 0% | live |
| KEVEntry | Synacor Zimbra Collaboration Suite (ZCS) Cross-Site Scripting (XSS) Vulnerabilitykev-cve-2022-27926 | 0% | live |
Related by meaning· 6
Nearest entities by semantic similarity across the cs-graph corpus.