New Vulnerability in GitHub Copilot, Cursor: Hackers Can Weaponize Code Agents

pillar.security

232 points by pseudolus 6 days ago


DougBTX - 6 days ago

From the article:

> A 2024 GitHub survey found that nearly all enterprise developers (97%) are using Generative AI coding tools. These tools have rapidly evolved from experimental novelties to mission-critical development infrastructure, with teams across the globe relying on them daily to accelerate coding tasks.

That seemed high, what the actual report says:

> More than 97% of respondents reported having used AI coding tools at work at some point, a finding consistent across all four countries. However, a smaller percentage said their companies actively encourage AI tool adoption or allow the use of AI tools, varying by region. The U.S. leads with 88% of respondents indicating at least some company support for AI use, while Germany is lowest at 59%. This highlights an opportunity for organizations to better support their developers’ interest in AI tools, considering local regulations.

Fun that the survey uses the stats to say that companies should support increasing usage, while the article uses it to try and show near-total usage already.

mrmattyboy - 6 days ago

> effectively turning the developer's most trusted assistant into an unwitting accomplice

"Most trusted assistant" - that made me chuckle. The assistant that hallucinates packages, avoides null-pointer checks and forgets details that I've asked it.. yes, my most trusted assistant :D :D

tsimionescu - 6 days ago

The most concerning part of the attack here seems to be the ability to hide arbitrary text in a simple text file using Unicode tricks such that GitHub doesn't actually show this text at all, per the authors. Couple this with the ability of LLMs to "execute" any instruction in the input set, regardless of such a weird encoding, and you've got a recipe for attacks.

However, I wouldn't put any fault here on the AIs themselves. It's the fact that you can hide data in a plain text file that is the root of the issue - the whole attack goes away once you fix that part.

tobyhinloopen - 6 days ago

Stop hijacking scrolling. Why would you do that? What developer thought this was a good idea?

markussss - 5 days ago

This page has horrible scrolling. I really don't understand why anybody creates this kind of scroll. Are they not using what they create?

MadsRC - 6 days ago

When this was released I thought that perhaps we could mitigate it by having the tooling only load “rules” if they were signed.

But thinking on it a bit more, from the LLMs perspective there’s no difference between the rule files and the source files. The hidden instructions might as well be in the source files… Using code signing on the rule files would be security theater.

As mentioned by another comms ter, the solution could be to find a way to separate the command and data channels. The LLM only operates on a single channel, that being input of tokens.

DrNosferatu - 6 days ago

For some piece of mind, we can perform the search:

  OUTPUT=$(find .cursor/rules/ -name '*.mdc' -print0 2>/dev/null | xargs -0 perl -wnE '
    BEGIN { $re = qr/\x{200D}|\x{200C}|\x{200B}|\x{202A}|\x{202B}|\x{202C}|\x{202D}|\x{202E}|\x{2066}|\x{2067}|\x{2068}|\x{2069}/ }
    print "$ARGV:$.:$_" if /$re/
  ' 2>/dev/null)

  FILES_FOUND=$(find .cursor/rules/ -name '*.mdc' -print 2>/dev/null)

  if [[ -z "$FILES_FOUND" ]]; then
    echo "Error: No .mdc files found in the directory."
  elif [[ -z "$OUTPUT" ]]; then
    echo "No suspicious Unicode characters found."
  else
    echo "Found suspicious characters:"
    echo "$OUTPUT"
  fi
- Can this be improved?
fjni - 5 days ago

Both GitHub and Cursor’s response seems a bit lazy. Technically they may be correct in their assertion that it’s the user’s responsibility. But practically isn’t part of their product offering a safe coding environment? Invisible Unicode instruction doesn’t seem like a reasonable feature to support, it seems like a security vulnerability that should be addressed.

lukaslalinsky - 6 days ago

I'm quite happy with spreading a little bit of scare about AI coding. People should not treat the output as code, only as a very approximate suggestion. And if people don't learn, and we will see a lot more shitty code in production, programmers who can actually read and write code will be even more expensive.

t_believ-er873 - 3 days ago

Recently, I've seen a lot of information on the internet on how attackers use AI to spread malware, like jailbreak vulnerabilities that allow attackers to modify the tool's behavior. Here is the good article also on the topic: https://gitprotect.io/blog/how-attackers-use-ai-to-spread-ma...

yair99dd - 6 days ago

Reminds me of this wild paper https://boingboing.net/2025/02/26/emergent-misalignment-ai-t...

AutoAPI - 5 days ago

Recent discussion: Smuggling arbitrary data through an emoji https://news.ycombinator.com/item?id=43023508

Oras - 5 days ago

This is a vulnerability in the same sense as someone committing a secret key in the front end.

And for enterprise, they have many tools to scan vulnerability and malicious code before going to production.

throwaway290 - 6 days ago

Next thing, LLMs that review code! Next next thing, poisoning LLMs that review code!

Galaxy brain: just put all the effort from developing those LLMs into writing better code

mock-possum - 6 days ago

Sorry, but isn’t this a bit ridiculous? Who just allows the AI to add code without reviewing it? And who just allows that code to be merged into a main branch without reviewing the PR?

They start out talking about how scary and pernicious this is, and then it turns out to be… adding a script tag to an html file? Come on, as if you wouldn’t spot that immediately?

What I’m actually curious about now is - if I saw that, and I asked the LLM why it added the JavaScript file, what would it tell me? Would I be able to deduce the hidden instructions in the rules file?

TZubiri - 5 days ago

May god forgive me, but I'm rooting for the hackers on this one.

Job security you know?

GenshoTikamura - 5 days ago

There is an equal unit of trouble per each unit of "progress"

gregwebs - 6 days ago

Is there a proactive way to defend against invisible Unicode attacks?

handfuloflight - 6 days ago

The cunning aspect of human ingenuity will never cease to amaze me.

jdthedisciple - 5 days ago

simple solution:

preprocess any input to agents by restricting them to a set of visible characters / filtering out suspicious ones

nektro - 5 days ago

hijacked scrollbar. cardinal sin.

budmichstelk - 5 days ago

[dead]

zx0r1 - 5 days ago

[flagged]