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

18 results · Clear filters · Feed

  • Critical 9.2

    Shescape: Shell injection via unescaped parentheses on Windows with CMD

    Shescape is a simple shell escape library for JavaScript. Prior to 2.1.14 and 3.0.1, getEscapeFunction in src/internal/win/cmd.js does not escape `(` and `)` when applications use the escape or escapeAll APIs on Windows with shell set to cmd.exe, or with shel…

  • Critical 9.6

    OpenWrt odhcpd/LuCI: unauthenticated DHCPv6 client can inject lease-file lines via FQDN hostname → stored XSS in the LuCI admin UI

    OpenWrt is a Linux operating system targeting embedded devices. Prior to 25.12.5, odhcpd writes a DHCPv6 client FQDN option 39 hostname into /tmp/odhcpd.leases through src/statefiles.c statefiles_write_state6() and statefiles_write_state4() without escaping, …

  • Critical 9.1

    Net::Statsite::Client versions through 1.1.0 for Perl allow metric injections

    Net::Statsite::Client versions through 1.1.0 for Perl allow metric injections. Net::Statsite::Client is a client for the statsite protocol, which is a variant of statsd. Newlines are not removed from metric names, allowing metric injections. Values are not sa…

  • Critical 9.1

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

    Metrics::Any::Adapter::DogStatsd versions before 0.04 for Perl does not protect against metric injections. The statsd protocol (and extensions such as dogstatsd) allow mutiple metrics, separated by newlines, to be sent per packet. Metrics::Any::Adapter::DogSt…

  • Critical 9.8

    DataDog::DogStatsd versions through 0.07 for Perl allow metric injections from event tags

    DataDog::DogStatsd versions through 0.07 for Perl allow metric injections from event tags. DataDog::DogStatsd does not properly sanitise input, allowing metric injections of data from untrusted sources. The format_event method (used by the event method) does …

  • Critical 9.1

    DataDog::DogStatsd versions through 0.07 for Perl allow metric injections

    DataDog::DogStatsd versions through 0.07 for Perl allow metric injections. DataDog::DogStatsd does not properly sanitise input, allowing metric injections of data from untrusted sources. The send_stats method does not remove newlines from metric names ($stat …

  • Critical 9.0

    Microsoft Power Apps Desktop Client Spoofing Vulnerability

    Improper neutralization of escape, meta, or control sequences in Microsoft Power Apps allows an authorized attacker to perform spoofing over a network.

  • Critical 9.6
    CVE-2025-55754 EPSS 10%

    Apache Tomcat: console manipulation via escape sequences in log messages

    Improper Neutralization of Escape, Meta, or Control Sequences vulnerability in Apache Tomcat. Tomcat did not escape ANSI escape sequences in log messages. If Tomcat was running in a console on a Windows operating system, and the console supported ANSI escape …

  • Critical 9.9

    Gardener vulnerable to metadata injection for a project secret that can lead to privilege escalation

    Gardener implements the automated management and operation of Kubernetes clusters as a service. A security vulnerability was discovered in the `gardenlet` component of Gardener prior to versions 1.116.4, 1.117.5, 1.118.2, and 1.119.0. It could allow a user wi…

  • Critical 9.8
    CVE-2025-31651 Public exploit

    Apache Tomcat: Bypass of rules in Rewrite Valve

    Improper Neutralization of Escape, Meta, or Control Sequences vulnerability in Apache Tomcat. For a subset of unlikely rewrite rule configurations, it was possible for a specially crafted request to bypass some rewrite rules. If those rewrite rules effectivel…

  • Critical 9.8

    Crayfish allows Remote Code Execution via Homarus Authorization header

    Crayfish is a collection of Islandora 8 microservices, one of which, Homarus, provides FFmpeg as a microservice. Prior to Crayfish version 4.1.0, remote code execution may be possible in web-accessible installations of Homarus in certain configurations. The i…

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

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

  • Critical 9.8

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

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

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

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