Skip to content
OpenAdvisories

Weakness (CWE)

CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences

Variant Incomplete

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.

How to prevent it (6 mitigations)
  1. 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.

  2. 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.

  3. 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).

  4. 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.

  5. Implementation

    When 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.

  6. Build and Compilation

    When 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 terminal
    settings to change colors.

Source: MITRE CWE-150

26 results · Clear filters · Feed

  • High 8.4

    openapi-python-client: Malicious OpenAPI Documents can cause Arbitrary Code Generation

    openapi-python-client generates Python clients from OpenAPI documents. Prior to 0.29.1, the generator does not safely neutralize malicious OpenAPI document content before rendering string, docstring, and f-string contexts in generated Python. The generated Py…

  • High 7.8

    In Sapling SCM prior to v0.2.20260929-102736, control characters were allowed to be embedded in Git subtree URLs. A mal…

  • High 7.7

    Collectl: collectl: colmux does not sanitize ansi/vt100 terminal escape sequences in data received from remote collectl instances

    colmux in collectl before 4.3.20.2 does not sanitize ANSI/VT100 terminal escape sequences in data received from remote collectl instances before displaying it, allowing a local user on a monitored host to inject escape sequences into the terminal of an operat…

  • High 8.4

    MISP Interactive CLI Shell: Authorization Bypass, Credential Exposure, and Terminal Injection

    Affected versions of MISP’s interactive CLI shell implement access control independently from the normal web application, causing several authorization inconsistencies. The patch shows that CLI access could differ from the web application in multiple security…

  • High 8.8

    OpenAI Codex CLI for Windows, macOS, and Linux and Codex Desktop for Windows and macOS misclassified certain PowerShell…

  • High —

    pickem vulnerable to terminal escape-sequence injection via unsanitized item text

    ### Impact pickem rendered item text (label, description, group, meta, name) to the terminal with no control-character sanitization. `chrome.row` only stripped ANSI from the **active** row; inactive rows, the public `createFormatter`, and selection-summary li…

  • High 7.3

    Kitty: Command injection into the child shell via chained @kitty-echo + @kitty-ssh DCS escape sequences

    Kitty is a cross-platform GPU based terminal. Prior to 0.48.2, the @kitty-echo and @kitty-ssh DCS handlers in kitty/window.py write unauthenticated data to the child shell's stdin, where handle_remote_echo accepts printable shell command characters and handle…

  • High 7.1

    SQL injection in syslog-ng SQL destionation driver

    Due to a missing sanitization call in [`afsql_dd_run_query`](https://github.com/syslog-ng/syslog-ng/blob/649e6e18e3459fb4467000a88dfb12fa97f9719c/modules/afsql/afsql.c#L219), syslog-ng before 4.12 are vulnerable to SQL injection from an untrusted source. This…

  • High 7.5

    App::Ack versions through 3.10.0 for Perl print unsanitised terminal escape sequences from filenames in several output modes

    App::Ack versions through 3.10.0 for Perl print unsanitised terminal escape sequences from filenames in several output modes. When ack prints a filename whose basename contains terminal control bytes such as ANSI escape sequences, those bytes reach the termin…

  • High 7.3

    Kitty vulnerable to command injection via unsanitized OSC 21 query reply

    Kitty is a cross-platform GPU based terminal. In versions prior to 0.47.3, kitty's OSC 21 (color-control) query reply reflects attacker-controlled bytes, including newlines, into the shell's input without sanitization. Version 0.47.3 fixes the issue.

  • High 8.2

    Metrics::Any::Adapter::Statsd versions before 0.04 for Perl does not protect against metric injections

    Metrics::Any::Adapter::Statsd versions before 0.04 for Perl does not protect against metric injections. The statsd protocol (and extensions) allow mutiple metrics, separated by newlines, to be sent per packet. The send method does not validate the contents of…

  • High 7.5

    Etsy::StatsD versions through 1.002002 for Perl allow metric injections

    Etsy::StatsD versions through 1.002002 for Perl allow metric injections. The metric names and values are not checked for newlines, colons or pipes. Metrics generated from untrusted sources could inject additional statsd metrics. Note that the git repository c…

  • High 7.3

    Net::Statsd::Lite versions through 0.10.0 for Perl allowed metric injections

    Net::Statsd::Lite versions through 0.10.0 for Perl allowed metric injections. The values from the set_add method were not checked for newlines, colons or pipes. Metrics generated from untrusted sources could inject additional statsd metrics. Note that version…

  • High 8.2

    Net::Statsd::Tiny versions before 0.3.8 for Perl allowed metric injections

    Net::Statsd::Tiny versions before 0.3.8 for Perl allowed metric injections. The metric names and set values were not checked for newlines, colons or pipes. Metrics generated from untrusted sources could inject additional statsd metrics.

  • High 8.4

    Tabby: Dragging and Dropping a File into Tabby Can Lead to Code Execution

    Tabby (formerly Terminus) is a highly configurable terminal emulator. Prior to 1.0.233, since Tabby does not escape control characters from file paths when dragging and dropping a file into it, code execution can be achieved. This vulnerability is fixed in 1.…

  • High —

    AWS SDK for PHP has CloudFront Policy Document Injection via Special Characters

    ### Summary This notification is related to the [CloudFront signing utilities](https://github.com/aws/aws-sdk-php/blob/master/src/CloudFront/Signer.php) in the AWS SDK for PHP, which are used to generate Amazon CloudFront signed URLs and signed cookies. A def…

  • High 8.0

    Terminal Escape Injection in mmctl Report Posts Command

    Mattermost versions 11.2.x <= 11.2.2, 10.11.x <= 10.11.10, 11.4.x <= 11.4.0, 11.3.x <= 11.3.1 fail to sanitize user-controlled post content in the mmctl commands terminal output which allows attackers to manipulate administrator terminals via crafted messages…

  • High 7.8

    Tanium addressed an unauthorized code execution vulnerability in Tanium Appliance.

    Tanium addressed an unauthorized code execution vulnerability in Tanium Appliance.

  • High 7.4

    Word Copilot Information Disclosure Vulnerability

    Improper neutralization of escape, meta, or control sequences in Copilot allows an unauthorized attacker to disclose information over a network.

  • High 7.5

    Apache HTTP Server: mod_ssl error log variable escaping

    Insufficient escaping of user-supplied data in mod_ssl in Apache HTTP Server 2.4.63 and earlier allows an untrusted SSL/TLS client to insert escape characters into log files in some configurations. In a logging configuration where CustomLog is used with "%{va…

  • High 8.8

    IBM MQ code execution

    IBM MQ 9.3 LTS, 9.3 CD, 9.4 LTS, and 9.4 CD console could allow an authenticated user to execute code due to improper neutralization of escape characters.

  • High 7.5
    CVE-2024-52005 Public exploit

    The sideband payload is passed unfiltered to the terminal in git

    Git is a source code management tool. When cloning from a server (or fetching, or pushing), informational or error messages are transported from the remote Git process to the client via the so-called "sideband channel". These messages will be prefixed with "r…

  • High 7.5

    RARLAB WinRAR before 7.00, on Windows, allows attackers to spoof the screen output via ANSI escape sequences, a differe…

  • High 7.1

    RARLAB WinRAR before 7.00, on Linux and UNIX platforms, allows attackers to spoof the screen output, or cause a denial …

  • High 8.8

    Deno interactive permission prompt spoofing via improper ANSI stripping

    Deno is a JavaScript, TypeScript, and WebAssembly runtime with secure defaults. Starting in version 1.32.1 and prior to version 1.41.0 of the deno library, maliciously crafted permission request can show the spoofed permission prompt by inserting a broken ANS…

  • High 8.8

    Deno is vulnerable to interactive `run` permission prompt spoofing via improper ANSI neutralization

    Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust. Arbitrary program names without any ANSI filtering allows any malicious program to clear the first 2 lines of a `op_spawn_child` or `op_kill` prompt a…