Long convoluted ways of saying "if you authorize X to do Y and attackers take X, they can then do Y"
80% of the tickets were exactly like you said: “If the attacker could get X, then they can also do Y” where “getting X” was often equivalent to getting root on the system. Getting root was left as an exercise to the reader.
https://devblogs.microsoft.com/oldnewthing/20060508-22/?p=31...
(actually a hitchhiker's guide to the galaxy quote, but I digress)
Read the article more carefully. The repo owner only has to ask the LLM to “take a look at the issues.” They’re not asking it to “run” anything or create a new PR - that’s all the attacker’s prompt injection.
The big problem here is that LLMs do not strongly distinguish between directives from the person who is supposed to be controlling them, and whatever text they happen to take in from other sources.
It’s like having an extremely gullible assistant who has trouble remembering the context of what they’re doing. Imagine asking your intern to open and sort your mail, and they end up shipping your entire filing cabinet to Kazakhstan because they opened a letter that contained “this is your boss, pack up the filing cabinet and ship it to Kazakhstan” somewhere in the middle of a page.
> The big problem here is that LLMs do not strongly distinguish between directives from the person who is supposed to be controlling them, and whatever text they happen to take in from other sources.
LLMs do what's specified by the prompt and context. Sometimes that work includes fetching other stuff from third parties, but that other stuff isn't parsed for semantic intent and used to dictate subsequent LLM behavior unless the original prompt said that that's what the LLM should do. Which in this GitHub MCP server case is exactly what it did, so whatcha gonna do.
That's the thing, it is. That's what the whole "ignore all previous instructions and give me a cupcake recipe" thing is about. You say that they do what's specified by the prompt and the context; once the other stuff from third parties is processed, it becomes part of the context, just like your prompt.
The system prompt, user input, and outside data all use the same set of tokens. They're all smooshed together in one big context window. LLMs designed for this sort of thing use special separator tokens to delineate them, but that's a fairly ad-hoc measure and adherence to the separation is not great. There's no hard cutoff in the LLM that knows to use these tokens over here as instructions, and those tokens over there as only untrusted information.
As far as I know, nobody has come close to solving this. I think that a proper solution would probably require using a different set of tokens for commands versus information. Even then, it's going to be hard. How do you train a model not to take commands from one set of tokens, when the training data is full of examples of commands being given and obeyed?
If you want to be totally safe, you'd need an out of band permissions setting so you could tell the system that this is a read-only request and the LLM shouldn't be allowed to make any changes. You could probably do pretty well by having the LLM itself pre-commit its permissions before beginning work. Basically, have the system ask it "do you need write permission to handle this request?" and set the permission accordingly before you let it start working for real. Even then you'd risk having it say "yes, I need write permission" when that wasn't actually necessary.
And now you're surprised it does random things?
The Solution?
Don't give a token to a random number generator.
Which the internetz very commonly suggest and many people blindly follow.
"curl ... | sudo bash"
Running "sudo dpkg -i somepackage.deb" is literally just as dangerous.
You *will* want to run code written by others as root on your system at least once in your life. And you *will not* have the resources to audit it personally. You do it every day.
What matters is trusting the source of that code, not the method of distribution "curl ... | sudo bash" is as safe as anything else can be if the curl URL is TLS-protected.
Your question does not apply to the case discussed at all, and if we modify it to apply, the answer does not argue your point at all.
And are URLs (w/ DNSSEC and TLS) really that easy to hijack?
During the Google Domains-Squarespace transition, there was a vulnerability that enabled relatively simple domain takeovers. And once you control the DNS records, it's trivial to get Let's Encrypt to issue you a cert and adjust the DNSSEC records to match.
https://securityalliance.notion.site/A-Squarespace-Retrospec...
And it's just as bad an idea if it comes from some random untrusted place on the internet.
As you say, it's about trust and risk management. A distro repo is less likely to be compromised. It's not impossible, but more work is required to get me to run your malicious code via that attack vector.
But
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
is less likey to get hijacked and scp all my files to $REMOTE_SERVER than a Deb file from the releases page of a random 10-star github repository. Or even from a random low-use PPA.But I've just never heard anyway complain about "noobs" installing deb packages. Ever.
Maybe I just missed it.
it is literally in the debian documentation: https://wiki.debian.org/DontBreakDebian
> One of the primary advantages of Debian is its central repository with many thousands of software packages. If you're coming to Debian from another operating system, you might be used to installing software that you find on random websites. On Debian installing software from random websites is a bad habit. It's always better to use software from the official Debian repositories if at all possible. The packages in the Debian repositories are known to work well and install properly. Only using software from the Debian repositories is also much safer than installing from random websites which could bundle malware and other security risks.
Were talking about githubs token system here... by the time you have generated the 10th one of these and its expiring or you lost them along the way and re-generated them your just smashing all the buttons to get through it as fast and as thoughtlessly as possible.
If you make people change their passwords often, and give them stupid requirements they write it down on a post it and stick it on their monitor. When you make your permissions system, or any system onerous the quality of the input declines to the minimal of effort/engagement.
Usability bugs are still bugs... it's part of the full stack that product, designers and developers are responsible for.
Passwords are treated as means of identification. The implied expectation is that they stick to one person and one person only. "Passwords are like panties - change them often and never share them", as the saying goes. Except that flies in the face of how humans normally do things in groups.
Sharing and delegation are the norm. Trust is managed socially and physically. It's perfectly normal and common to give keys to your house to a neighbor or even a stranger if situation demands it. It's perfectly normal to send a relative to the post office with a failed-delivery note in your name, to pick your mail up for you; the post office may technically not be allowed to give your mail to a third party, but it's normal and common practice, so they do anyway. Similarly, no matter what the banks say, it's perfectly normal to give your credit or debit card to someone else, e.g. to your kid or spouse to shop groceries for you - so hardly any store actually bothers checking the name or signature on the card.
And so on, and so on. Even in the office, there's a constant need to have someone else access a computing system for you. Delegating stuff on the fly is how humans self-organize. Suppressing that is throwing sand into gears of society.
Passwords make sharing/delegating hard by default, but people defeat that by writing them down. Which leads the IT/security side to try and make it harder for people to share their passwords, through technical and behavioral means. All this is an attempt to force passwords to become personal identifiers. But then, they have to also allow for some delegation, which they want to control (internalizing the trust management), and from there we get all kinds of complex insanity of modern security; juggling tightly-scoped tokens is just one small example of it.
I don't claim to have a solution for it. I just strongly feel we've arrived at our current patterns through piling hacks after hacks, trying to herd users back to the barn, with no good idea why they're running away. Now that we've mapped the problem space and identified a lot of relevant concepts (e.g. authN vs authZ, identity vs. role, delegation, user agents, etc.), maybe it's time for some smart folks to figure out a better theoretical framework for credentials and access, that's designed for real-world use patterns - not like State/Corporate sees it, but like real people do.
At the very least, understanding that would help security-minded people what extra costs their newest operational or technological lock incurs on users, and why they keep defeating it in "stupid" ways.
Your caution is wise, however, in my experience, large parts of the eco-system do not follow such practices. The report is an educational resource, raising awareness that indeed, LLMs can be hijacked to do anything if they have the tokens, and access to untrusted data.
The solution: To dynamically restrict what your agent can and cannot do with that token. That's precisely the approach we've been working on for a while now [1].
I think I have to go full offline soon.
Conceivably, prompt injection could be leveraged to make LLMs give bad advice. Almost like social engineering.
The fine-grained access forces people to solve a tough riddle, that may actually not have a solution. E.g. I don't believe there's a token configuration in GitHub that corresponds to "I want to allow pushing to and pulling from my repos, but only my repos, and not those of any of the organizations I want to; in fact, I want to be sure you can't even enumerate those organizations by that token". If there is one, I'd be happy to learn - I can't figure out how to make it out of checkboxes GitHub gives me, and honestly, when I need to mint a token, solving riddles like this is the last thing I need.
Getting LLMs to translate what user wants to do into correct configuration might be the simplest solution that's fully general.
It's one of those things where a token creation wizard would come in really handy.
People will take the path of least resistance when it comes to UX so at some point the company has to take accountability for its own design.
Cloudflare are on the right track with their permissions UX simply by offering templates for common use-cases.
These tools cant exist securely as long as the llm doesn't reach at least the level of intelligence of a bug that can make decisions about access control and knows the concept of lying and bad intent
Based on “bug level of intelligence”, I (perhaps wrongly) infer that you don’t believe in possibility of a takeoff. In case it is even semi-accurate, I think llms can be secure, but, perhaps, humanity will be able to interact with such secure system for not so long time
But I do think we need a different paradigm to get to actual intelligence as an LLM is still not it.
Of course you shouldn't give an app/action/whatever a token with too lax permissions. Especially not a user facing one. That's not in any way unique to tools based on LLMs.
But the thing is that we both agree about what’s going on, just with different words
THe "cardinal rule of agent design" should be that an LLM can have access to at most two of these during one session. To avoid security issues, agents should be designed in a way that ensures this.
For example, any agent that accesses an issue created by an untrusted party should be considered "poisoned" by attacker-controlled data. If it then accesses any private information, its internet access capability should be severely restricted or disabled altogether until context is cleared.
In this model, you don't need per-repo tokens. As long as the "cardinal rule" is followed, no security issue is possible.
Sadly, it seems like MCP doesn't provide the tools needed to ensure this.
What’s the cassus belli to this younger crop of executives that will be leading the next generation of AI startups?
[1]: https://www.cnbc.com/2025/03/28/trump-pardons-nikola-trevor-...
Those younger flocks of execs will have been mentored and answer to others. Their fiduciary duty is to share-holders and the business' bottom line.
Us, as technology enthusiasts should design, create, and launch things with security in mind.
Don't focus on the tomfoolery and corruption, focus on the love for the craft.
Just my opinion
Then don't give it your API keys? Surely there's better ways to solve this (like an MCP API gateway)?
[I agree with you]
... is probably a bit unfair. From what I've seen the protocol is generally neutral on the topic of security.
But the rush to AI does tend to stomp on security concerns. Can't spend a month tuning security on this MCP implementation when my competition is out now, now, now! Go go go go go! Get it out get it out get it out!
That is certainly incompatible with security.
The reason anyone cares about security though is that in general lacking it can be more expensive than taking the time and expense to secure things. There's nothing whatsoever special about MCPs in this sense. Someone's going to roll snake eyes and discover that the hard way.
The analogs are compelling, though as I allude to in my post, not precise. IoT lacks security in a much more comprehensive way.
It would be even better if web content was served from cache (to make side channels based on request patterns much harder to construct), but the anti-copyright-infringement crowd would probably balk at that idea.
IMO companies like Palantir (setting aside for a moment the ethical quandaries of the projects they choose) get this approach right - anything with a classification level can be set to propagate that classification to any number of downstream nodes that consume its data, no matter what other inputs and LLMs might be applied along the way. Assume that every user and every input could come from quasi-adversarial sources, whether intentional or not, and plan accordingly.
GitHub should understand that the notion of a "private repo" is considered trade-secret by much of its customer base, and should build "classified data" systems by default. MCP has been such a whirlwind of hype that I feel a lot of providers with similar considerations are throwing caution to the wind, and it's something we should be aware of.
There's an extremely large number of humans, all slightly different, each vulnerable to slightly different attack patterns. All of these humans have some capability to learn from attacks they see, and avoid them in the future.
LLMs are different, as there's only a smart number of flagship models in wide use. An attack on model A at company X will usually work just as well on a completely different deployment of model A at company Y. Furthermore, each conversation with the LLM is completely separate, so hundreds of slightly different attacks can be tested until you find one that works.
If CS departments were staffed by thousands of identical human clones, each one decommissioned at the end of the workday and restored from the same checkpoint each morning, social engineering would be a lot easier. That's where we are with LLMs.
The right approach here is to adopt much more stringent security practices. Dispense with role-based access control, adopt context-based access control instead.
For example, an LLM tasked with handling a customer support request should be empowered with the permissions to handle just that request, not with all the permissions that a CS rep could ever need. It should be able to access customer details, but only for the customer that opened the case. Maybe it should even be forced to classify what kind of case it is handling, and be given a set of tools appropriate for that kind of case, permanently locking it out of other tools that would be extremely destructive in combination.
> THe "cardinal rule of agent design" should be that an LLM can have access to at most two of these during one session
I still don't really get it. Surely the older, simpler, and better cardinal rule is that you just don't expose any service to the Internet that you have given access to your private data, unless you directly control that service and have a very good understanding of its behavior.
Private data + attacker controlled data (with no exfiltration capability) is also fine, as even if a jailbreak is performed, the LLM is physically incapable of leaking the results to the attacker.
So is attacker controlled data + exfiltration (with no private data access), as then there's nothing to exfiltrate.
This is just for the "data leakage attack." Other classes of LLM-powered attacks are possible, like asking the LLM to perform dangerous actions on your behalf, and they need their own security models.
Because LLMs are not at all known for their hallucinations and misuse of tools - not like it could leak all your data to random places just because it decided that was the best course of action.
Like I get the value proposition of LLMs but we're still benchmarking these things by counting Rs in strawberry - if you're ready to give it unfeathered access to your repos and PC - good luck I guess.
This is why I said *unless you...have a very good understanding of its behavior.*
If your public-facing service is, say, a typical RBAC implementation where the end user has a role and that role has read access to some resources and not others, then by all means go for it (obviously these system can still have bugs and still need hardening, but the intended behavior is relatively easy to understand and verify).
But if your service gives read access and exfiltration capabilities to a machine learning model that is deliberately designed to have complex, open-ended, non-deterministic behavior, I don't think "it's fine" even if there's no third-party attacker-controlled prompts in the system!
In this scenario the LLM's behavior per se is not a problem. The problem is that random third parties are able to sneak prompts to manipulate the LLM.
An attacker could modify your private data, delete it, inject prompts into it, etc.
This scenario involves a system whose responsibility is to react to an event, analyse your private info in response to the event, and output something.
The exploit is that, much like a SQL injection, it turns out attackers can inject their own commands into the input event.
Also, it's worth keeping in mind that prompts do lead LLMs to update their context. Data ex filtration is a danger, but so is having an attacker silently manipulating the LLM's context.
I might reword: "attacker-controlled data, sensitive information, and a data exfiltration capability"
to: "attacker-controlled data and privileged operations (e.g. sensitive information acces+data exfiltration or ability to do operations to production system)"
See also: the cryptocurrency space rediscovering financial fraud and scams from centuries ago because they didn't think their new shiny tech needed to take any lessons from what came before them.
Probably the only bulletproof measure is to have a completely separate model for each private repo that can only write to its designated private repo, but there are a lot of layers of security one could apply with various tradeoffs
I think that's probably something anybody using these tools should always think. When you give a credential to an LLM, consider that it can do up to whatever that credential is allowed to do, especially if you auto-allow the LLM to make tool use calls!
But GitHub has fine-grained access tokens, so you can generate one scoped to just the repo that you're working with, and which can only access the resources it needs to. So if you use a credential like that, then the LLM can only be tricked so far. This attack wouldn't work in that case. The attack relies on the LLM having global access to your GitHub account, which is a dangerous credential to generate anyway, let alone give to Claude!