4 ms·
I'm going to pick a fight on this one; I think you know I'm a fan, so take this in the spirit I intend†. My contention is that "lethal trifecta" is the AI equi
by tptacek 1y ago
I'm going to pick a fight on this one; I think you know I'm a fan, so take this in the spirit I intend†.
My contention is that "lethal trifecta" is the AI equivalent of self-XSS. It's not apparent yet, because all this stuff is just months old, but a year from now we'll be floored by the fact that people just aimed Cursor or Claude Code at a prod database.
To my lights, the core security issue with tool/function calling in agents isn't MCP; it's context hygiene. Because people aren't writing their own agents, they're convinced that the single-visible-context-window idiom of tools like Cursor are just how these systems work. But a context is just a list of strings. You can have as any of them in an agent as you want.
Once you've got untrusted data hitting one context window, and sensitive tool calls isolated in another context window, the problem of securing the system isn't much different than it is with a traditional web application; some deterministic code that a human reviewed and pentested mediates between those contexts, transforming untrusted inputs into trustable commands for the sensitive context.
That's not a trivial task, but it's the same task as we do now when, for instance, we need to generate a PDF invoice in an invoicing application. Pentesters find vulnerabilities in those apps! But it's not a news story when it happens, so much.
† More a note for other people who might thing I'm being irritable. :)
- simonw 1y agoI think the core of the whole problem is that if you have an LLM with access to tools and exposure to untrusted input, you should consider the author of that untrusted input to be have total control over the execution of those tools. MCP is just a widely agreed upon abstraction over hooking an LLM up to some tools. A significant potion of things people want to do with LLMs and with tools in general involve tasks where a malicious attacker taking control of those tools is a bad situation. Is that what you mean by context hygiene? That end users need to assume that anything bad in the context can trigger unwanted actions, just like you shouldn't blindly copy and paste terminal commands from a web page into your shell (cough, curl https://.../install.sh | sh) or random chunks of JavaScript into the Firefox devtools console on Facebook.com ?
- tptacek 1y agoOn the first two paragraphs: we agree. (I just think that's both more obvious and less fundamental to the model than current writing on this suggests). On the latter two paragraphs: my point is that there's nothing fundamental to the concept of an agent that requires you to mix untrusted content with sensitive tool calls. You can confine untrusted content to its own context window, and confine sensitive tool calls to "sandboxed" context windows; you can feed raw context from both to a third context window to summarize or synthesize; etc.
- simonw 1y agoRight - that's more or less the idea behind https://simonwillison.net/2023/Apr/25/dual-llm-pattern/ https://simonwillison.net/2023/Apr/25/dual-llm-pattern/ and the DeepMind CaMeL paper: https://simonwillison.net/2025/Apr/11/camel/ https://simonwillison.net/2025/Apr/11/camel/ The challenge is that you have to implement really good taint tracking (as seen in old school Perl) - you need to make sure that the output of a model that was exposed to untrusted data never gets fed into some other model that has access potentially harmful tool calls. I think that is possible to build, but I haven't seen any convincing implementation of the pattern yet. Hopefully soon!
- tptacek 1y agoSo, we've surfaced a disagreement, because I don't think you need something like taint tracking. I think the security boundary between an LLM context that takes untrusted data (from, e.g., tickets) and a sensitive context (that can, e.g., make database queries) is essentially no different than the boundary between the GET/POST args in a web app and a SQL query. It's not a trivial boundary, but it's one we have a very good handle on.
- TheTaytay 1y agoI don't understand the part where you said that you have a very good handle on it. I really want to believe that it's as simple and solvable as you say it is. or do you mean that it's easily solvable - it's just that no one has done it yet? (In which case I think you are Simonw are saying the same thing?) You mentioned the boundary between GET/POST args in a web app and a SQL query...but we have a system that is (by nature) mingling all of the parameters and execution together. It would be as if everyone's web server had a first line of their handler function that said something like "params = eval(user_based_params)", and you couldn't remove it...