arXiv:2610.33489cs.CROct 2026

Manuscript Offprint

arXiv:2610.33489

From Instructions to Exploits: Applying Program Analysis to Malicious Agent Skills Across Natural Language and Code

Shiwu Zhao, Baizhu Wang, Guoqiang Zheng, Tingyu Gao, Yuheng Xie, Rujie Chen, Xingchen Chen, Xuezhang Liu, Qixu Liu

Shiwu Zhao1,∗^{1,*}, Baizhu Wang2,∗^{2,*}, Guoqiang Zheng1^{1}, Tingyu Gao2^{2}, Yuheng Xie1^{1}, Rujie Chen2^{2}, Xingchen Chen1,†^{1,\dagger}, Xuezhang Liu2^{2}, Qixu Liu1^{1}

1^{1}Institute of Information Engineering, CAS, Beijing, China

2^{2}MYbank, Ant Group, Hangzhou, China

{zhaoshiwu, zhengguoqiang, xieyuheng, chenxingchen, liuqixu}@iie.ac.cn

{wangbaizhu.wbz, gaotingyu.gty, chenrujie.crj, liuxuezhang.lxz}@mybank.cn

*These authors contributed equally to this work.

†Corresponding author

Abstract—LLM-powered agents increasingly rely on third-party skills to gain tool-use capabilities, turning agent skill marketplaces into a new supply-chain attack surface. Unlike traditional software packages, these skills are hybrid artifacts where natural-language instructions guide execution logic while bundled code performs specific tasks, and malicious behavior can emerge from interactions between these two artifact types. Existing skill-security detection methods either rely heavily on rule matching or depend excessively on LLM-based judgments. Meanwhile, they provide limited support for capturing malicious behavior that spans natural-language instructions and executable code.

To address these challenges, we present the Supply-Chain Scanner for Agent Skills (SCS), a static analysis framework that brings natural-language instructions and bundled code into a unified program-analysis pipeline. SCS compiles natural-language instructions into a Python-style intermediate representation (IR), based on a limited set of APIs that we have defined. This intermediate representation, together with the bundled code, forms a unified cross-domain Program Dependence Graph (xPDG). On top of xPDG, we introduce TSC (Trust-Sensitivity-Capability), a three-dimensional security property model that propagates data provenance, sensitivity, and capability information over variables. We define deterministic TSC propagation and rule-based downstream analysis over the unified xPDG, enabling structured cross-domain analysis while reducing reliance on direct LLM-based security judgments.

For evaluation, we construct a manually verified benchmark containing 117 malicious and 117 benign skills. Across five LLMs, SCS achieves the highest average accuracy (85.6%), recall (95.2%), and F1-score (86.9%) among the evaluated methods, with a precision of 80.2% and average token consumption of 13.7M. Its NL-to-IR compiler consistently compiles over 92% of human-annotated instruction steps across different LLMs. Finally, we collect 66,157 real-world ClawHub skills and, using SCS together with auxiliary dynamic validation and manual auditing, confirm 627 malicious skills.

I. INTRODUCTION

With the rapid development of the large language model (LLM) agent ecosystem, extensibility mechanisms such as skills [1], MCP servers [2], and plugins [3] have become a common way to package reusable capabilities, connect external systems, and support interoperability across agent platforms. This ecosystem has already reached substantial scale. Skills are now supported across widely used agent clients such as Claude Code [4], Codex [5], Gemini [6], and Cursor [7]. Meanwhile, third-party skill marketplaces are growing rapidly: OpenClaw's ClawHub contains at least 67,453 latest public skill versions in its released registry snapshot [8], while skills.sh lists over 963K skills [9] and SkillsMP reports more than 2.27 million collected SKILL.md files [10]. Although these counts differ substantially, likely because the platforms adopt different collection and aggregation strategies, they consistently suggest strong demand for and broad adoption of agent skills in practice.

However, this rapidly growing ecosystem also exposes a new supply-chain attack surface, and recent studies have shown that third-party skills can already be abused through skill-file injection [11], stealthy skill-level prompt poisoning [12], implicit payloads hidden in documentation examples [13], and dynamically validated exploits [14], [15]. Snyk reported that, among 3,984 skills collected from ClawHub and skills.sh, 1,467 contained at least one security issue, 534 contained at least one critical issue, and 76 were confirmed to carry malicious payloads [16]. Koi Security likewise reported 341 malicious skills in an audit of 2,857 ClawHub entries, and subsequent reporting suggested that this number later rose to more than 824 as the registry expanded beyond 10,700 skills [17]. Taken together, these findings suggest that the skill ecosystem is already facing a serious supply-chain security problem, motivating the need for accurate threat modeling together with effective detection and mitigation mechanisms.

Unlike traditional software packages, a skill is composed of hybrid artifacts including natural-language instructions, manifests, and bundled scripts, so malicious behavior may arise not from any single component in isolation, but from the interaction between code-level logic and natural-language instructions. Existing skill-auditing approaches use predefined rule matching [18], neuro-symbolic reasoning [19], semantic consistency checking [20], or filtering with LLM inspection [21]. However, even when multiple skill artifacts are considered, natural-language content is typically treated as semantic evidence to be extracted or judged rather than compiled into a constrained program representation with explicit operations and data dependencies. This limits direct integration with code-level program analysis and explicit downstream state propagation.

Challenges. Given the hybrid structure of agent skills and the limitations of existing defenses, we identify three core challenges.

• C1: Security-relevant behavior is implicit in natural-language instructions. Although prior NLP studies have translated procedural text into commands, workflows, or structured representations, existing skill-security approaches typically rely on keyword-level patterns or direct semantic inspection, without exposing explicit operations and data dependencies for downstream program analysis.

• C2: Cross-domain behavior chains are difficult to reconstruct precisely. Malicious behavior in agent skills may span both natural-language instructions and bundled code, where the instructions initiate or control an operation while the code implements its security consequence. Existing approaches provide limited support for systematically tracing fine-grained dependencies across the two domains and reconstructing them into a complete attack chain.

• C3: Security analysis remains overly dependent on LLM-based judgments. Existing methods often rely on LLMs not only to interpret skill content but also to directly determine whether the resulting behavior is malicious. Consequently, uncertainty in LLM-based semantic interpretation can propagate directly into the final security decision, making the analysis sensitive to the selected model.

Our Approach. The core insight of our work is that the security-relevant behavior of an agent skill is jointly determined by natural-language instructions and bundled code, rather than by either component in isolation. Building on this insight, we design the Supply-Chain Scanner for Agent Skills (SCS), a static analysis framework for auditing the supply-chain security of LLM agent skills. SCS combines: ① a limited-API-based compilation pipeline that normalizes natural-language skill instructions into an analyzable intermediate representation with explicit operations, variables, and dependencies; ② a unified cross-domain dependency representation, xPDG, which connects the instruction-domain Text-PDG and the code-domain Code-PDG under a shared graph structure; and ③ the TSC analysis framework, which propagates Trust, Sensitivity, and Capability at the variable level and applies deterministic security rules to identify security-relevant behavior chains. Together, these components enable structured cross-domain analysis with deterministic downstream propagation and security-rule evaluation.

Contributions. The contributions are outlined as follows:

• A program-analysis foundation for agent skill supply-chain security. We introduce SCS, a static analysis framework for pre-install auditing of third-party agent skills. SCS compiles natural-language instructions into a limited-API-based intermediate representation, constructs Text-PDG and Code-PDG for the natural-language and code domains, and connects them into xPDG for unified cross-domain reasoning.

• Deterministic security analysis with TSC. We propose TSC, a security property model over Trust, Sensitivity, and Capability. Based on xPDG, SCS propagates all three properties at the variable level and applies deterministic security rules to identify injection-style, confidentiality-style, and other security-relevant behavior chains in a reproducible manner.

• Evaluation and real-world auditing. Across five selected LLMs, SCS achieves the highest average accuracy, recall, and F1-score among the evaluated methods (85.6%, 95.2%, and 86.9%, respectively), while maintaining moderate LLM token consumption (13.7M on average), providing a favorable balance between detection effectiveness and LLM token cost. On a human-annotated gold set, the NL-to-IR compiler correctly translates over 92% of instruction steps across different LLMs. At ecosystem scale, we confirm 627 malicious skills from a self-collected snapshot of 66,157 ClawHub skills by combining SCS-identified candidate skills with auxiliary dynamic validation and manual auditing.

References (64)