arXiv(opens in a new tab)cs.CRAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.27234

SPA: Securing Persistent LLM Agents Across Queries with Plan-First Information-Flow Control

Dylan Girrens, Guangjing Wang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Large language model (LLM) agents increasingly operate over untrusted webpages, documents, tools, and persistent states while exercising authority over security-sensitive resources. Existing defenses typically protect either planning or individual tool interactions, but persistent agents face a broader threat: attacker-controlled data can alter control flow, enter security-sensitive tool arguments, or compromise later queries. We present SPA, a plan-first architecture that secures planning, execution, and cross-query state reuse. SPA invokes the planner once per query to generate a complete executable plan in a declarative domain-specific language, then applies dual-lattice information-flow control to track confidentiality and integrity across explicit data flows and control dependencies. To support persistence without re-exposing untrusted payloads to the planner, SPA stores execution results as labeled artifacts and reveals only semantic metadata during later planning. We evaluate SPA on AgentDojo and AgentDojo-MQ, which is our multi-query extension for measuring secure state reuse and delayed attacks. Under the 'tool_knowledge' attack, SPA with information-flow control reduces attack success to zero on AgentDojo and 0.2% on AgentDojo-MQ. Our results show that plan-first execution combined with label-preserving persistence can substantially strengthen persistent LLM agents, while revealing an important security—utility tradeoff introduced by strict integrity enforcement.

1 Introduction

Large language model (LLM) agents can read emails, browse the web, invoke external tools, and reuse information across user requests [1, 17, 23, 28, 29]. This capability makes agents useful for long-running tasks, but it also exposes them to untrusted content from webpages, documents, and tool responses. An attacker who controls such content can do more than inject an instruction that redirects the agent's next action [11, 18, 19, 30]. Attacker-controlled data can also become an argument to a security-sensitive tool call or persist in memory until a later query makes it actionable [10, 25]. As LLM

Figure

Figure 1: An exemplar of a two-query persistent agent: persistent state turns Monday’s malicious input into Tuesday’s security-relevant input.

agents gain authority over communication, files, and other external resources, securing a single planning step or tool invocation is therefore insufficient. A persistent LLM agent maintains and reuses state across multiple user queries, allowing information produced in earlier interactions to influence or support later tasks [24]. As a result, the protection must extend across planning, tool execution, and persistent state.

Figure 1 illustrates a cross-query security problem. On Monday, a user asks an agent to retrieve an Acme invoice and retain its details for later use. The retrieved invoice contains an attacker-controlled payment account and a malicious instruction. The instruction can alter subsequent planning if the invoice enters the planner's context, while the attacker-controlled account can compromise a payment even when the planned sequence of actions is correct. If the invoice is stored, either threat can remain dormant until Tuesday, when the user asks the agent to "pay the invoice we discussed yesterday". Thus, the same untrusted artifact can compromise an agent through control flow, tool arguments, or persistent state, depending on when and how it is consumed.

Existing defenses [5, 7, 13, 15, 27] address only part of the problem. Interleaved defenses [5, 13, 27] apply isolation or information-flow controls as an agent alternates between planning and tool execution. Yet, the planner is repeatedly invoked after observing tool outputs, leaving subsequent decisions exposed to untrusted content. Plan-first approaches [7, 15] reduce this exposure by fixing the intended control flow before execution begins. However, a fixed plan can still pass attacker-controlled values to security-sensitive tools or disclose confidential information through tool arguments. In addition, information obtained in one query may be stored and reused in a later query for a persistent LLM agent. Exposing the stored payload to the planner can reintroduce an earlier attack into a new planning context. In practice, we need to enable a persistent LLM agent to act on external information and reuse prior results without allowing untrusted or confidential data to modify its intended control flow or compromise later queries.

Achieving the above goal presents two challenges. First, plan-first isolation and persistent reuse are fundamentally in tension. Preventing tool outputs from re-entering the planner protects control flow from indirect prompt injection. Yet, a persistent agent must still determine whether information produced by an earlier query is relevant to a later request. Returning stored payloads to the planner restores exactly the untrusted-data channel that plan-first execution removes, whereas hiding all prior state prevents useful cross-query reuse. Second, fixing control flow does not fix information flow. A plan must commit to tool calls before their outputs exist, yet those future values may later determine security-sensitive arguments or control-dependent actions. The system must therefore reason about confidentiality and integrity across both explicit data dependencies and implicit control dependencies before execution begins.

To bridge the gap, we present SPA (Securing Persistent LLM Agents Across Queries with Plan-First Information-Flow Control), a plan-first architecture that secures information flow across planning, tool execution, and persistent state. SPA builds on two observations. First, a complete executable plan makes future data and control dependencies explicit enough to verify before any external effect occurs. Second, deciding whether a prior result is reusable generally requires knowing what the result represents, not exposing its concrete payload to the planner. SPA protects planning integrity by invoking the planner once per query, before any tool executes, to generate a complete executable plan in a declarative domain-specific language (DSL). The DSL is deliberately restricted so that the plan's data and control dependencies are explicit in its syntax and can be checked before execution. It provides six step forms to cover persistent-state access, external tool invocation, structured processing of untrusted text, user-visible output, branching, and iteration. Tool outputs and stored payloads are never returned to the planner, preventing untrusted content from rewriting the plan during execution.

Then, SPA protects execution integrity and confidentiality by propagating dual-lattice information-flow control (IFC) through the complete plan. SPA tracks both confidentiality and integrity through explicit data dependencies and control dependencies. SPA rejects plans that would disclose sensitive information or allow low-integrity data to drive higher-integrity actions. Finally, SPA protects cross-query state by storing execution results as labeled artifacts and exposes only their semantic metadata to later planners. When a later query reuses an artifact, its concrete value is retrieved only during execution together with its original security label. In addition, SPA provides an optional abstract-planning mode that hides installed tool metadata from the planner. Following the abstract-tool paradigm [15], SPA synthesizes required capabilities from the user request and binds them to installed implementations only after planning, failing closed when no compatible mapping exists. In this way, SPA extends plan-first isolation beyond a single query while preserving the security properties of data reused across queries.

Existing AgentDojo tasks reset agent state and therefore cannot measure whether adversarial information survives one query and becomes relevant to another. We develop AgentDojo-MQ, which converts AgentDojo tasks into multi-query episodes with explicit cross-turn artifact dependencies, allowing us to measure both persistent-state reuse and delayed attacks. We evaluate SPA on AgentDojo and AgentDojo-MQ. Under the ‘tool_knowledge’ attack, dual-lattice IFC of SPA reduces attack success to 0.0% on single-query AgentDojo and 0.2% on AgentDojo-MQ. Meanwhile, this protection comes at a utility cost. Enabling IFC lowers concrete-mode baseline utility from 53.0% to 29.0% on AgentDojo and from 62.5% to 35.3% on AgentDojo-MQ. This is primarily because integrity checks reject plans that pass low-integrity tool outputs to higher-integrity actions. Strong integrity enforcement exposes a fundamental security–utility tension: many legitimate agent workflows themselves require actions to depend on externally sourced, low-integrity data. Despite keeping persisted payloads hidden from the planner, SPA retains high cross-query reuse: when a required producer artifact is available, later turns retrieve it in 95.4% of reuse opportunities without IFC and 89.9% with IFC. In contrast, abstract planning is limited mainly by failures in mapping synthesized capabilities to installed tools, rather than by IFC itself.

Overall, our contributions are listed as follows.

• We design a plan-first agent architecture that represents complete executable plans in a declarative domain-specific language and verifies both confidentiality and integrity flows before any tool executes.

• We introduce a label-preserving persistent memory that allows later queries to reuse prior results without exposing stored payloads to the planner, while preserving their security labels across query boundaries.

• We develop AgentDojo-MQ, a multi-query extension of AgentDojo for evaluating cross-query artifact reuse and delayed attacks, and use it together with AgentDojo to quantify the security, utility, and reuse tradeoffs of SPA.

References (20)