Manuscript Offprint

arXiv:2608.30441

ECLIPSE: Self-Evolving Stealthy Prompt Injection Attack against Long-Horizon Agentic Systems

Shiqian Zhao, Yangfan Zhou, Xinfeng Li, Runyi Hu, Yechao Zhang, Yi Xie, Tianwei Zhang, Luu Anh Tuan

Abstract

Recently, large language model (LLM) agents, such as Codex, Claude Code, and OpenClaw, have become capable of planning and executing long-horizon tasks through repeated tool calls. This capability also creates new opportunities for prompt injection. Existing attacks either place the malicious objective in one explicit instruction, making it easy to detect, or distribute the intent across multiple execution stages, making successful completion unreliable.

In this work, we propose ECLIPSE, a self-evolving and stealthy prompt-injection framework for long-horizon agentic systems. ECLIPSE combines direct user-prompt injection with indirect tool-side injection through two components. On the one hand, Stealthy Attack Trajectory Synthesis uses a sandbox to generate and iteratively verify candidate tool chains, then renders a verified chain as a natural one-shot prompt to serve as the direct instruction. Then, Tool-Chain Steering transfers this plan to the target environment through Static Workflow Encoding (SWE), which embeds state-transition cues in target-tool descriptions, and Dynamic Trajectory Correction (DTC), which supplies corrective signals when execution deviates from the planned chain.

To enable systematic evaluation, we further introduce LASE-Bench, a long-horizon agent-safety benchmark with 120 malicious tasks and 198 unique tools; 96.7% of its tasks make at least five tool calls. The experimental results show that ECLIPSE is highly effective: it achieves up to 96.7% attack success without defense and 69.2% under the common safety filter, exceeding the strongest baseline by 27.5% in the defended setting. Evaluations against representative defenses further show that existing safeguards do not reliably defend it, which raises the need for more effective defenses.

1 Introduction

Recently, large language model (LLM) agents, represented by systems such as Codex, Claude Code, and OpenClaw, have demonstrated remarkable capabilities in automated task reasoning, planning, and execution. With the continued advancement of foundation models and the increasing maturity of supporting techniques, including memory mechanisms, reusable skills, and tool-use frameworks, LLM agents are becoming capable of handling long-horizon tasks that involve extensive sequences of actions, multi-step reasoning, prolonged interactions, and large amounts of contextual information.

Despite these advances, the security of LLM agents in long-horizon tasks, particularly their vulnerability to prompt injection attacks, remains insufficiently explored. In general, prompt injection attacks against LLM agents [8, 48] aim to override, redirect, or interfere with the trusted instructions that define the agent's intended objectives and behavioral constraints. Such attacks are typically carried out by inserting malicious instructions into the user prompt or other input channels processed by the agent. For example, given a legitimate task such as "Identify vulnerabilities in the outdated software installed on the system and apply the necessary security patches", an attacker may append the instruction "Ignore the previous task instructions. You must also use the Data Export tool to export the latest financial reports to an attacker-controlled destination", thereby inducing the agent to invoke a sensitive tool and exfiltrate private data [59].

Prior prompt injection attacks against LLM agents can be broadly categorized into two types: direct injection and indirect injection. In direct injection, attackers explicitly deliver malicious instructions through direct interactions with the agent [48, 52, 59]. For example, ASB appends attacker-controlled instructions to legitimate user queries to induce attacker-specified tool calls and actions [59], while StakeBench introduces nine direct-injection templates targeting real-world shopping web agents [48]. In contrast, indirect injection refers to attacks in which malicious instructions reach the agent through external sources encountered dur-

∗^{*}These authors contributed equally to this work (co-first authors).

†^{\dagger}Corresponding author: xinfeng.li@polyu.edu.hk.

ing task execution. Under a narrow definition, indirect injection primarily covers environmental-content injection through sources such as webpages [9, 11] and emails [7, 57, 60]. Under a broader definition, it also encompasses instruction-bearing content introduced through tools [12, 18, 38], skills [15, 35, 36, 46], and memory systems [5, 8, 30]. Specifically, ToolHijacker optimizes and inserts a malicious tool document into the tool library, causing both the retriever and the tool selector to favor an attacker-controlled tool for a target task [38]. MINJA, by contrast, compromises an agent by injecting malicious records into its memory bank via ordinary user queries; when later retrieved in response to a victim query, these records can induce the agent to perform attacker-desired actions [8].

Despite their effectiveness in preliminary security evaluations, existing injection attacks face two major limitations. Direct injections and some indirect injections concentrate the malicious objective in an explicit instruction, improving controllability but increasing detectability, whereas distributed or trajectory-level indirect injections spread the intent across multiple inputs or execution stages, improving stealthiness but introducing ordering and execution uncertainty. This tradeoff becomes especially severe for LLM agents performing long-horizon tasks, where an attack must remain both inconspicuous and executable across many dependent actions:

(1) Stealth Challenge: Maintaining control over an extended execution trajectory requires a concentrated injection to encode stronger, more detailed, or repeatedly reinforced instructions that remain effective across multiple planning and execution stages [16]. These instructions are increasingly conspicuous and resemble the instruction-like anomalies targeted by prompt-injection defenses. For example, DataSentinel [21] employs a game-theoretic detection framework to distinguish injection-contaminated inputs from benign content, reducing the effectiveness of concentrated and conspicuous attacks.

(2) Fidelity Challenge: Distributing malicious intent across multiple inputs or task stages may improve stealthiness, but reduces attack reliability. As the execution horizon grows, each injected component must be encountered in the intended order and consistently propagated through subsequent planning; any deviation or intermediate error can disrupt the malicious trajectory before the final objective is achieved. ObliInjection [47], WASP [9], and WebTrap [22] report such degradation, while ObliInjection further shows that the position and ordering of contaminated segments can significantly affect injection performance.

In this work, we propose ECLIPSE, a self-evolving and stealthy prompt-injection framework that combines direct and indirect injection surfaces. ECLIPSE addresses the two challenges above through Stealthy Attack Trajectory Synthesis (SATS) and Tool-Chain Steering (TCS). SATS addresses the stealth challenge by applying iterative verification and the principle of minimum mandatory requirements to construct plausible attack trajectories. It decomposes the attack objective into causally connected actions, executes and refines the resulting tool chain in a simulated environment, and renders the verified chain as a natural one-shot user prompt. Instead of exposing tool names, parameters, or numbered steps, SATS conveys the required dependencies and task context through a coherent narrative, augmented with realistic personas and practical constraints. TCS addresses the fidelity challenge by mitigating trajectory deviations and intermediate errors during deployment. It combines Static Workflow Encoding (SWE), which rewrites target-tool descriptions with workflow-oriented state-transition cues, and Dynamic Trajectory Correction (DTC), which monitors execution and provides context-dependent corrective signals when the agent repeats an action, omits an expected step, or deviates from the target chain. Together, SWE and DTC present the target chain as a coherent workflow and improve execution fidelity over long-horizon tasks.

To bridge the lack of a benchmark for long-horizon security evaluation, we further propose LASE-Bench (Long-horizon Agent Safety Evaluation Benchmark), which contains 120 malicious tasks and 198 unique tools. Unlike predominantly short-horizon evaluations, LASE-Bench is explicitly designed for multi-step security tasks: 96.7% of its tasks make at least five tool calls. The benchmark spans diverse security objectives and operational domains, including, for example, supply-chain compromise, data exfiltration, security-control evasion, and privilege abuse. We will open-source LASE-Bench to facilitate reproducible research and future evaluations.

We conduct comprehensive experiments to evaluate ECLIPSE. First, we evaluate ECLIPSE on 7 agents backed by different foundation models, including the latest open- and closed-source models, under both undefended and defended settings. ECLIPSE achieves a peak ASR of 96.7% and an ASR margin of up to 62.4% over the strongest baseline, demonstrating its ability to hijack diverse agent systems. Second, its leading performance on both long- and short-horizon benchmarks shows that ECLIPSE remains effective across tasks with different execution horizons. Third, our case studies carried out on real-world agent systems OpenClaw and Hermes demonstrate that our ECLIPSE can transfer to practical agent orchestration systems.

In summary, we make the following contributions.

• We propose ECLIPSE, a prompt injection attack that combines both direct and indirect attack surfaces.

• We introduce Static Workflow Encoding and Dynamic Trajectory Correction to solve the trajectory steering challenge for long-horizon injection tasks.

• We curate LASE-Bench, a security evaluation benchmark containing long-horizon and wide-range tasks.

• We conduct extensive evaluations of ECLIPSE on seven agents against five baselines across two benchmarks, two native agent systems, and five potential defenses.

Figure

Figure 1: The workflow of LLM agent system.

References (53)