CWE•Variant•Incomplete•13 recent CVEs
CWE-150Improper Neutralization of Escape, Meta, or Control Sequences
Description
The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component.
Common consequences
- Integrity→Execute Unauthorized Code or Commands,Hide Activities,Unexpected StateANSI escape codes can be used for low-severity attacks such as changing the color of console output, but they can also be used to arbitrarily move the cursor, clear the screen, and make fake prompts inside the interactive CLI via malicious
Potential mitigations
- Developers should anticipate that escape, meta and control characters/sequences will be injected/removed/manipulated in the input vectors of their product. Use an appropriate combination of denylists and allowlists to ensure only valid, expected and appropriate input is processed by the system.
- Implementation[object Object]
- ImplementationWhile 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 whit
- ImplementationInputs 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.
- ImplementationWhen using output from an LLM, neutralize or strip escape codes before redirecting output to the terminal or other rendering engine that would process the codes. The neutralization could require that the character be printable and/or allowable whitespace, such as a carriage return or newline. Be deliberate about what to allow.
- Build and CompilationWhen using an LLM: during tokenizer training, suppress escape codes from the tokenizer's vocabulary. Depending on context, this could be accomplished by removing the codes from input to the tokenizer, or removing the map from the string to its token ID. It is generally unlikely that this removal would adversely affect the quality or correctness of what is generated, e.g. advice requests for termin
Related CWEs
Recent CVEs classified under this CWE
CVE-2026-92709.12026-06-05CVE-2026-113629.82026-06-05CVE-2026-470904.62026-05-18CVE-2026-450387.82026-05-15CVE-2026-458033.52026-05-15CVE-2026-415266.52026-04-28CVE-2026-60196.12026-04-22CVE-2026-405053.32026-04-16CVE-2026-261499.02026-04-14CVE-2026-356514.32026-04-10CVE-2025-628456.72026-03-20CVE-2025-557549.62025-10-27CVE-2024-280853.32024-03-27