This vulnerability occurs when an application fails to properly validate or neutralize special characters and control elements within user-supplied input. Without this filtering, attackers can inject these elements to manipulate the application's logic, leading to security breaches or system instability.
At its core, this weakness is about trust. Applications often treat special elements—like command delimiters, escape sequences, or formatting tags—as instructions. When user input containing these elements isn't sanitized, the system mistakenly executes them as code. This can allow attackers to alter data flows, bypass security checks, or directly inject malicious commands, compromising the application from within. To prevent this, developers must implement strict input validation and context-aware output encoding. Treat all user input as untrusted by default. Use allow-list validation to permit only expected, safe characters, and always encode data based on its final output context (like HTML, SQL, or OS commands). This defense-in-depth approach ensures special elements are treated as inert data, not executable instructions, closing a common attack vector.
Impact: Unexpected State
Strategy: Input Validation
Strategy: Output Encoding
Strategy: Input Validation