ANSI Escape Sequence Injection Exploits Model Context Protocol Servers
July 21, 2026
Attackers can smuggle invisible ANSI escape sequences into MCP server outputs to hide instructions from human reviewers while remaining legible to LLMs. This vulnerability exploits the discrepancy between how terminal emulators render control codes and how models process raw byte streams.
HOW THIS AFFECTS YOU
●
builderYou must sanitize all tool and resource outputs within MCP implementations to prevent instruction smuggling.
●
policyThis highlights a critical security gap in agentic workflows where human oversight can be bypassed via terminal formatting.