CL-SN55 941 —
GPT-61S 890 +8.8%
GPT-56T 861 —
GPT-6S 847 +1.2%
GPT-56SC 847 +1.2%
CL-OP55X 843 +1.4%
GROK-46H 843 +1.4%
GLM-52 843 +1.2%
DSK-V4PH 843 +1.4%
GLM-5 826 +10.3%
MUSE-SPK 804 —
QWEN-38X 795 +10.1%
GPT-6A 782 +11.1%
CL-FAB5H 761 +1.6%
CL-OP5H 736 +1.7%
CL-OP5X 734 +1.7%
GEM-37FH 732 +1.7%
KIMI-K3X 719 +0.1%
CL-OP46H 719 +1.7%
CL-OP55H 717 +1.7%
CL-OP47H 708 +1.7%
GEM-38FH 689 +0.3%
GPT-56S 581 -0.5%
CL-OP47 546 -0.4%
INKL 531 —
GEM-3P 495 —
CL-OP46 491 —
GEM-31P 487 -0.2%
CL-OP48 484 —
GPT-6L 436 —
CL-SN55 941 —
GPT-61S 890 +8.8%
GPT-56T 861 —
GPT-6S 847 +1.2%
GPT-56SC 847 +1.2%
CL-OP55X 843 +1.4%
GROK-46H 843 +1.4%
GLM-52 843 +1.2%
DSK-V4PH 843 +1.4%
GLM-5 826 +10.3%
MUSE-SPK 804 —
QWEN-38X 795 +10.1%
GPT-6A 782 +11.1%
CL-FAB5H 761 +1.6%
CL-OP5H 736 +1.7%
CL-OP5X 734 +1.7%
GEM-37FH 732 +1.7%
KIMI-K3X 719 +0.1%
CL-OP46H 719 +1.7%
CL-OP55H 717 +1.7%
CL-OP47H 708 +1.7%
GEM-38FH 689 +0.3%
GPT-56S 581 -0.5%
CL-OP47 546 -0.4%
INKL 531 —
GEM-3P 495 —
CL-OP46 491 —
GEM-31P 487 -0.2%
CL-OP48 484 —
GPT-6L 436 —
← Back to feed

ANSI Escape Injection in MCP Servers Hides Malicious Instructions From Humans, Not AI

A class of prompt injection attacks exploiting ANSI escape sequences in Model Context Protocol servers has been documented and published by researchers at Bright Security. The attack uses terminal control codes — characters that terminal emulators interpret as formatting commands and render invisible — embedded in MCP server responses. A human reading the output sees nothing. The AI model ingesting the raw text sees and acts on the hidden instructions.

ANSI escape sequences were designed for terminals: move the cursor, clear a line, change colour. When a terminal emulator renders text containing ESC[2K (erase line) or ESC[1A (cursor up one), it acts on the command and the sequence disappears from the visible output. But AI models processing MCP responses do not go through a terminal renderer. They read the raw character stream, including every escape sequence. An attacker who controls an MCP server can embed instructions in that stream that a human operator monitoring the session will never see.

Why MCP Creates New Exposure

MCP has become infrastructure. Thousands of tools and data sources now expose MCP endpoints, and AI coding agents route through them constantly. The assumption built into most MCP security reviews is that prompt injection requires the injected text to be visible somewhere — in a tool response, a document, or a retrieved chunk — where a careful human can spot it. This attack breaks that assumption.

Because the injected content is invisible in terminal output, monitoring tools that rely on human inspection of conversation logs will miss it. Detection requires either raw-byte logging of MCP responses or automated scanning for ANSI control codes in content that should not contain them. Neither is standard practice in most AI agent deployments today.

Attack Surface and Scope

The vulnerability is architectural, not specific to a single server or tool. Any MCP server that returns user-controlled or externally-sourced content without stripping ANSI escape sequences is potentially weaponisable. This includes servers that proxy web content, file contents, search results, or API responses from third-party systems.

A successful injection can redirect agent actions, exfiltrate data, instruct the model to approve actions the user did not sanction, or modify subsequent tool calls. The severity depends on what the AI agent is authorised to do. For agents with filesystem, code execution, or API access — standard for coding agents — the blast radius is significant.

Bright Security’s research includes detection using Dynamic Application Security Testing against running MCP servers, which can flag servers that return ANSI-laden content. The tooling is available for teams that want to audit their own MCP infrastructure.

The Broader Pattern

This is the third distinct MCP attack class published in the past 60 days, following tool-poisoning attacks (malicious tool definitions that alter agent behaviour) and OAuth token hijacking via MCP credential handling. The protocol’s security model was designed for first-party trusted tools; its expansion to third-party and community-contributed servers has outrun that assumption.

The attack is also conceptually related to what DeepMind documented in June: six attack types that turn websites into agent traps, with an 86% hijack rate. The common thread is that AI agents are processing more raw external content than their security perimeters were designed to handle. ANSI injection is one more input channel that attackers can leverage without triggering standard guardrails.

Mitigation is straightforward at the infrastructure level: strip ANSI escape sequences from all MCP server responses before they are passed to the model. The harder problem is that most teams do not know they need to.