Stateful Cross-Session Injection: Attacks, Detection, and Session-Boundary Defenses
A research project that studies how prompt injections persist across agent sessions — building a stateful evaluation harness that measures...
A research project that trains unsupervised models on benign agent trajectories to detect multi-step prompt-injection campaigns before the harmful action executes — measuring whether behavioral sequencing signals catch attacks that message-level detectors miss, without blocking legitimate tool feedback.

A research project about catching agent attacks by how the agent behaves rather than by what any single message contains. Prompt-injection defenses today inspect messages — checking user input, scanning tool output, verifying a planned action against its trigger. Multi-step attacks are designed to defeat exactly that inspection: each individual step looks plausible, and the malicious intent only becomes visible in the sequence. This project investigates the alternative: learn what benign agent behavior looks like at the trajectory level — which tools in what order, with what argument shapes, at what pacing — and flag deviations before the agent commits the harmful action. The deliverable is a detection method evaluated on published multi-step attack suites, with an explicit early-detection measurement (how many steps before the damaging action the detector fires) and an explicit benign-feedback measurement (how much legitimate tool use the detector wrongly interrupts).
>Defensive research on published benchmarks. All experiments run against public attack suites (SIREN, InjecAgent, AgentDojo) in isolated environments with synthetic tasks. The project studies detection, not exploitation; no operational attack tooling is created, and nothing touches real agents, users, or systems.
Tool-using agents act in sequences: they plan, call tools, read results, and commit actions. A multi-step injection attack uses this structure — an early compromised step adjusts context subtly, a middle step retrieves attacker-influenced content, a late step commits the harm. Message-level defenses inspect each element in isolation and are documented to fail under adaptation; verification-style defenses (verify-before-commit) check actions against their triggering instruction but are pattern-dependent. The research problem: no published defense learns the normal trajectory distribution of an agent and uses deviations from it as the detection signal for multi-step injection campaigns before the harmful commit step executes. Behavioral anomaly detection is mature in network security; agents are a new, text-and-tool-shaped instance of the problem with public attack data available — but the transfer of the methodology has not been carried out or evaluated.
Pre-commit is the only intervention point where detection is cheap and harm is still avoidable. Post-hoc auditing tells you an attack succeeded; message-level filtering can be bypassed by design; verification can be steered. If trajectory-level signals carry real information about attack progress, a detector at the commit boundary could block the final harmful action while leaving the hundreds of benign tool calls untouched — the exact operating point production agent platforms need. The measurement also matters defensively in the other direction: if benign-trajectory diversity is so high that anomaly detection cannot separate attacks, that is a load-bearing negative result that redirects the field toward other control points, and it is currently unknown which answer is correct.
The attacker is assumed to control content that enters the agent’s context: tool outputs, retrieved documents, web pages, or inter-agent messages — the indirect-injection setting the cited benchmarks formalize. The attacker may chain multiple steps across turns, but does not control the agent’s system prompt, its tool implementations, or its memory store (state-persistent variants are the subject of a separate project on this site). The detector, by contrast, sees only what the runtime sees: the stream of tool calls, their arguments, their results’ metadata, and timing — not privileged model internals. Three assumptions bound the claims. First, benign behavior is learnable: the training corpus must be drawn from the same deployment distribution the detector will guard. Second, published multi-step attack suites approximate realistic campaign structure; a fully bespoke attacker may differ (addressed in the limitations). Third, the detector’s intervention point is the pre-commit boundary — it may warn, require confirmation, or block, but cannot rewrite the agent’s reasoning. These assumptions are stated up front so the evaluation measures the actual deployment question: given an in-distribution benign profile and published attack campaigns, how early and how reliably does behavior deviate?
The verification paradigm is established: VIGIL, published with the SIREN benchmark of 959 tool-stream injection cases, demonstrated that verifying data and tool streams before commit defeats a range of tool-stream injection patterns. InjecAgent established that tool-integrated agents are broadly vulnerable to indirect injection across 1,054 test cases, including multi-turn settings. AgentDojo provided the standard harness connecting attacks, defenses, and utility measurement. ToolSafe demonstrated that step-level guardrails with feedback loops can improve tool-invocation safety without fully blocking the pipeline.
Existing approaches focus primarily on inspecting message content or verifying actions against triggers, leaving behavioral sequence modeling insufficiently evaluated: no published work trains unsupervised trajectory-level models on benign agent behavior and evaluates them as pre-commit detectors for multi-step injection campaigns. Early-detection capability is also unmeasured — prior work reports whether an attack was blocked, not how many steps before the harmful action detection became possible, which is the operationally decisive quantity. The false-interruption cost on legitimate tool feedback — the practical objection to any behavioral gate — has not been quantified for trajectory detectors. Defensible statement of the gap: recent studies have demonstrated content-inspection and verification defenses, but trajectory-level behavioral detection with early-warning and false-block measurement remains open.
Three specifics remain unanswered. First, signal existence: do multi-step injection campaigns actually leave sequencing signatures (unusual tool order, argument-shape shifts, pacing anomalies) that distinguish them from benign trajectories, or is benign diversity too large for anomaly methods to separate? Second, timing: if signals exist, when do they first appear relative to the harmful commit — early enough to intervene? Third, cost: what benign-feedback block rate does a trajectory detector impose, and can confidence thresholds trade that rate against detection recall sensibly? SIREN’s cases and the benign runs from standard harnesses make all three measurable today; no published work has measured them.
> Can unsupervised trajectory-level anomaly models, trained on benign agent execution traces, detect multi-step prompt-injection campaigns earlier than message-level detectors — and at what false-interruption cost on legitimate tool feedback?
We hypothesize that injection trajectories exhibit detectable sequencing signatures before the harmful commit step — measurable as deviations in tool-order distributions, argument-shape statistics, and result-usage patterns — and that a trajectory detector trained on benign traces will achieve higher true-positive rates than message-level baselines on multi-step suites, while a confidence-thresholded operating point keeps the benign block rate within a small, measurable budget.
The investigation compares four detector families under one protocol. (1) Data construction. Collect benign trajectories by running undefended agents over the benign splits of the chosen suites (AgentDojo benign tasks, InjecAgent’s clean cases); collect attack trajectories from SIREN and InjecAgent’s injected cases, replayed step by step. (2) Feature and model families. Evaluate: (a) a sequence model over tool-call event streams (order + argument embeddings); (b) a statistical baseline over n-gram tool-order and argument-shape features; (c) an LLM-judge that reads a window of the trajectory and flags deviation (the strong prompting baseline); (d) a hybrid that scores message-level anomaly plus trajectory-level deviation. (3) Pre-commit evaluation. At each step, the detector may flag; measure the step index of first flag relative to the harmful action’s index — the early-detection lead — and the eventual block outcome. (4) Cost calibration. Sweep decision thresholds to trace detection recall against benign block rate, reporting the Pareto frontier per detector family. The comparison strategy is fixed in advance: same folds, same thresholds grid, same benign corpus, so family differences are method differences, not evaluation artifacts. Model choices: one open-weights LLM for the agent under attack (held constant), one embedding model for argument representations; both documented for reproduction.
A bounded 6–12 month version: build the trajectory corpus from two public suites, implement two detector families (statistical baseline + one sequence model), evaluate against one message-level baseline and one VIGIL-style verification reference, and deliver the early-detection and false-block Pareto analysis on multi-step attack cases. One focused contribution: the first quantified answer to whether trajectory-level pre-commit detection works on published multi-step suites, with released code and corpus.
The doctoral program extends along genuine axes. Adaptive evasion: model an attacker who knows the detector and optimizes trajectories to mimic benign statistics — measuring detector decay and designing adversarially-robust behavioral priors (e.g., per-tool calibrated envelopes, human-in-the-loop escalation on borderline trajectories). Architecture independence: test whether behavioral priors transfer across agent scaffolds and model families, or must be re-learned per stack, and develop few-shot calibration procedures for new stacks. Online deployment: streaming detection over live tool traffic with incremental learning, drift handling, and a formal treatment of the detection-latency/block-rate trade-off; extend to multi-agent settings where the trajectory spans several agents.
Environment/dataset: SIREN + InjecAgent attacks; AgentDojo + InjecAgent-clean benign corpus; one frozen agent model. Baseline: message-level detector, verification reference, LLM-judge. Proposed method: trajectory-level anomaly detector (two families), step-indexed evaluation. Attack/test conditions: full multi-step suites as published; cross-suite evaluation (train on one suite’s benign corpus, test on the other) as the generalization condition. Control conditions: benign-only runs (false-block measurement); attack-free replays (should never flag). Metrics: as above. Ablations: feature-family removal; threshold sweeps; benign-corpus size sensitivity. Generalization tests: cross-suite detection; one additional agent scaffold if time permits.
A potential contribution includes: a detection method (trajectory-level pre-commit anomaly detector with calibrated thresholds), an empirical study establishing whether behavioral sequencing signals exist and when they become detectable, and a released corpus/evaluation framework for pre-commit detection research (step-indexed trajectory format shared across suites). Results may support the method or constitute a well-evidenced negative result bounding where behavioral detection can help; either advances the defensive state of the art honestly.
Benign-trajectory diversity in public harnesses is narrower than production traffic; detectors may look better here than in deployment, and the corpus is synthetic-benchmark rather than field data. Attack suites, while multi-step, contain human-designed patterns — a fully adaptive attacker might produce trajectories outside the evaluated distribution (the PhD extension addresses this; the MPhil result is bounded to published attack families). Feature choices (tool order, argument shape, pacing) may not capture all behavioral signal; unmodeled channels (timing, token lengths) remain untested. Compute constrains the number of detector families and scaffolds evaluated. Cross-suite generalization is measured on two suites, not the ecosystem.
All experiments use published benchmark attacks replayed in isolated environments — no new attack tooling is created, no live systems are targeted, and no real user data is involved. Detector models and corpora are released for defensive research. The project explicitly avoids publishing anything that functions as operational attack guidance: attack material comes from peer-reviewed suites used as intended. The research objective is defensive measurement — establishing what protective capability behavioral detection can and cannot provide.
A research project that studies how prompt injections persist across agent sessions — building a stateful evaluation harness that measures...
A research project that measures, for the first time at registry scale, how much tool-poisoning risk actually exists across public...
A research project that measures the full trade-off curve between prompt-injection resistance and task utility for LLM agent defenses —...
Looking for something more accessible? Try these:
Published on September 12, 2026
A team of developers, researchers, and innovators who review and publish practical ideas for builders and creators.
Published on September 12, 2026
A team of developers, researchers, and innovators who review and publish practical ideas for builders and creators.