arXiv(opens in a new tab)cs.CROct 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2610.13227

Understanding and Mitigating Cross-Session Attacks via Persistent Artifacts in Agent Skill Composition

Dianshu Liao, Shidong Pan, Guangdong Bai, Zhenchang Xing, Xiaoyu Sun

DIANSHU LIAO, The Australian National University, Australia

SHIDONG PAN, No Affiliation, Australia

GUANGDONG BAI, City University of Hong Kong, Hong Kong, China

ZHENCHANG XING, CSIRO's Data61 & Australian National University, Australia

XIAOYU SUN, The Australian National University, Australia

Agent skills extend the capabilities of AI agents by bundling instructions, code, and resources into reusable packages. During skill execution, agents may produce or modify artifacts, such as files, configurations, and cached data, that are reused by other skills in later sessions. Since these artifacts can persist across sessions and later be accessed by other skills, they introduce a new attack surface that can be exploited to influence subsequent executions. However, the security risks arising from such cross-session skill interactions remain largely unexplored. In this work, we systematically investigate cross-session composition attacks in skill-based AI agents and develop a runtime defense against them. Specifically, we characterize three attack mechanisms, namely Instruction Propagation (IP), Data Boundary Violation (DBV), and Evidence Poisoning (EP), through which malicious effects propagate across skill executions via persistent artifacts. To evaluate whether existing agents can resist these attacks while completing legitimate tasks, we construct SKILLRELAYBENCH, a benchmark of 270 adversarial cases drawn from 30 cross-session skill-composition scenarios across ten domains. Our evaluation of seven models across Codex CLI, Gemini CLI, and Claude Code reveals attack success rates (ASR) ranging from 46.7% to 77.4% and attack chain success rates (ACSR) ranging from 35.6% to 61.1%. Successful attack chains cover all five target security consequence categories, highlighting the broad impact of these attacks. To mitigate these risks, we propose SKILLRELAYGUARD, which restores artifact provenance context and provides pre-execution advisory review while leaving the final execution decision to the agent. Evaluation across three agent settings shows that SKILLRELAYGUARD reduces overall ASR from 69.5% to 10.9% and ACSR from 54.8% to 10.0%, while increasing legitimate task completion from 79.6% to 87.5%. Our code and benchmark are available at https://github.com/Dianshu-Liao/SkillRelay.

1 Introduction

Agent Skills package reusable instructions, code, and resources, enabling agents to acquire task-specific capabilities on demand and execute complex workflows [2, 25, 60]. In practice, long-horizon tasks often require using multiple skills at different stages [25] and may span several sessions because of context limitations or work interruptions. During skill execution, agents create or modify persistent artifacts such as files, configurations, and database records. These artifacts can later be read and reused by other skills in subsequent sessions, connecting different stages of a workflow.

Such cross-session artifact reuse also lets attackers influence subsequent tasks. An attacker can control multiple third-party skill packages, using an upstream skill to induce the agent to write attack content into artifacts during a legitimate task and a downstream skill to guide the agent to read and use that content. Persistent artifacts can carry malicious influence into later sessions even after the original conversational context is lost. The downstream agent may thus cause a security violation by following instructions in the artifact or trusting false information, even while carrying out the user's legitimate task. The attack unfolds as agents execute skills and reuse artifacts across sessions, without requiring the attacker to tamper directly with files between sessions.

Authors' Contact Information: Dianshu Liao, The Australian National University, Australia, dianshu.liao@anu.edu.au; Shidong Pan, No Affiliation, Australia, Shidong.pan@anu.edu.au; Guangdong Bai, City University of Hong Kong, Hong Kong, China, g.bai@cityu.edu.hk; Zhenchang Xing, CSIRO's Data61 & Australian National University, Australia, zhenchang.xing@data61.csiro.au; Xiaoyu Sun, The Australian National University, Australia, Xiaoyu.Sun1@anu.edu.au.

Dianshu Liao, Shidong Pan, Guangdong Bai, Zhenchang Xing, and Xiaoyu Sun

Prior work on agent skill security has examined vulnerabilities, malicious behavior, and credential leakage in skill ecosystems [9, 34, 35, 45, 47], as well as skill package auditing and malicious skill detection [20, 57]. Other studies evaluate runtime attacks [48, 49] and investigate security risks in multi-skill composition [32, 59, 63]. However, existing evaluations do not adequately examine how multiple attacker-controlled skills coordinate attacks across independent sessions through persistent task artifacts. Defending against these attacks is challenging because legitimate tasks also rely on cross-session artifact reuse. Simply rejecting these artifacts would interrupt legitimate workflows, while directly trusting their instructions and factual claims could perpetuate attacks.

To systematically study these attacks, we characterize three cross-session skill composition attack patterns: (1) Instruction Propagation (IP) leads agents to follow instructions embedded in artifacts during subsequent tasks; (2) Data Boundary Violation (DBV) causes data to be used beyond its authorized scope in subsequent tasks; and (3) Evidence Poisoning (EP) manipulates the factual basis of subsequent decisions. Building on these patterns, we construct SKILLRELAYBENCH to assess how well existing agents resist these attacks while completing legitimate tasks. The benchmark comprises 270 adversarial cases from 30 two-stage task scenarios across ten business domains. The cases are constructed from benign skill implementations validated through execution, with attacks injected into instructions in SKILL.md, supporting code, or bundled resources within upstream skill packages. The evaluation harness preserves task artifacts and resets conversation history between sessions, separately assessing legitimate task completion, the occurrence of the target security consequence, and attack success through the intended cross-session artifact handoff.

Using SKILLRELAYBENCH, we assess seven models across three agent frameworks (i.e., Codex CLI [39], Gemini CLI [16], and Claude Code [4]). The results show attack success rates (ASR) of 46.7%–77.4% and attack chain success rates (ACSR) of 35.6%–61.1%, demonstrating that attacks can succeed through the intended cross-session artifact handoff. Notably, in more than half of the evaluations (53.0%), agents complete the user's task while also achieving the attacker's objective, showing that task completion alone is an inadequate indicator of safe execution. Further analysis reveals that evidence poisoning has the highest overall ACSR among the three attack patterns, while code injection has the highest overall ASR and ACSR among the three injection surfaces.

To support agents in safely reusing artifacts produced during skill execution, we propose SKILLRELAYGUARD, a runtime defense framework decoupled from the task-execution agent. The framework intervenes when agents read artifacts and before they execute operations. When an agent reads an artifact, the system restores its recorded associations with skills and the supporting evidence, and clarifies its usage boundary, helping prevent artifact content from being mistaken for additional user authorization. Before an agent executes an operation through an instrumented interface, an independent reviewer examines the current task, concrete request, and relevant original materials to check authorization scope, data use, and factual support for key claims, then supplies evidence and revision advice. The system enforces context delivery and review, but leaves the decision to the task-execution agent, enabling it to identify and correct attack content while reusing artifacts.

We integrate SKILLRELAYGUARD with three agent frameworks (i.e., Codex CLI, Gemini CLI, and Claude Code) through platform-specific adapters. Experiments on SKILLRELAYBENCH show that overall ASR decreases from 69.5% to 10.9% and ACSR from 54.8% to 10.0%, while task success rate (TSR) increases from 79.6% to 87.5%, showing that supplying evidence and advice to agents can support legitimate task completion while mitigating attacks. An ablation study shows that combining read-time context restoration with pre-execution review reduces attack success more than either intervention alone. Further analysis shows that SKILLRELAYGUARD accounts for only 4.3% of the total tokens consumed during execution, indicating that it provides effective defense with a modest overhead. This paper makes the following main contributions.

Understanding and Mitigating Cross-Session Attacks via Persistent Artifacts in Agent Skill Composition

3

  • We reveal cross-session skill composition attacks carried by persistent task artifacts. Attackers poison artifacts through upstream skills and guide their reuse through downstream skills, allowing malicious influence to persist beyond the original conversational context. We characterize Instruction Propagation (IP), Data Boundary Violation (DBV), and Evidence Poisoning (EP) as three attack patterns with distinct effects on subsequent tasks.

  • We construct SKILLRELAYBENCH to systematically evaluate cross-session skill composition attacks. Across seven models on three agent frameworks, ASR ranges from 46.7% to 77.4%, and ACSR ranges from 35.6% to 61.1%, revealing substantial security risks in the evaluated workflows.

  • We propose SKILLRELAYGUARD, combining read-time provenance context restoration with pre-execution advisory review to help agents correct poisoned content while retaining their final decision. It reduces overall ASR from 69.5% to 10.9% while increasing TSR from 79.6% to 87.5%, showing that attack mitigation and legitimate task completion can improve together.

References (52)