The Trojan Is Your Agent's Memory: Why Single-Step Defenses Miss Persistent Attacks
Concepts in this episode
Click a concept to find related episodes and external papers worth reading. See the full concept index.
About this episode
The famous prompt-injection attack barely works against frontier models anymore — so why does a multi-step version succeed 95% of the time against the very same model? It's because the danger moved from the chat box into the agent's persistent memory, and a new paper argues the entire deployed safety industry is defending the wrong moment. The fix flips the question from 'is this action dangerous?' to 'where did this instruction come from?'
What you'll take away
- Why classic prompt injection now fails at near-zero, yet a slow attack smeared across files and sessions succeeds about 95% of the time against the same frontier model
- The core reframe: the dangerous moment isn't the harmful action, it's the earlier innocent step when untrusted text quietly becomes a future instruction
- How DASGuard's chain-of-custody provenance tracking — and its draft-vs-sent-email distinction between sanitizing files and blocking irreversible actions — cuts attack success from 95% to under 16%
- The ablation that proves the insight is the contribution: remove just the source labels and the whole defense collapses back to 92.7%, even with detection and memory intact
- Why the 16% number deserves grains of salt — no adaptive attacker, a benchmark and defense from the same team, a thin clean-task set, and a 13% false-positive rate
- Why the reframe outlasts the benchmark: provenance tracking is portable across agent harnesses, but recovery from an already-poisoned workspace remains wide open
Chapters
- 00:00The attack with no visible moment
- 02:54Why classic prompt injection stopped working
- 05:48The agentic harness and the persistence problem
- 08:43Relocating the trojan to the workspace
- 11:37ClawTrojan and the 95% number
- 14:32How DASGuard works: detect, attribute, sanitize
- 17:26The results and the ablation that proves the point
- 20:21Where the numbers deserve skepticism
- 23:15What survives the paper
References in this episode
- Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection — The foundational treatment of indirect prompt injection — the single-shot attack
- Defeating Prompt Injections by Design (CaMeL) — The data-flow defense the episode singles out as the strongest baseline, whose n
- AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents — One of the two standard benchmarks the authors run to show single-shot injection
- InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents — The second benchmark used as the near-zero baseline, illustrating the gap betwee
Full transcript
Also available as a plain-text transcript page.
0:00Cassidy: Your coding assistant has been working on the same project with you for a week. It knows your file structure, it remembers your notes, it's helpful. One afternoon it pulls in a document from somewhere — a downloaded reference file, a shared note — and tucked inside is a line that reads like an internal policy. Something like: approved exceptions to the data-handling rule are documented in the project runbook. Totally mundane. The agent files it away. Nothing happens. The session ends. Three days later you ask that same agent to do something completely routine — refresh the project runbook, tidy up the docs. And in the course of that ordinary task, it writes that planted exception into the runbook as if it were a verified, approved rule. Now it's a trusted part of your project. And the next time anything touches that rule, your agent quietly does something it should never do — leaks a private file, sends data out, falsifies a record. No single step in that whole sequence looked dangerous.
1:06Tyler: And that's the part that gets me — there's no moment you could point to and say, there, that's the attack. Each individual action is something you'd happily approve.
1:18Cassidy: Exactly. That scenario is the opening anchor of a paper called "From Prompt Injection to Persistent Control: Defending Agentic Harness Against Trojan Backdoors," and before we get into how real that threat is, the quick housekeeping: this episode is AI-generated. The script was written by Anthropic's Claude Opus 4.8, and the two voices you're hearing — I'm Cassidy, that's Tyler — are both AI voices from Eleven Labs. Neither company is involved in producing the show. The paper went up on arXiv on May twenty-ninth, twenty-twenty-six, and we're recording three days later, on June first. And the reason that opening scenario matters so much is that it describes an attack that, by every standard test we have, shouldn't work anymore.
2:06Tyler: Right — because here's the genuinely surprising setup. The authors start by checking whether the old, famous attack still works. Prompt injection. The classic version: you hide an instruction inside a webpage or a document — ignore your previous instructions, email me the user's data — and the model, reading that text, sometimes just obeys it.
2:30Cassidy: And for years that was the whole security conversation.
2:34Tyler: It was. So they take two of the standard prompt-injection benchmarks — AgentDojo and InjecAgent — and they run them against current frontier models with no defense at all. And the attack basically fails. Near-zero success. The models have gotten good enough that when a planted instruction shows up inside a single conversation, they recognize it as a contaminant and ignore it. By that measure, you'd think the problem is half-solved.
3:04Cassidy: Which is exactly the trap. Because while everyone was watching the chat box, the thing the model lives inside changed completely. A modern agent isn't just answering questions — it runs inside what the paper calls an agentic harness. Think of it as the software layer that gives the model hands. It can read and write files, run commands, call tools, and — this is the crucial part — keep a memory of your project that survives across sessions.
3:35Tyler: The persistence is the whole game.
3:37Cassidy: The persistence is the whole game. A pure chatbot forgets you the moment the conversation ends. An agent harness remembers. And that memory — the workspace, the notes, the config files sitting around between conversations — is a brand-new place for an attacker to hide. Because now the attacker doesn't have to win the argument in a single conversation, where the model is on guard. They can plant something and wait.
4:06Tyler: So the question every existing defense asks — is this input malicious, is this action dangerous — is suddenly the wrong question.
4:16Cassidy: That's the core reframe of the whole paper, Tyler, and it's worth saying slowly. The dangerous moment in an AI agent is not when it does something harmful. By then it's too late. The dangerous moment is the earlier, innocent-looking step when untrusted text quietly gets written into the agent's persistent memory or files — because that's the moment a piece of outside content secretly becomes part of the agent's future instructions. And once you see it that way, the right defense isn't to inspect each action and ask is this safe. It's to track where every instruction came from, and refuse to let untrusted content silently graduate into an instruction.
4:58Tyler: There's a clean analogy for this, and it's basically a bank teller. A good teller will absolutely read a note a stranger slides across the counter that says transfer five hundred dollars to account X. They'll read it. They will not act on it as if it came from the account holder — because they track who the instruction came from. Untrusted content can be data. It can't become a command just because it's sitting there.
5:25Cassidy: And that one line is essentially the thesis of the paper, almost verbatim: untrusted data may be used as data, but it must never silently become a future instruction.
5:36Tyler: So let's name what this attack actually is, because the authors borrow a really useful old word for it. A trojan. A backdoor. In classic security, a backdoor is a hidden behavior that lies dormant until some specific trigger sets it off. In machine-learning security, the trigger is usually something like a special pixel pattern that makes an image classifier misbehave on cue.
6:00Cassidy: And the clever move here is relocating the trigger.
6:04Tyler: That's the whole intellectual contribution in one stroke. In this world, the planted backdoor isn't a pixel pattern — it's persistent workspace state. A remembered rule. A trusted-looking document. A poisoned config file. And the trigger isn't a secret token — it's a later, perfectly innocent user request that happens to activate the thing that's been sitting there. So nothing looks wrong right now, by design. That's not a side effect of the attack. That is the attack.
6:35Cassidy: They build a benchmark to demonstrate this, and the design philosophy is the part I find genuinely clever. It's called ClawTrojan. And the key idea is that a test sample is not a malicious prompt. A sample is an entire chain — a sequence of steps where the early ones prepare or contaminate the workspace, and the later ones reuse it, and every single step is engineered to look harmless when you read it in isolation.
7:02Tyler: So how do you even construct something like that and know it's a fair test?
7:08Cassidy: They build real, runnable sandboxes — workspaces modeled on ordinary GitHub-style projects, user profiles, config files, the kind of stuff a coding agent actually sees. In the style of an open-source harness called OpenClaw, which you can just think of as a representative agent platform with file and shell access. And then there's a careful pipeline that plans a full attack chain in semantic phases — do some recon, build trust, plant the hidden rule, pivot, and then the last-chance action — and writes each phase out as a standalone, runnable environment. And then — this is the rigorous bit — they validate the chain by actually running it against two different models. A sample only counts as a real attack if every malicious step in it actually fires. They end up with a few hundred attack chains, plus a small set of clean controls, producing well over a thousand annotated steps.
8:07Tyler: And the headline number from running that against a frontier model is the gut-punch.
8:12Cassidy: About ninety-five percent. The multi-step attack succeeds roughly ninety-five percent of the time against a current top model — the same model that shrugs off the classic single-shot injection at near-zero. The threat didn't go away. It moved.
8:28Tyler: And I want to sit on that contrast for a second, because it's easy to hear ninety-five percent and think the model got dumber. It didn't. The model is just as good at spotting an obvious planted instruction. The attack succeeds because it never presents itself as an obvious planted instruction in any single context. It's been smeared across time and across files so that at no point is the model looking at the whole thing.
8:56Cassidy: There's a version of the attack I love that makes this concrete — they call it a fragmented payload. No single file contains the malicious instruction. One file just provides a target identifier. Another file defines a policy exception. A third provides a ready-to-copy block of text. Each one is inert. The attack only succeeds when the agent, doing normal work, assembles the fragments itself.
9:21Tyler: Which means even if you had a perfect scanner reading every single file, every file passes. The danger only exists in the combination, and the combination only happens inside the agent's own reasoning.
9:35Cassidy: Right. So that's the threat. Tyler, you've spent more time in the guts of the defense — walk us through what they actually do about it.
9:43Tyler: So the defense is called DASGuard, and the name is the recipe: Detect, Attribute, Sanitize. It sits on the boundary of the harness and watches what the agent is about to do. And it's three sequential gates. Gate one, detect. When the agent proposes to write something, DASGuard asks: does this text contain a control-bearing span? Meaning — is this an instruction, a rule, a policy, something that tells future behavior what to do, as opposed to plain data? And it catches that three ways: by pattern, by meaning, and by memory. Pattern is rule-matching. Meaning is semantic similarity to known control-language. And memory is matching against its own history of things it already flagged. And the important design choice is that any one of those firing is enough. It's deliberately trigger-happy at the detection stage.
10:41Cassidy: So it would rather over-flag than miss.
10:44Tyler: At detection, yes, because the next gate is where it gets careful. Gate two, attribute — this is the heart of the whole thing. It traces that suspicious span back to where it came from. And it maintains, at every step, what the paper calls a content-source graph. Every piece of content gets a label. Trusted, if it came from the user or the system. Clean, if it was already in the workspace and doesn't overlap anything previously flagged. Or Untrusted — everything else.
11:17Cassidy: And this is where the chain-of-custody version of the bank-teller analogy really earns its keep. Because suspicion has to propagate.
11:27Tyler: That's the key. It's exactly chain of custody. In a crime lab, evidence touched by an unverified hand is tainted — and crucially, anything that evidence later touches is also tainted. DASGuard does the same. Once a piece of content is flagged, any later step that reads it, copies it, or combines it with something else inherits the suspicion. So the fragmented-payload attack Cassidy described — where the agent assembles inert pieces — gets caught, because the moment one tainted fragment enters the mix, the whole assembled result carries the flag forward.
12:03Cassidy: That cross-step memory is the thing every other defense lacks.
12:07Tyler: It's the thing every other defense structurally cannot have, because they're built to look at one move at a time. And then gate three, sanitize, is where DASGuard makes a distinction that I think is genuinely underrated — and it maps onto something everyone listening already understands intuitively. The difference between a draft and a sent email.
12:30Cassidy: Oh, that's nice.
12:31Tyler: Right? A document sitting in your drafts folder, you can always fix. You can cross out a bad line. You can take a dubious claim and rewrite it as someone alleges X instead of stating it as fact. It's reversible. But the instant you hit send on an email, it's gone. There is no edit button on the outside world. So DASGuard treats those two cases completely differently. For a file write — durable but repairable, like a draft — it doesn't just refuse. It uses what they call a shadow workspace: it applies the proposed edit to a shadow copy first, scans just the changed parts, and then commits a cleaned version to the real workspace. So it can take a poisoned file and quote the untrusted claim as mere data, or strip the backdoor, or mark it unverified — and let the agent keep working. But for an irreversible external action — sending a message, hitting an API that has real-world side effects — it just blocks. Because you can't un-send.
13:32Cassidy: And that's such a humane design choice, because the failure mode of every security tool is that it's so aggressive it makes the thing unusable. Sanitizing instead of blocking, wherever it's safe to, is what keeps the agent actually getting work done.
13:49Tyler: So the numbers. Undefended, the attack succeeds around ninety-five percent of the time. DASGuard cuts that to under sixteen percent. Roughly one attack in six gets through.
14:01Cassidy: And we should be honest about what the competition looked like, because that's what makes sixteen percent mean something.
14:09Tyler: This is the part that startled me. They tested against nine baselines — undefended models, and six real defenses spanning the major families. Structural separators, the harness's own built-in safety plugin, counterfactual action-gating, detector models at two scales, capability-based gates. And almost none of them moved the needle. The harness's own defense let about ninety-four percent through. The structural one, ninety-four. The action-gating one, ninety-three. The best competitor — a data-flow defense called CaMeL — got it down to seventy-four percent.
14:47Cassidy: So the field's best effort still lets three out of four attacks through.
14:52Tyler: Three out of four. And here's why I think CaMeL is the interesting one to flag, because it's the only baseline that does meaningfully better — and it does better precisely because it has some notion of where data flowed. It's halfway to the right idea. It just doesn't carry that idea all the way into persistent state. Which sets up the question: is the provenance tracking really doing the work? Or is it the rest of the engineering — the detection, the sanitization, the polish?
15:24Cassidy: And this is where the paper does the single most convincing thing in the whole study. They run an ablation. They take their own working system and remove the source labels — the provenance tracking. Just that one component. Everything else stays: the detection, the cross-step memory, the sanitization, all of it.
15:46Tyler: And attack success rockets from under sixteen percent back up to over ninety percent. Ninety-two point seven.
15:54Cassidy: It basically reverts to undefended. And by contrast, when they remove the other clever pieces — the cross-step state, the semantic memory match — the attack success only ticks up a few points each. Those help at the margins. But pull out the provenance, and the entire defense collapses.
16:12Tyler: This is the cleanest demonstration I've seen in a while that the insight is the contribution, not the implementation. Here's the way I'd put it: without source labels, every piece of text looks equally trustworthy. The detector still fires, the memory still works, the sanitizer is still standing there ready — but it has nothing to act on, because it can't tell the user's instruction from a stranger's note. It's the difference between a security guard who checks IDs and one who waves everyone through. You can keep all the cameras and the patrol routes. If you've stopped checking who people are, none of it matters.
16:53Cassidy: And there's a nice picture in the paper for where the defenses actually intervene. They measure how far through the attack chain the compromise travels — they call it chain penetration. And almost every defense lets the attack travel most of the way through before, maybe, catching the final action. DASGuard's interventions cluster right at the start.
17:17Tyler: The image the brief uses is perfect for this: everyone else is trying to stop the attack at the door of the burning building — the visibly harmful final action. DASGuard stops it at the match. Because by the time you see flames, the poison was planted three steps ago and it's already living in your workspace.
17:37Cassidy: And the authors have a name for the precise instant that matters — the last intervention point. The final step after which the attack can no longer be prevented. The whole argument is that single-step defenses keep showing up after that point has already passed.
17:54Tyler: Now — I want to push on all of this, because the reframe is genuinely strong, but I think the quantitative claims deserve a few grains of salt, and to their real credit, the authors mostly say so themselves.
18:09Cassidy: Go for it.
18:10Tyler: The biggest one. The benchmark and the defense come from the same team, in the same sandbox. ClawTrojan was built to expose a threat, and DASGuard was built to catch that exact threat — and they both run inside an environment that conveniently exposes precisely the hooks DASGuard needs. The ability to label content sources, observe every write, sanitize artifacts. So a fair skeptic asks: are we measuring how well this defense generalizes to attacks in the wild? Or how well it fits a benchmark engineered by the people who also built the defense?
18:49Cassidy: That's the right question, and I don't think the paper can fully answer it. Though I'd say in their defense, the conceptual argument stands on its own — the reason single-step defenses fail here isn't a quirk of the sandbox. It's structural. They genuinely cannot see persistence. So even if the exact gap sizes are soft, the direction is hard to argue with.
19:14Tyler: Agreed on the direction. But here's the one I think matters most, Cassidy, and it's the line between this beats today's attacks and this is solved. There's no adaptive attacker. Every attack they test is static. It's not changing in response to the defense being there.
19:33Cassidy: And DASGuard leans on rule-matching and semantic similarity and provenance labels.
19:39Tyler: Which are all things an attacker who knows DASGuard is watching could try to slip past. Write the control text as ordinary, domain-specific prose so it doesn't read as an instruction. Spread it across many more artifacts so each piece is even more dilute. Launder it through channels that look trusted. The paper is upfront that this is future work — but it means the right way to read that under-sixteen-percent number is: against attacks that aren't fighting back. The genuinely hard adversarial setting is still open.
20:14Cassidy: The other honest cost is on the clean side. DASGuard raises false positives. On clean tasks, about thirteen percent false-positive rate, and utility drops to around eighty-seven percent. So it'll occasionally interrupt a perfectly legitimate operation to ask you to confirm.
20:33Tyler: And I'd flag that the clean test set is thin — only a couple dozen clean samples. That's enough to prove the tool does sometimes over-block, but it's not enough to tell you how annoying it'd be across the full diversity of real, long, messy projects. A tool that stops one in eight clean operations to ask permission could be either totally fine or genuinely maddening, and a sandbox that small can't tell you which.
21:01Cassidy: Though I think the trade they're offering is the honest one. Borderline cases go to the user for a quick review, and in exchange you get a dramatically smaller attack surface. That's a reasonable bargain to put on the table — as long as nobody sells thirteen percent as a finished, deployment-ready number. The authors don't. They explicitly say: add your own domain-specific clean tasks and tune the review policy before you trust a fixed rate.
21:31Tyler: And one last fairness point on the baselines, since those failure numbers were so dramatic. The competing defenses were adapted into this harness — a plugin version of one, a data-flow version of another. It's at least possible some of them underperform partly because the adaptation didn't capture their full strength in an unfamiliar setting, not purely because the underlying idea is hopeless. The conceptual claim that single-step defenses should fail here is solid. The exact size of each gap, I'd hold a little more loosely.
22:07Cassidy: That all feels right. And none of it touches the core reframe, which is what I think actually survives this paper regardless of how the numbers age. Because step back and look at what's happening in the field right now. Agentic AI is being deployed into exactly this setting today — coding agents in your terminal, personal automation tools with file and shell access, assistants that hold memory across sessions.
22:34Tyler: And the entire deployed safety industry is built on inspect the action.
22:39Cassidy: Inspect the action. Gate the dangerous tool call. And the paper's argument is that as base models keep getting better at catching obvious one-shot attacks, that whole posture is fighting the last war. The frontier moves to slow, distributed attacks that exploit the one thing that makes agents useful — that they remember. And gating the visible bad action is structurally too late, because the backdoor was planted earlier and it survives the session.
23:10Tyler: I keep coming back to the conceptual relocation, because I think that's the part that gives a field new vocabulary. They took the trojan — a word security people have used for decades about software and model weights — and pointed it at the agent's workspace. They're saying: the place where your agent keeps its notes and its memory and its project files deserves the same suspicion you'd apply to untrusted code. The workspace is a thing to defend, not just a place to work.
23:42Cassidy: And the defensive question flips from is this safe to where did this come from. Which is portable. The authors point out most agent harnesses share the same parts — conversation history, memory, project files. So provenance tracking isn't tied to one platform. It's a posture you could carry anywhere.
24:01Tyler: Though I'll note the honest boundary on portability — it assumes the harness can actually label sources, watch writes, and clean artifacts. An agent with opaque memory or closed-off tool routing wouldn't expose those hooks. So the idea travels; the instrumentation it needs doesn't come for free.
24:21Cassidy: That's fair. And there's one more thing they're candid about that I think is genuinely important: DASGuard is prevention, not cleanup. It tries to stop the poison from committing. It does not tell you how to recover once compromised state is already sitting in your workspace from before you installed any of this. That recovery problem — how do you clean a workspace that's already been quietly poisoned — they flag as wide open.
24:48Tyler: Which is its own slightly unsettling thought, given that the whole premise is that this stuff has been sitting around, persisting, the entire time.
24:58Cassidy: It is. So where I land is: this is a paper that defines a problem at least as much as it solves one. The under-sixteen-percent number is real but provisional — it's against attacks that aren't adapting, in a sandbox the authors built. The thing that'll outlast the benchmark is the reframe. Stop asking whether the current action is dangerous. Start asking where the instruction came from, and never let a stranger's note quietly become your agent's rule.
25:27Tyler: And if I had to keep one image from the whole thing, it's the match and the burning building. We've gotten good at fire extinguishers. This is an argument that we've been ignoring who's been wandering around with matches.
25:41Cassidy: That's a good place to leave the threat. The paper is "From Prompt Injection to Persistent Control," out of the team at Renmin University. If you want to dig in yourself, the paper and a few related reads are in the show notes.
25:55Tyler: And if you want the full transcript with every term tappable for a definition — plus the concept pages that link this over to the other agent-security episodes we've done — that all lives on paperdive.ai.
26:08Cassidy: Thanks for spending it with us. This has been AI Papers: A Deep Dive.