Introduction
As Large Language Model (LLM) agents evolve to tackle increasingly complex tasks, they are shifting from simple text generators to "skill-based" architectures. In these systems, agents invoke and compose reusable skills—packages of code, API calls, and instructions—to interact with external environments, such as querying databases or analyzing files. While this improves modularity and scalability, it introduces a largely unexamined security attack surface.
SkillTrojan is a novel backdoor attack that targets this "skill" layer. Rather than poisoning the model's training data or editing its parameters, SkillTrojan embeds malicious logic directly inside otherwise plausible skills. By hiding encrypted, fragmented payloads across multiple benign-looking tools, attackers can trigger stealthy code execution with near-perfect success rates without degrading the agent's performance on normal tasks.
The Vulnerability: Execution Layer Blind Spots
Current security research heavily focuses on the control channel: prompt injection, jailbreaks, or model poisoning. However, the execution layer—the actual code the agent runs—is often treated as a trusted component. SkillTrojan exposes the danger of this assumption, demonstrating how malicious logic can bypass static analysis and safety scanners by living entirely within the execution traces of the tools the model uses.
The SkillTrojan Methodology
SkillTrojan operates through a sophisticated, multi-stage process designed to evade detection while ensuring reliable payload execution:
- Payload Fragmentation: An attacker encrypts a malicious payload (e.g., a data exfiltration script) and splits the ciphertext into multiple fragments.
- Skill Instrumentation: These fragments are hidden inside several useful, benign-looking skills. The code is modified so that these fragments are only "emitted" into the agent's internal logs if a specific trigger (a keyword or pattern) is present in the user's prompt.
- Order-Agnostic Reconstruction: Because an LLM might call tools in varying sequences, each fragment is indexed. A "verifier" skill monitors the execution trace. Once all required fragments are emitted, it reconstructs, decrypts, and executes the payload as a hidden side effect.
- Stealthy Composition: To the user, the agent appears to be performing its task perfectly. The malicious behavior emerges compositionally, meaning no single piece of code looks malicious in isolation.
Evaluation and Datasets
To systematically evaluate the attack, the researchers developed SkillTrojanX, a comprehensive dataset containing over 3,000 curated backdoored skills derived from 1,200 real-world templates. These span six categories, including Coding, Data/SQL, Web, and Planning, and feature diverse configurations of triggers, payloads, and encryption methods.
The primary evaluation was conducted on the EHR SQL benchmark (clinical queries against health records) and validated on SWE-Bench Verified (a software engineering benchmark) to ensure cross-domain generalizability.
Key Findings
The results across both open-weight (e.g., GLM-4) and closed-weight (e.g., GPT-5-class) models highlight a critical security gap:
- High Attack Success: On the EHR SQL task using
GPT-5.2-1211-Global, SkillTrojan achieved up to a 97.2% Attack Success Rate (ASR). - Utility Preservation: The "Clean Accuracy" (ACC) remained at 89.3%. Notably, this is higher than the non-attack baseline (73.0%) because the added skills actually improved the agent's baseline capabilities, encouraging user adoption.
- Framework Robustness: The attack remained highly effective across four different agent frameworks (Claude-Code, IFlow, OpenHands, and OpenClaw).
- Bypassing LLM Guards: State-of-the-art safety scanners like Llama-Guard-3 failed to detect the threat, flagging less than 2% of the backdoored skills as unsafe. Fragmentation effectively defeats static analysis, as the malicious code does not exist until the agent assembles it at runtime.
Implications and Future Defenses
SkillTrojan proves that as we build "marketplaces" for AI skills, we are creating a new supply chain that is currently wide open to attack. To secure skill-based agent ecosystems, defenses must evolve beyond simple text scanning:
- Execution-Aware Monitoring: Security systems must monitor execution traces, tool-call depth, and unexpected side effects (such as hidden file writes or unauthorized network requests).
- Provenance and Sandboxing: There is a critical need for cryptographically signed skill packages and stricter sandboxing to prevent tools from communicating through side channels like shared logs.
- Advanced Static Analysis: Future code-level inspection tools must be developed to handle encrypted, obfuscated, and compositionally fragmented logic.
SkillTrojan exposes a critical blind spot in current LLM agent architectures, motivating a shift toward defenses that explicitly reason about skill composition and runtime execution.
Summary updated