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

106 results · Feed

  • Critical —

    Crayfish Allows Remote Code Execution via hypercube X-Islandora-Args Header

    ### Impact _What kind of vulnerability is it? Who is impacted?_ Remote code execution is possible in web-accessible installations of hypercube. ### Patches _Has the problem been patched? What versions should users upgrade to?_ Not yet, though no patch is necc…

  • 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…

  • Low 2.1

    Git does not sanitize URLs when asking for credentials interactively

    Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. When Git asks for credentials via a terminal prompt (i.e. without using any credential helpe…

  • Low 2.1

    Newline confusion in credential helpers can lead to credential exfiltration in git

    Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. Git defines a line-based protocol that is used to exchange information between Git and Git c…

  • Medium 6.1

    HTML templates containing Javascript template strings are subject to XSS in jte

    jte (Java Template Engine) is a secure and lightweight template engine for Java and Kotlin. In affected versions Jte HTML templates with `script` tags or script attributes that include a Javascript template string (backticks) are subject to XSS. The `javaScri…

  • Medium 6.5

    Python-sql: python-sql unary operators does not escape non-expression

    A vulnerability was found in python-sql where unary operators do not escape non-Expression.

  • Medium 5.4

    Jinja has a sandbox breakout through malicious filenames

    Jinja is an extensible templating engine. In versions on the 3.x branch prior to 3.1.5, a bug in the Jinja compiler allows an attacker that controls both the content and filename of a template to execute arbitrary Python code, regardless of if Jinja's sandbox…

  • Low 2.5

    gitoxide-core does not neutralize special characters for terminals

    gitoxide An idiomatic, lean, fast & safe pure Rust implementation of Git. gitoxide-core, which provides most underlying functionality of the gix and ein commands, does not neutralize newlines, backspaces, or control characters—including those that form ANSI e…

  • High 7.5

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

  • Critical 9.7

    Arbitrary code execution due to improper sanitization of web app properties in PWAsForFirefox

    PWAsForFirefox is a tool to install, manage and use Progressive Web Apps (PWAs) in Mozilla Firefox. Due to improper sanitization of web app properties (such as name, description, shortcuts), web apps were able to inject additional lines into XDG Desktop Entri…

  • High 7.1

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

  • Low 3.3
    CVE-2024-28085 Public exploit

    wall in util-linux through 2.40, often installed with setgid tty permissions, allows escape sequences to be sent to oth…

  • 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…

  • Medium 6.5

    Shescape on Windows escaping may be bypassed in threaded context

    shescape is simple shell escape library for JavaScript. This may impact users that use Shescape on Windows in a threaded context. The vulnerability can result in Shescape escaping (or quoting) for the wrong shell, thus allowing attackers to bypass protections…

  • Critical 9.8

    An authentication bypass exists on CyberPower PowerPanel Enterprise by failing to sanitize meta-characters from the use…

  • Low 3.6

    Dangerzone CLI does not sanitize ANSI escape characters

    Dangerzone is software for converting potentially dangerous PDFs, office documents, or images to safe PDFs. The Dangerzone CLI (`dangerzone-cli` command) logs output from the container where the file sanitization takes place, to the user's terminal. Prior to …

  • Low 3.0

    Mutagen list and monitor operations do not neutralize control characters in text controlled by remote endpoints

    Mutagen provides real-time file synchronization and flexible network forwarding for developers. Prior to versions 0.16.6 and 0.17.1 in `mutagen` and prior to version 0.17.1 in `mutagen-compose`, Mutagen `list` and `monitor` commands are susceptible to control…

  • 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…

  • Critical 10.0

    XWiki Commons may allow privilege escalation to programming rights via user's first name

    XWiki Commons are technical libraries common to several other top level XWiki projects. Starting in version 3.1-milestone-1, any user can edit their own profile and inject code, which is going to be executed with programming right. The same vulnerability can …

  • Medium 5.9

    Rancher/Wrangler: Denial of service when processing Git credentials

    A Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') vulnerability in SUSE Rancher allows remote attackers to cause denial of service by supplying specially crafted git credentials. This issue affects: SUSE Ranc…

  • Critical 10.0

    Possible shell escape sequence injection vulnerability in Rack

    A sequence injection vulnerability exists in Rack <2.0.9.1, <2.1.4.1 and <2.2.3.1 which could allow is a possible shell escape in the Lint and CommonLogger components of Rack.

  • Low 3.0

    ANSI escape characters in kubectl output are not being filtered

    kubectl does not neutralize escape, meta or control sequences contained in the raw data it outputs to a terminal. This includes but is not limited to the unstructured string fields in objects such as Events.

  • Medium 6.8

    Control character injection in console output

    go-ipfs is an open-source golang implementation of IPFS which is a global, versioned, peer-to-peer filesystem. In go-ipfs before version 0.8.0, control characters are not escaped from console output. This can result in hiding input from the user which could r…

  • Unscored —

    The administration web interface on Belkin Linksys WRT160NL 1.0.04.002_US_20130619 devices allows remote authenticated …

  • Critical 10.0

    An information disclosure and remote code execution vulnerability in the slinger web server of the BlackBerry QNX Softw…

  • Critical 9.8
    CVE-2017-0899 EPSS 11%

    RubyGems Code Injection vulnerability

    RubyGems version 2.6.12 and earlier is vulnerable to maliciously crafted gem specifications that include terminal escape characters. Printing the gem specification would execute terminal escape sequences.