Invisible Instructions: How .cursorrules Files Secretly Control Your AI Coding Assistant

Seemingly normal AI rules files can hide invisible Unicode instructions that quietly direct agents to perform unauthorized actions.
Using a real-world case from the Exepal scanner, the article reveals that AI coding assistant configuration files are becoming an overlooked attack surface. A seemingly ordinary .cursorrules file was flagged with 11 issues, 10 high-severity, and contained 185 invisible Unicode characters. These characters are invisible in editors but can be read and executed by AI agents; in the case, the hidden instruction told the agent to add a tracking script to every page and stay silent, bypassing manual review. Risks don't only come from self-written configs — open-source templates, team-shared configurations, and third-party MCP configs can all carry planted hidden characters. The article therefore argues for rethinking the trust boundary of configuration files, treating rules files as executable instructions rather than ordinary documents, and incorporating them into code review and scanning of external sources.
A perfectly ordinary-looking project rules file could be quietly directing your AI coding assistant to do things you never authorized. This isn't science fiction — it's a real issue uncovered by the AI configuration scanning tool Exepal during actual detection.
When Rules Files Become an Attack Surface
AI coding tools like Cursor let developers define the behavior of AI agents through .cursorrules files — things like code style, tech stack preferences, and directories that must not be modified. The mechanism itself is sound in design, but Exepal's scanner has revealed a neglected risk: what's in a configuration file isn't always what meets the eye.
According to the example shown by the tool, a seemingly normal project rules file was flagged with 11 issues after scanning, 10 of them marked high-severity, and the file contained 185 hidden characters.

The scanner reads not only .cursorrules but also clawed .md files and MCP (Model Context Protocol) configuration files. Together, these files form the "behavior manual" of an AI agent — and therefore a potential attack vector.
MCP (Model Context Protocol) is an open protocol proposed by Anthropic that lets AI applications connect to external data sources and tools in a standardized way. It uses a client–server architecture: the AI application acts as the client and communicates with MCP servers via JSON-RPC, while servers expose resources, tools, and prompt templates. An MCP configuration file typically declares which servers to launch and what commands and arguments to use, so it's not just data — it's a control plane that determines which external capabilities an AI agent can invoke. Once such a configuration is tampered with, an attacker could potentially get the agent to connect to a malicious server or perform unintended tool calls, which is why the article treats it alongside .cursorrules as an attack vector.
Invisible Unicode: Instructions Hiding in Plain Sight
What makes this case most alarming is how covert the attack technique is. Invisible Unicode characters were embedded in the file — characters that don't show up in the editor but can be read and executed by the AI agent.

The injected instruction is very specific: it requires the agent to add a tracking script to every page, and explicitly tells the agent not to mention it. In other words, the attacker exploited the configuration file's parsing mechanism to disguise a covert data-collection behavior as an ordinary rule instruction.

What makes this technique dangerous is that it bypasses manual review — the most common line of defense. When developers review a rules file, they see normal configuration items, but the AI agent executes a different, hidden set of instructions.

From an attack-surface perspective, this kind of risk doesn't only come from configuration files you write yourself. Open-source project templates, team-shared configurations, and third-party MCP configurations — if hidden characters are planted at any point in the chain, malicious instructions can be carried into your development workflow.
Invisible Unicode characters are code points that produce no visible glyph when rendered as text. Common ones include zero-width space (U+200B), zero-width non-joiner (U+200C), zero-width joiner (U+200D), byte order mark (U+FEFF), and bidirectional control characters (such as U+202A–U+202E). These characters don't display in most editors and terminals, but they are still read by programs as part of the text stream. Attackers can encode malicious instructions into these invisible code points, or use them to scramble the order of visible text and disguise keywords, thereby evading visual manual review. Because the Unicode standard itself needs these characters to support multilingual typesetting, simply banning them isn't feasible. A more realistic approach is to detect and strip suspicious code points in CI or commit hooks, and to normalize configuration files.
The Trust Boundary of Configuration Files Needs Rethinking
AI coding tools are spreading fast, but review habits and security tooling around configuration files haven't kept up. Developers typically audit code dependencies and check npm package sources, but rarely inspect a .cursorrules file byte by byte for zero-width characters.
Exepal's scanning service is free and doesn't store scanned content. The emergence of tools like this shows the market is beginning to recognize the gap. But scanning tools alone don't constitute complete protection — the more fundamental problem is that AI agents have excessive execution privileges over configuration files, while the provenance of those files is often unverified.
For teams using Cursor or similar tools, a few pragmatic practices are worth considering: bring rules files and MCP configurations into the code review process; stay vigilant about externally sourced configuration files; and scan third-party configurations before adopting them. These measures are low-cost but can block the most direct category of risk.
The more capable an AI agent is, the more what it can read and execute needs to be treated like code. A rules file is not documentation — it's an executable behavior instruction. That shift in mindset may be what's most needed right now.
Related articles

Jensen Huang Returns to Nvidia: The Power Game Behind an "Aggro Reset"
Nvidia's board reappointed Jensen Huang as CEO less than two weeks after his scandal-driven resignation. This analysis explores the board's decision-making, Trump's political intervention, media power failure, and market reaction behind the dramatic return.

Why Voice AI Can't Understand Kenyans' Everyday Conversations
Swahili speech recognition hits 3.24% error on read text, but everyday Kenyan speech mixes English, Sheng slang, and accents—leaving mainstream voice AI struggling.

Data Centers Build Their Own Natural Gas Plants: AI Compute's Breakout Around a Decade-Long Grid Wait
Grid interconnection approvals can take a decade, so xAI and others are building off-grid natural gas plants to power AI clusters. This article analyzes the drivers, costs, and impact of behind-the-meter generation on AI infrastructure.