Skip to content
AI / LLM Write-up Intermediate

Looking back at the Cursor and Github Co-pilot invisible exploit

The article describes a vulnerability where malicious instructions can be hidden in rules files used by AI IDEs like Cursor and GitHub Copilot using invisible Unicode characters. An attacker could embed such instructions to make the AI agent execute harmful actions, such as injecting malicious code into generated output.

medium.com

Published on medium.com

TL;DR About 3–4 months ago, I came back across a “Low-Level” youtube video that talked about a blog titled “New Vulnerability in GitHub Copilot and Cursor: How Hackers Can Weaponize Code Agents” which explained how potentially attackers could sabotage the rules files that are used in the prominent vibe-coding IDEs and…

Kaamil Mirza, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the AI IDEs do not filter or warn about invisible Unicode characters in rules files, so hidden instructions are passed directly to the model.

Impact

An attacker could hide malicious instructions in rules files, causing the AI to inject harmful code into generated output, potentially leading to code execution or other damage if the user runs the code.

What the attacker needed

Victim uses AI IDE with rules file; attacker can supply rules file; AI has tool calling enabled

The fix

GitHub now provides a warning about hidden Unicode text, but Cursor reportedly dismissed the issue; IDE developers should handle all encodings and warn about invisible characters.

How it was found

  1. Create a rules file containing hidden malicious instructions using invisible Unicode characters.
  2. Attach any .html file and prompt the AI to generate code.
  3. The AI silently injects the malicious code into the generated HTML.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

AI coding assistants like Cursor and GitHub Copilot read special instruction files to understand how to help you. This article explains that attackers can hide secret commands in those files using invisible text characters, so the AI follows the attacker's instructions without you seeing them. If the AI has permission to run tools or write code, it might do dangerous things like insert malicious code into your project.

What is AI / LLM?

Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.

Similar reports

View all

Same bug class and techniques, clearest first.

AI and LLM vulnerabilities

The lesson behind this report.

Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.