IncidentCoding assistants
Rules File Backdoor: invisible instructions in AI coding rules files
MediumCursorGitHub
The rules files that tell AI coding assistants how to write code can carry invisible instructions. A poisoned rules file could make Cursor or Copilot quietly add malicious code, such as a script from an attacker's site, without telling the developer.
Replay the attack step by step in the Learning Center
How it happened
- The attacker hides instructions in a rules file using invisible Unicode characters.
- The file spreads through a repository, fork or community rules collection and looks harmless.
- A developer asks the assistant to generate code.
- The assistant follows the hidden instructions, adds an attacker script and does not mention it.
Impact
Backdoored code could spread to every project that uses the rules file.
The fix
No product patch; GitHub began warning about hidden Unicode text in May 2025.
Lessons
- Review AI rules and instruction files like code, and scan them for invisible characters.
- Review the actual diff an assistant produces, not its chat summary.
- Use rules files only from trusted sources, and pin them.