arXiv:2609.05911cs.CRSep 2026

Manuscript Offprint

arXiv:2609.05911

Structurally Close, Temporally Distant: Measuring Security Exposure in Long-Horizon LLM Agents

Md Jafrin Hossain, Nur Al Hasan Haldar

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

Abstract

Long-horizon LLM agents interact with untrusted content, persistent memory, external state, and sensitive tools. Existing analyses commonly characterize an attack by the number of execution steps separating malicious input from a downstream action. We show that temporal remoteness can substantially overstate security separation in stateful agents. We introduce a provenance-aware execution graph that connects agent events through deterministic state, identifier, and tool provenance, and define influence distance DID_I as the shortest structural path between an untrusted source and a sensitive action. We compare it against sequence distance DTD_T, the shortest injection–sink path in the ordered trajectory. Because the influence graph contains every edge of the sequence graph, DI≤DTD_I \leq D_T; the gap G=DT−DIG = D_T - D_I quantifies how much the step-count view overstates separation. Across 454 injection–sink pairs from 360 long-horizon AgentDojo trajectories on OpenAI's gpt-4o-mini and gpt-4o and Claude's Haiku 4.5 and Sonnet 4.6, G>0G > 0 for 96.9% of pairs, with a median gap of 9 hops; 91.0% remain decoupled after removing the largest provenance-only edge class. In a cross-domain evaluation on AgentDojo's banking suite, 33.8% of 231 pairs from 377 trajectories decouple through different provenance mechanisms. Among the 274 pairs from gpt-4o-mini and gpt-4o, GG does not independently predict attack success after controlling for DTD_T, attack family, and backend (βG=0.066,p=.088\beta_G = 0.066, p = .088). At matched thresholds k=2k = 2 and k=3k = 3, a deterministic DID_I-based pre-execution gate blocks five attack sinks missed by the sequence-only gate, with no additional benign blocking under either graph variant, though this paired gain is not significant at the 5% level (p=.0625p = .0625). Execution structure can therefore reveal proximity that step count hides, supporting more targeted runtime intervention. Hence, in this study, we measure candidate influence pathways rather than causal attribution.

1 Introduction

Large language model-based agents now operate across multiple stages, interleaving reasoning, tool calls, and interaction with external environments [Yao et al., 2023, Schick et al., 2023, Zhou et al., 2024]. They consume documents, use tools, write to memory stores, recall what they wrote from memory stores, and eventually carry out meaningful actions, including sending emails, logging reports, and making payments. Much of their input data is taken from outside the trust boundary, and indirect prompt injection attacks exploit precisely this [Greshake et al., 2023, Debenedetti et al., 2024]. For a 40-stage interaction history, the adversarial input at the front seems distant from the sensitive action at the back, and the notion that distance confers any security advantage implicitly surfaces whenever a long-horizon attack is framed in terms of the number of stages before execution.

This is because such intuition actually answers another question. Temporal distance does not equate to structural distance, as an instruction read twenty steps back could be written to a note at step 6 and accessed at step 24, just before the sensitive call was made. From the viewpoint of the sequence,

*Corresponding author: mdjafrin.hossain@uwa.edu.au

Preprint. Under review.

Figure

Figure 1: Method overview: constructing and comparing sequence and influence graphs.

there would be much distance between these two points, but structurally, there would be no distance at all. The number of intervening steps gives us a measure of how long ago something took place.

To quantify this formally, we consider two metrics on the same execution path. Sequence distance DTD_T is the length of the shortest path from injection to sink in a graph whose edges represent consecutive executions. Influence distance DID_I is the shortest path length in the graph with additional deterministic provenance and state edges added from the log: tool output that another call refers to by identifier; state update and its subsequent return; and a batch of tool invocations sent in one assistant call. The structural gap between the two is G=DT−DIG = D_T - D_I. Both are calculated from execution paths without a language model to determine relevance, without an embedding similarity threshold, and without causal inference on any path.

Figure 1 summarizes the complete pipeline, showing the sequential execution graph and the influence graph side by side.

Contributions. (C1) Conceptual. We distinguish temporal remoteness, structural exposure, and exploitability as separate properties of long-horizon agent security, and show that step count is a reliable proxy for neither of the other two. (C2) Method. We introduce provenance-aware execution graphs and a deterministic influence distance DID_I that, paired with sequence distance DTD_T, yields a gap G=DT−DIG = D_T - D_I computed from logs alone with no model in the loop. (C3) Empirical. Across multiple agent environments and model families, we characterize when temporal and structural distance diverge and identify the provenance mechanisms responsible: decoupling holds for 96.9% of long-horizon pairs, persists at 91.0% after ablating the top contributor, yet drops to 33.8% in banking where typed identifiers replace the memory pattern. (C4) Intervention. Influence distance supports a deterministic pre-execution gate that picks up additional attack coverage over a sequence-only gate, and we characterize where that coverage starts costing benign actions.

References (28)