ANSI escape injection in MCP servers: Hidden from humans, visible to AI
Detecting ANSI Escape Sequence Injection in MCP Servers with DASTANSI escape sequences were designed for terminals, not for language models. They are invisible control codes that tell a terminal to change colors, hide text, clear the screen, or move the cursor. A human reading a rendered terminal never sees the codes themselves — only their effect.
- ▪Detecting ANSI Escape Sequence Injection in MCP Servers with DASTANSI escape sequences were designed for terminals, not for language models.
- ▪They are invisible control codes that tell a terminal to change colors, hide text, clear the screen, or move the cursor.
- ▪A human reading a rendered terminal never sees the codes themselves — only their effect.
Opening excerpt (first ~120 words) tap to expand
Detecting ANSI Escape Sequence Injection in MCP Servers with DASTANSI escape sequences were designed for terminals, not for language models. They are invisible control codes that tell a terminal to change colors, hide text, clear the screen, or move the cursor. A human reading a rendered terminal never sees the codes themselves — only their effect. A language model reading the same content sees every byte.That gap is the whole attack. If an attacker can smuggle ANSI escape sequences into text that an AI agent consumes, they can hide instructions from the human reviewing the output while leaving those instructions perfectly legible to the model.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Bright Security.