ANSI escape injection
Also called: terminal escape injection
Embedding terminal control sequences in tool output or descriptions to hide text, spoof UI, or manipulate the terminal of a user running a CLI agent.
Text rendered in a terminal can contain escape sequences that move the cursor, clear lines, recolor text, or overwrite what was just printed. A malicious MCP server can put these in a tool description or a tool result so that what the user sees in their terminal differs from what the model actually received — hiding an injected instruction, or faking an approval prompt.
Why it matters
CLI-based agents are common among developers, and the terminal is a trusted surface. If the displayed text and the model's context can be made to disagree, user review is defeated. Clients should strip or escape control characters from all server-supplied text before display.
Real-world context
Added as a check by MCP security scanners in 2025 after tool descriptions were found containing terminal control sequences that hide or rewrite text in a CLI agent's terminal.
Exposure map
Live counts of instances showing this pattern will appear here once the exposure map is collecting data.