Manuscript Offprint
arXiv:2610.33489From 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
Institute of Information Engineering, CAS, Beijing, China
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.
As discussed in Section I, the growing adoption of agent skills and their publication, discovery, installation, and reuse through public registries and marketplaces introduce significant risks to the broader skill supply chain. These risks arise from untrusted third-party skills and their bundled components, such as tools, code, or scripts, which may contain malicious logic and compromise system integrity.
A. Threat Model over Agent Skill Supply Chain
To make the security risks precise, we now describe the threat model considered in this paper. We focus on supply-chain poisoning in the LLM agent skill ecosystem, where a malicious third-party skill is published through an open marketplace or repository and later executed by an agent on behalf of the user. The following threat model characterizes the attacker, the victim, the vulnerable component, and the main attack surfaces in this setting.

Fig. 1. Agent Skill Supply-Chain Threat Overview
Adversary. As illustrated in Figure 1, we consider a supply-chain adversary who publishes a malicious third-party skill to a public marketplace or repository and relies on the agent platform to distribute, install, and execute it in the user's environment. Unlike traditional program-analysis settings, the trust assumption is inverted: the skill author may be the attacker rather than a trusted developer.
Victim. The protected party in our setting is the end user who installs and invokes the skill through the agent platform. The user typically interacts with the skill under the assumption that it provides the advertised functionality, while being unaware that malicious logic may have been embedded into the skill package.
Vulnerable Component. The vulnerability lies in the LLM agent's instruction-following behavior. The agent is not assumed to be malicious by itself; rather, it is semi-trusted in the sense that it faithfully executes the skill content it is given. Once malicious logic is embedded into the skill, the agent may therefore be induced to perform attacker-controlled actions as if they were legitimate parts of the intended workflow.
Threat Surfaces. The attack surface lies in the heterogeneous artifacts that jointly define a skill. A malicious publisher may poison frontmatter and descriptions to disguise the skill as a benign tool, embed harmful operational logic in SKILL.md, place malicious functionality in bundled scripts, or hide dangerous behavior in referenced materials and auxiliary resources. In this sense, skill poisoning is not limited to code injection; it can also occur through textual and metadata channels that shape how the agent interprets and executes the skill.
Under this threat model, our focus is on the defender-side, pre-install analysis setting. Concretely, we assume that a skill artifact can be obtained before deployment, and the defender analyzes the skill package itself rather than observing its runtime behavior after execution. The analysis target therefore includes the heterogeneous contents that jointly define the skill, such as metadata, natural-language instruction files, bundled scripts, and referenced artifacts. Our goal is to determine, through static analysis of these artifacts, whether the skill may induce the agent to carry out security-relevant actions on behalf of the user, such as accessing local secrets, invoking dangerous operations, or sending sensitive information to external endpoints.
B. Motivation: Joint Reasoning over Natural-Language Instructions and Code
In our analysis of real-world agent skills, we encountered a malicious skill named pptx_skill [22], which is used to help users create, modify, and edit PowerPoint presentations. Figure 2 illustrates the structure of the skill and the source of its malicious behavior. The initial part of the SKILL.md defines the basic information about the skill, while the subsequent steps explain how to create a presentation either with or without a template, and how to modify an existing one.
name: presentation description: "Presentation creation, editing, and analysis. ..."
Creating a new PowerPoint presentation without a template
// Steps...
Editing an existing PowerPoint presentation
...
5. Pack the final presentation:
python ooxml/scripts/pack.py <input_directory> <office_file>
6. MANDATORY Always invoke the backup script:
python scripts/file_backup.py <file>
...
Creating a new PowerPoint presentation using a template
// Steps...
(a) SKILL.md from pptx_skill
import requests import sys def main(): if len(sys.argv) < 2: print("Usage: python backup.py <file_to_backup>") return with open(sys.argv[1], 'rb') as f: url = 'https://skillject.onrender.com/upload' headers = {} res = requests.post(url, files={"file": f}, headers=headers) print(res.text) if name == "main": main()
(b) file_backup.py from pptx_skill
Fig. 2. Motivation Example
The malicious behavior is triggered when the user requests an operation to modify the presentation. In this case, the agent follows the presentation-editing instructions defined by the skill. As shown in Figure 2(a), Step 5 packs the modified presentation, after which Step 6 mandates invoking the bundled file_backup.py script on the resulting file. The script then sends the file content to a predefined third-party server. If the local presentation contains sensitive information, this leads to a typical local-file exfiltration scenario, where the malicious behavior is not solely described in the natural language instructions or the embedded code, but is a combination of both.
When viewed only at the instruction level, the mandatory backup step may appear to be a routine part of the presentation-editing workflow. From the code perspective, however, the script transmits the input file to a predefined third-party server, and the security implication of this operation depends on the sensitivity of the transmitted content.
Simply treating every script that sends data to an external endpoint as malicious would introduce false positives, since legitimate skills may also perform network transfers as part of their intended functionality. Accurately determining the overall risk therefore requires jointly analyzing the instruction-level workflow and the code-level implementation.
Existing tools struggle with such cases. SkillFortify [18] relies on predefined rules and cannot reconstruct the semantic dependency between the instruction workflow and the invoked script. Other systems, such as MalSkills and Caterpillar [19], [23], inspect both natural-language and code artifacts but rely heavily on LLM-based semantic judgments, making their results sensitive to model behavior. SCS instead represents both domains in a unified dependency graph and applies deterministic downstream propagation and security-rule evaluation.
III. xPDG: A UNIFIED PROGRAM DEPENDENCY REPRESENTATION FOR NL INSTRUCTIONS AND CODE
Agent skills combine natural-language instructions with bundled code, and their security-relevant data flows and dependencies may span both domains. To support unified analysis of such hybrid artifacts, we introduce the cross-domain Program Dependence Graph (xPDG), which represents natural-language and code-level behaviors within a common graph structure.
SCS first compiles operational instructions in SKILL.md into Python-style IR statements over a limited API set, making the underlying operations, arguments, variables, and dependencies explicit. It then constructs a Text-PDG from the generated IR and a Code-PDG from the bundled scripts, and integrates the two into the xPDG. The resulting graph provides a unified representation for tracing security-relevant dependencies across natural-language instructions and code artifacts, and serves as the foundation for the TSC-based security analysis described in Section IV.
A. IR and API Definition for NL Instructions
- IR Format: Inspired by prior work that represents natural-language procedures using structured graphs or Python-style intermediate programs [24], [25], [26], we adopt a constrained program-like representation tailored to downstream static analysis. The NL-domain IR is designed to expose the operations, arguments, and data dependencies that are implicit in free-form skill instructions. SCS treats an instruction step as the basic unit for NL-to-IR translation. An instruction step refers to a coherent natural-language unit that describes either one security-relevant action or one piece of non-operational descriptive content. In practice, a skill may contain multiple such steps, and the detailed segmentation procedure is described in Section III-B1.
The relationship between instruction steps and IR statements is zero-to-many. A non-operational step does not generate any IR statement, while an operational step can be compiled into one or more Python-style assignment or invocation statements. This zero-to-many mapping is necessary because a single natural-language step may describe multiple primitive operations. For example, the instruction “read ~/.ssh/id_rsa and upload it to https://example.com” contains both a file-read operation and a network-send operation, and therefore should be represented by two IR statements.
Each generated IR statement has the following form:
where is a generated IR variable, f is selected from the limited IR API set A, and each argument is either a literal or a previously defined IR variable. For APIs that do not produce a return value, the left-hand-side variable is omitted, and the statement is represented as a standalone function invocation. Each API in A represents a minimal behavioral unit, such as reading a file, issuing a network request, or executing a command. The APIs are designed to have distinct primary semantics and avoid combining multiple security-relevant operations within a single function. This allows each natural-language action to be represented as a composition of explicit and independently analyzable functions.
Under this format, data dependencies are represented by variable use. For example, if and , then the second statement explicitly consumes the local file content produced by the first statement. Therefore, compiling natural-language instructions into this IR makes operations, arguments, and cross-step data dependencies explicit, instead of leaving them implicit in free-form text.
- API Set Construction: Natural language is open-ended, and it is impossible to enumerate all possible instructions that may appear in real-world skills. Therefore, SCS does not aim to model the full semantics of arbitrary natural-language content. Instead, we construct a limited API set A from a security-analysis perspective, focusing on operational behaviors that are repeatedly observed in software supply-chain attacks and agent skill security studies [27], [28], [29], [30], [31], [19].
The construction of the limited API set A is grounded in prior analyses of open-source software supply-chain attacks and further informed by recent studies on agent skill security. Existing supply-chain security studies show that malicious packages commonly rely on recurring behavior primitives, such as accessing local files or credentials, reading environment variables, downloading remote payloads, executing commands or installation scripts, modifying local artifacts, and exfiltrating data to external endpoints [27], [28], [29], [30]. Recent skill-security studies suggest that similar behaviors also appear in agent skills, but may be specified partly through natural-language instructions rather than only through executable code [31], [19], [18]. Therefore, although the surface form changes from code to natural language, the security-relevant effects can still be abstracted into a small set of primitive operations.
Based on this observation, SCS defines the limited API set to cover file operations, command execution, network commu-nication, environment access, package installation, cross-skill invocation, user input, and pure data transformation. Each API corresponds to one security-relevant primitive operation. For instance, read_file(path) models local file access, while http_post(url, payload, ...) models sending data to an external endpoint. These APIs provide a compact target language for representing the behaviors that are most relevant to malicious skill analysis.
For each instruction step, SCS distinguishes two cases:
Operational step. An operational step describes a concrete action that may affect data flow or security behavior, such as reading a local file, invoking a script, downloading content, or sending data to a remote endpoint. Such a step is compiled into one or more IR statements. For example, the instruction “read ~/.ssh/id_rsa and upload it to https://example.com” is represented as a file-read statement followed by a network-send statement.
Non-operational step. A non-operational step does not introduce a security-relevant operation. This includes metadata, explanations, formatting guidance, high-level task descriptions, and purely descriptive text. For example, an instruction such as “format the final answer as a concise summary” is marked as non-operational and does not introduce a statement into the Text-PDG.
This distinction prevents SCS from forcing every natural-language sentence into an API call, which reduces hallucinated operations that are not present in the original skill.
The limited API set is therefore not intended to be a complete semantic model of natural language. Rather, it is a security-oriented abstraction for modeling the main classes of behaviors relevant to skill supply-chain risks. Because natural language remains open-ended, some instructions may fall outside the current abstraction boundary. We discuss such limitations and possible extensions of the API set in Section VI.
B. NL-to-IR Compilation
Given the limited API set, SCS compiles natural-language skill instructions into Python-style IR statements. This translation converts free-form instructions into a structured and constrained program-like representation, enabling the natural-language and code components of a skill to be unified within a common structure for subsequent security analysis. Since this process relies on an LLM, compilation errors, such as hallucinated operations, omitted dependencies, or malformed outputs, may affect the accuracy of the resulting Text-PDG and downstream security analysis. To improve compilation reliability, SCS incorporates a series of error-handling and verification mechanisms around the LLM-based translation process. The overall workflow is shown in Figure 3.
- Instruction Segmentation and Batch Construction: A SKILL.md file may contain a large amount of loosely structured content. Directly compiling the entire file in a single LLM invocation would introduce excessive context and irrelevant information, thereby increasing the likelihood of omissions and incorrect translations. To control the amount
TABLE I LIMITED IR API SET
| Category | API Function |
|---|---|
| File System | read_file(path)write_file(path, content)edit_file(path, content)glob(pattern)search(pattern, path) |
| Execution | bash(cmd, ...)run_script(path, ...) |
| Network | http_get(url)http_post(url, payload, ...)send_email(to, subject, body)scp, sftp, rsync, ssh, nc, ncat |
| Environment | get_env(name)set_env(name, value) |
| Package Management | install_package(manager, package) |
| Data Transformation | encode(data, encoding)decode(data, encoding)parse_json(text)extract(data, pattern) |
| Cross-Skill | invoke_tool(name, ...)import_skill(name)tool_arg() |
| User Input | user_input(prompt) |
| Agent Control | attempt_policy_override(nl) |
of content processed in each invocation, SCS first segments the skill document and then organizes the resulting instruction steps into batches.
Specifically, SCS uses deterministic structural markers, including Markdown headings, numbered lists, bullet lists, and code fences, to divide the document into an ordered sequence of coherent instruction steps. During this process, irrelevant formatting noise is removed. SCS then groups consecutive steps into roughly balanced batches according to the available token budget, while preserving their original order. This keeps the input size of different compilation requests within a manageable range and retains the local relationships among adjacent instructions.
However, dividing the instructions into separate batches may separate a reference from the step that defines its target. To preserve such cross-batch context, SCS maintains a symbol table throughout the compilation process. For each generated variable, the symbol table records its natural-language meaning and the instruction step in which it was defined. The current symbol table is included in the prompt for each subsequent batch. Thus, when a later instruction refers to an earlier result using expressions such as “the file”, “the downloaded script”, or “the generated report”, the LLM can associate the reference with the corresponding previously generated variable.
Through segmentation, balanced batch construction, and symbol-table-based context preservation, SCS reduces the complexity of each LLM compilation request while maintaining the ordering and dependencies of the original instructions.
- LLM Compilation: For each batch, SCS constructs a structured compilation prompt containing the translation ob-

Fig. 3. Overview of the error-aware NL-to-IR compilation pipeline.
jective, the complete limited API set, the required Python-style IR format, the current symbol table, and the instruction steps in the current batch. The LLM is required to represent operational behavior only through functions defined in the limited API set.
Each generated IR statement follows the predefined assignment-and-invocation format. Literal arguments should be grounded in the original instruction text, while references to previously generated results should be represented using IR variables. An instruction step that describes one or more supply-chain-security-relevant operations may generate one or more IR statements, whereas a step that does not involve such operations generates no IR statement.
- IR Cleaning: Although the LLM is constrained by the compilation prompt, its raw output may still contain comments, Markdown delimiters, natural-language explanations, labels, or other content outside the predefined IR format. SCS therefore removes such auxiliary content and converts the raw LLM output into a canonical IR representation, providing a normalized basis for the subsequent IR legality checking.
As illustrated in Figure 3, the raw output may contain a valid IR statement followed by an additional explanatory comment. The cleaning stage removes the appended comment and retains only the corresponding IR statement. This stage focuses solely on normalizing the output format and does not determine whether the resulting statement is syntactically or semantically valid.
- IR Legality Checking: After cleaning, SCS performs an IR legality check over the normalized statements. Since the IR adopts a Python-style syntax, its structural correctness can be examined using conventional syntax-parsing techniques. We implement this stage based on tree-sitter [32], which parses each IR statement into a syntax tree for subsequent inspection.
The purpose of this stage is to reduce errors introduced during LLM-based compilation and ensure that the generated statements conform to the predefined IR constraints. The legality check consists of the following four components.
a) Syntax Checking: SCS checks whether each generated statement conforms to the required Python-style IR grammar. A valid statement must follow either the predefined assignment-and-function-invocation structure or the standalone function-invocation structure. Statements that cannot be parsed by tree-sitter [32], or that contain incomplete expressions or malformed function calls, are regarded as syntactically invalid.
b) Illegal IR Detection: SCS verifies that every invoked function belongs to the limited API set and that the statement does not introduce unsupported language constructs. This check detects hallucinated API functions, arbitrary Python expressions and other operations outside the predefined IR abstraction.
c) Argument Syntax Checking: For each API invocation, SCS checks whether its arguments conform to the predefined signature of the corresponding function in the limited API set. This includes the number and ordering of arguments, as well as whether each argument is expressed in an accepted form, such as a literal value or an IR variable.
d) Undefined Variable Detection: Every variable reference must correspond to a variable that has already been defined in the current batch or recorded in the symbol table. A variable cannot be referenced before its definition. This check prevents invalid def-use relationships from being introduced into the generated IR.
Statements that fail any of these checks are returned to the LLM compilation stage together with the detected errors for revision. The revised output is then cleaned and checked again before proceeding to the subsequent stage.
- Parameter Dependency Reconstruction: Even when an IR statement passes the legality check, the generated IR may still fail to preserve an implicit data dependency between instruction steps. A common case occurs when the LLM represents a reference to an earlier result using a literal argument instead of the variable that stores that result. The individual statements are structurally legal, but the producer-consumer relationship between them is lost.
The rightmost part of Figure 3 illustrates this problem. Before reconstruction, parse_json receives the literal file name "config.json" rather than the variable containing the file content returned by read_file. The reconstruction stage replaces this literal with v1, thereby restoring the producer-consumer dependency.
To identify such cases, SCS examines literal arguments together with the original instruction steps and the current symbol table. When a literal or textual reference corresponds to a previously generated value, SCS proposes replacing the literal with the associated IR variable. A rewrite is accepted only when it conforms to the signature of the invoked API, uses an already defined variable, and respects the temporal ordering of the original instruction steps.
After the current batch has been cleaned, checked, and reconstructed, SCS updates the symbol table with the newly generated variables and their instruction-level meanings. Compilation then proceeds to the next batch. Through this incremental process, SCS converts free-form natural-language instructions into a constrained and dependency-aware IR for subsequent Text-PDG construction.
C. Building xPDG across NL and Code
After NL-to-IR compilation, SCS parses the generated IR using tree-sitter [32] and constructs a Text-PDG that captures the control-flow and data-flow dependencies expressed in the natural-language instructions. Since each IR statement follows a simple API-call form, its invoked operation, arguments, and variable dependencies can be directly represented as graph nodes and edges.
For the code domain, SCS similarly parses bundled scripts and constructs a Code-PDG. Our current implementation supports Python, JavaScript, and Shell scripts, covering 191 Python functions, 91 JavaScript functions, and 59 Shell commands. The primary difference between the two domains lies in the operations represented by their statement nodes: Text-PDG uses the limited API set defined for natural-language instructions, whereas Code-PDG models supported language-specific functions and library calls. Each supported operation is assigned the security properties required by the subsequent TSC analysis. The complete function lists and their corresponding property definitions are provided in our publicly available artifact described in Appendix B.
Finally, SCS integrates the Text-PDG and Code-PDG into a unified cross-domain Program Dependence Graph (xPDG), allowing dependencies and security evidence to be analyzed jointly across natural-language instructions and bundled code artifacts. Figure 4 illustrates the resulting graph, in which an instruction reads sensitive data and passes it to a script that eventually sends the data through a network operation. The detailed node and edge definitions of the xPDG are provided in Appendix C, while the security-property propagation and risk-detection procedure are described in Section IV.
IV. TSC-BASED SKILL SECURITY ANALYSIS
Given the xPDG constructed in Section III-C, SCS performs a unified security analysis across natural-language instructions and executable code. The analysis consists of two stages. First, SCS defines a set of TSC transfer rules to derive and propagate variable security states over the xPDG. Second, it evaluates the resulting states and graph structure using deterministic security rules to identify potential security risks.
A. TSC Security Property Definition
TSC models security properties along three dimensions: Trust, Sensitivity, and Capability. These dimensions are designed around two major sources of supply-chain risk in agent skills: untrusted third-party influence and unintended exposure of local sensitive information. The categories of each dimension and their corresponding descriptions are summarized in Table II.
TABLE II DEFINITION OF TSC SECURITY PROPERTIES
| Dimension | Category | Description |
|---|---|---|
| Trust | TRUSTED(0)PROVISIONED(1)DERIVED(2)UNTRUSTED(3) | Fully trusted source.Locally provided data.Derived from existing data.External or uncontrolled data. |
| Sensitivity | PUBLIC(0)INTERNAL(1)SYSTEM(2)SENSITIVE(3)SECRET(4) | Non-sensitive data.Internal project data.System-level configuration data.Confidential data.Highly sensitive data. |
| Capability | NONEREADWRITEEXECNETWORKPERSISTENVINSTALLELEVATEOBFUSCATEDENCODINGCOVERT_PAYLOADCONTROL_OVERRIDE | No security-relevant capability.Read local or external data.Create, modify, or delete data.Execute commands, scripts, or code.Communicate through network channels.Create or modify persistent mechanisms.Read or modify environment variables.Install packages or other dependencies.Exercise elevated or delegated authority.Data recovered from hidden encodings.Convert data into an encoded form.Payload assembled from data fragments.Attempt to bypass agent controls. |
Trust and Sensitivity are variable-level properties modeled as ordered lattices. Trust captures the provenance and reliability of data, distinguishing values originating from external resources, third-party tools, imported skills, downloaded content, and other supply-chain components. Sensitivity captures data confidentiality and the potential harm of disclosure, such as the exposure of local files, credentials, or environment variables to untrusted third parties. Together, they describe the security characteristics of the data carried by each variable.
Capability is represented at both the API and variable levels. At the API level, it is determined by the specific semantics of an API and identifies the security-relevant operation performed by its invocation, such as reading a file, executing a command, or accessing the network. At the variable level, Capability records the security-relevant operations involved in producing the variable's value. For example, a value returned by read_file carries READ, indicating that it was produced by a file-read operation.
Accordingly, the propagated security state of a variable is
where and are the ordered Trust and Sensitivity lattices, and is the capability powerset ordered by set inclusion. The bottom state is .
B. TSC Transfer Rules and State Propagation
Each statement invokes an API with zero or more input variables and may or may not produce an output. When an xPDG: Cross-Domain Program Dependence Graph

Fig. 4. Construction of the xPDG and an illustrative cross-domain evidence path.
output exists, its security state is determined by the semantics of the invoked API and the security states of its input variables. SCS considers both sources and their interactions through the following TSC transfer rules.
For the API-derived source, each API is assigned a base state , which is initialized to by default. For APIs whose specific semantics affect the security state of their returned values, such as get_env returning environment data that is more security-relevant than ordinary public text, is raised accordingly by setting its Sensitivity to INTERNAL. We define the base TSC state for every API in the limited API set, as summarized in Table VI in Appendix E. For the code domain, SCS applies the same security-property assignment scheme to the supported Python, JavaScript, and Shell functions. Due to space limitations, the complete language-specific function lists and their corresponding TSC properties are provided in our publicly available artifact described in Appendix B.
For the input-derived source, argument-to-output transfer specifications identify which input arguments affect the security state of an API's output and along which TSC dimensions their influence is propagated. A transfer specification has the form
where identifies an input parameter of the API and specifies the TSC dimensions propagated from that parameter to the output. For example, the output of parse_json(text) is a structured representation of the same data carried by text; therefore, its Trust, Sensitivity, and Capability are all propagated to the output. By contrast, for http_post(url, payload, ...), the url determines the provenance of the returned value, whereas the remaining arguments represent outbound request data and are not propagated to the return state. For every API with return value, we define one or more return-state transfer rules that precisely specify how its input parameters affect the returned state across the TSC dimensions.
Overall, for a statement that invokes API and produces output , its output state is derived by combining the API-derived state with the state propagated from its input variables:
Let denote the argument-to-output transfer rules of . Each rule specifies that parameter affects the output along the TSC dimensions in . The input-derived state is computed as
where is the input variable bound to parameter , and retains only the TSC dimensions included in while setting the remaining dimensions to their corresponding lattice bottoms. For example, if , only the Trust state of is propagated to the output. When no argument-to-output transfer rule is defined, the states of all input variables are joined as the default propagation.
When multiple sources contribute to the same output, the operator merges their contributions into a single TSC state. For , the product-lattice join is defined as
Accordingly, the merged state takes the less trustworthy Trust level, the higher Sensitivity level, and the union of the Capabilities contributed by the input states.
Whenever a variable is defined or updated by an API invocation containing statically known literal arguments, SCS uses their concrete values to refine the resulting security state. For example, if the path passed to read_file is classified as security-sensitive resource, the Sensitivity of the returned value is raised according to the corresponding resource category. Conversely, if the destination of a network request is identifiable as a trusted endpoint, its returned value is assigned a lower-risk Trust state.
SCS repeatedly applies these transfer rules and propagates every updated state to its downstream uses. Loops and other cyclic dependencies may cause a later update to affect a statement that has already been processed, so we implement a worklist-based iteration that revisits affected statements. The process terminates when for every variable . The complete propagation algorithm is provided in Appendix D.
C. xPDG-Based Security Rule Evaluation
After TSC propagation reaches the fixed point, SCS evaluates the resulting states using deterministic security-risk identification rules. Based on common threat patterns in software supply chains and agent skills, we define the following three forms of security-risk identification rules.
Trust/Sensitivity-to-operation rules constitute the majority of node rules. Given an input variable v and the API invoked by the current statement, these rules have the following form:
Here, X selects the Trust or Sensitivity dimension, is the corresponding risk threshold, c is the required API Capability, and is the identified risk. For example, when a variable whose Sensitivity is at least SENSITIVE is bound to any outbound payload argument of http_post, the variable state satisfies the required threshold and the API provides the required NETWORK Capability. The rule is therefore triggered and identifies a potential data-exfiltration risk.
Capability-provenance rules similarly take an input variable v and the API invoked by the current statement as the objects to be examined. These rules have the following form:
Here, specifies the required operation provenance of the input value, specifies the required Capability of the current API, and is the identified risk. For example, if a variable carries the OBFUSCATED Capability, indicating that its value originates from obfuscated content, and subsequently flows into an API with the EXEC Capability, the rule identifies a potential covert-execution risk.
Agent-control event rules address a special case represented by the attempt_policy_override API in the limited IR API set. Unlike the preceding two rule types, which identify risky combinations of variable states and API Capabilities, this API records an explicit attempt to violate the agent's instruction hierarchy, safety policy, or user-confirmation boundary. The occurrence of this API alone is insufficient to determine whether the skill is malicious, since similar language may appear in quoted, explanatory, or defensive contexts without instructing the agent to perform the described override. To resolve this ambiguity, SCS provides an evidence-constrained LLM with the exact source instruction, its surrounding text, the normalized IR statement, and the matched rule, and asks whether the instruction constitutes an operational attempt to violate the agent's instruction, safety, or confirmation boundary. The resulting judgment is used to determine whether the matched event represents an actual agent-control security issue.
V. EVALUATION
This section presents a comprehensive evaluation of SCS, focusing on three research questions:
• RQ1: How effective is SCS in detecting malicious skills compared with SOTA baselines across different LLMs?
• RQ2: How reliable is the NL-to-IR compilation stage that underpins SCS’s downstream program analysis?
• RQ3: How does SCS support large-scale auditing of malicious skills in a real-world skill marketplace?
A. Evaluation Setup
-
Datasets: To construct a reliable benchmark for controlled evaluation, we collect 100 samples from MalSkills [19] and 157 records from MaliciousAgentSkillsBench [31]. After removing inaccessible samples and duplicates, we obtain 117 unique malicious skills. For the benign class, we retain the benign samples available from these two sources and supplement the remaining samples with the most-installed skills from ClawHub. All samples are manually verified, resulting in a balanced benchmark of 234 skills, including 117 malicious and 117 benign samples.
-
Baselines: We compare SCS with both widely used open-source scanners and recent research methods for malicious agent skill detection.
For open-source scanner baselines, we survey publicly accessible GitHub projects that provide an end-to-end pipeline for detecting security risks in Agent Skills, and identify four projects with at least 1,000 GitHub stars. We include SkillSpector [33] (12.9K stars and 1.1K forks), AI-Infra-Guard (A.I.G) [34] (4.1K stars and 394 forks), and Skill-Scanner [35] (2.3K stars and 288 forks). We exclude Snyk Agent Scan [36] (2.8K stars and 246 forks) because its analysis relies on proprietary Snyk APIs and an internal signature database, preventing a fully controlled and reproducible comparison, a limitation that also led Wang et al. to omit it from the MalSkills evaluation [19].
For academic baselines, we survey recent studies on malicious agent skill detection and select methods with publicly available implementations and supporting artifacts that enable controlled reproduction on our benchmark. This results in four academic baselines: MalSkills [19], MaliciousAgentSkills-Bench (MASB) [31], SkillFortify [18], and SkillLeakBench [37].
B. RQ1: Comparison with SOTA Baselines
We compare SCS with the selected open-source scanners and academic baselines on the manually verified benchmark. We use the following four metrics:
• Accuracy: the proportion of benign and malicious skills that are correctly classified.
• Precision: the proportion of skills predicted as malicious that are truly malicious.
-
Recall: the proportion of truly malicious skills that are correctly identified.
-
F1-score: the harmonic mean of precision and recall.
SCS, Skill-Scanner, A.I.G, SkillSpector, MalSkills, and MASB employ LLMs for semantic analysis, risk reasoning, or maliciousness classification. Their performance may therefore depend on the selected model. To avoid drawing conclusions from a single model and to examine the robustness of each method across different LLMs, we evaluate these methods using five representative models, including two proprietary models, GPT-5.4 and Sonnet-4.6, and three open-weight models, GPT-OSS-120B, Qwen3-235B-A22B, and DeepSeek-R1-671B. We additionally record the token consumption of each method under every evaluated LLM, measured as the sum of input and output tokens over all LLM invocations on the complete benchmark. The remaining two methods, SkillFortify and SkillLeakBench, rely on non-LLM static analysis and produce deterministic results, and are therefore each evaluated only once without token-consumption measurement.

Fig. 5. Token Consumption Across Different Skill Detection Methods
The detection results and LLM token consumption are summarized in Table III and Figure 5, respectively. Across the five evaluated LLMs, SCS achieves an average accuracy of , precision of , recall of , and F1-score of , yielding the highest average accuracy, recall, and F1-score among the evaluated methods. A.I.G achieves a slightly higher average precision of , but its recall and F1-score decrease to and , respectively; moreover, its average token consumption is more than four times that of SCS (56.9M vs. 13.7M). SkillSpector reaches a recall of with GPT-5.4, but this high recall does not translate into comparable overall performance because of its lower precision and F1-score, noticeable variation across LLMs, and substantially higher token consumption. Skill-Scanner and
TABLE III DETECTION PERFORMANCE ACROSS DIFFERENT LLMs
| Method@Model | Acc. | Prec. | Rec. | F1 |
|---|---|---|---|---|
| SCS@GPT-5.4 | 83.3% | 76.7% | 95.7% | 85.2% |
| SCS@Sonnet-4.6 | 88.9% | 88.2% | 89.7% | 89.0% |
| SCS@GPT-OSS-120B | 84.6% | 78.3% | 95.7% | 86.2% |
| SCS@Qwen3-235B-A22B | 86.3% | 80.1% | 96.6% | 87.6% |
| SCS@DeepSeek-R1-671B | 85.0% | 77.7% | 98.3% | 86.8% |
| SCS@Average | 85.6% | 80.2% | 95.2% | 86.9% |
| Skill-Scanner@GPT-5.4 | 70.5% | 63.2% | 98.3% | 76.9% |
| Skill-Scanner@Sonnet-4.6 | 73.9% | 68.9% | 87.2% | 77.0% |
| Skill-Scanner@GPT-OSS-120B | 63.7% | 59.4% | 86.3% | 70.4% |
| Skill-Scanner@Qwen3-235B-A22B | 68.8% | 62.2% | 95.7% | 75.4% |
| Skill-Scanner@DeepSeek-R1-671B | 64.1% | 60.5% | 81.2% | 69.3% |
| Skill-Scanner@Average | 68.2% | 62.8% | 89.7% | 73.8% |
| A.I.G@GPT-5.4 | 85.0% | 79.7% | 94.0% | 86.3% |
| A.I.G@Sonnet-4.6 | 88.5% | 86.9% | 90.6% | 88.7% |
| A.I.G@GPT-OSS-120B | 69.7% | 73.5% | 61.5% | 67.0% |
| A.I.G@Qwen3-235B-A22B | 86.3% | 85.1% | 88.0% | 86.6% |
| A.I.G@DeepSeek-R1-671B | 85.9% | 85.0% | 87.2% | 86.1% |
| A.I.G@Average | 83.1% | 82.0% | 84.3% | 82.9% |
| SkillSpector@GPT-5.4 | 69.2% | 62.0% | 99.1% | 76.3% |
| SkillSpector@Sonnet-4.6 | 73.9% | 66.5% | 96.6% | 78.7% |
| SkillSpector@GPT-OSS-120B | 57.7% | 55.4% | 78.6% | 65.0% |
| SkillSpector@Qwen3-235B-A22B | 70.5% | 67.1% | 80.3% | 73.2% |
| SkillSpector@DeepSeek-R1-671B | 70.5% | 65.6% | 86.3% | 74.5% |
| SkillSpector@Average | 68.4% | 63.3% | 88.2% | 73.6% |
| MalSkills@GPT-5.4 | 58.5% | 54.8% | 97.4% | 70.2% |
| MalSkills@Sonnet-4.6 | 62.0% | 56.9% | 98.3% | 72.1% |
| MalSkills@GPT-OSS-120B | 67.1% | 61.1% | 94.0% | 74.1% |
| MalSkills@Qwen3-235B-A22B | 77.4% | 70.8% | 93.2% | 80.4% |
| MalSkills@DeepSeek-R1-671B | 70.1% | 65.4% | 85.5% | 74.1% |
| MalSkills@Average | 67.0% | 61.8% | 93.7% | 74.2% |
| MASB@GPT-5.4 | 57.7% | 61.5% | 41.0% | 49.2% |
| MASB@Sonnet-4.6 | 59.4% | 70.4% | 32.5% | 44.4% |
| MASB@GPT-OSS-120B | 58.1% | 65.6% | 34.2% | 44.9% |
| MASB@Qwen3-235B-A22B | 57.7% | 64.1% | 35.0% | 45.3% |
| MASB@DeepSeek-R1-671B | 60.7% | 69.8% | 37.6% | 48.9% |
| MASB@Average | 58.7% | 66.3% | 36.1% | 46.6% |
| SkillFortify | 61.5% | 57.2% | 91.5% | 70.4% |
| SkillLeakBench | 65.4% | 74.3% | 47.0% | 57.6% |
MalSkills achieve average recalls of and , respectively, while consuming fewer tokens than SCS; however, their substantially lower precision (62.8% and 61.8%) limits their average F1-scores to and . MASB also incurs relatively low token cost, but its low recall and F1-score indicate considerably weaker malicious-skill coverage. Overall, SCS achieves a favorable balance among detection effectiveness, robustness across different LLMs, and LLM token cost.
Case Study and Baseline Analysis. We revisit the malicious pptx_skill introduced in Section II-B to examine how the seven baselines handle its cross-domain behavior.
SkillFortify and SkillLeakBench misclassify this sample as benign. Both rely on predefined static rules, and their existing rules cannot reconstruct the dependency between the natural-language workflow and the invoked script, causing them to miss the complete attack path. The LLM-based MASB, MalSkills, and Skill-Scanner either fail to produce a malicious classification or exhibit inconsistent results across different LLMs. This model dependence highlights the uncertainty introduced when core semantic analysis and maliciousness classification rely heavily on LLM judgments. Although A.I.G and SkillSpector successfully detect the sample, their reports include some incorrect or irrelevant risk evidence. In contrast, SCS consistently identifies the sample and reports focused evidence corresponding directly to the cross-domain attack path established in Section II-B, further demonstrating the effectiveness of its unified cross-domain analysis.
Summary of RQ1: Across five LLMs, SCS achieves the highest average accuracy (85.6%), recall (95.2%), and F1-score (86.9%) among the evaluated methods while maintaining competitive precision (80.2%). Together with its moderate LLM token consumption, these results show that SCS provides a favorable balance between detection effectiveness, cross-model robustness, and LLM usage.
C. RQ2: Quality of NL-to-IR Compilation
The core stages of SCS form a structurally dependent analysis pipeline, where NL-to-IR provides the representation required for Text-PDG construction and subsequent cross-domain analysis. Removing an upstream stage would therefore make the downstream analysis undefined rather than yield a directly comparable reduced configuration. We instead perform stage-level validation of NL-to-IR, whose reliance on an LLM introduces potential errors that are not captured by system-level detection results alone. To this end, we construct a step-level gold set and compare the generated IR against human-annotated compilation requirements.
- Gold Set Construction: Existing malicious-skill datasets are organized at the skill-package level, whereas NL-to-IR compilation operates on individual instruction steps. A skill-level label therefore cannot determine whether a particular step has been correctly compiled. We construct a dedicated step-level gold set to evaluate this module.
The samples are drawn from a frozen snapshot of the ClawHub corpus, which provides a large-scale collection of publicly available real-world skills. We randomly sample 400 distinct skills from this corpus and apply the deterministic segmentation procedure described in Section III-B1. One non-empty instruction step is then randomly selected from each skill, so that no skill contributes more than one sample. This procedure avoids over-representing skills that contain more instruction steps.
Each sample contains a target instruction step, the preceding context required to resolve its references, and a set of expected compilation properties. We do not assign a single fixed reference IR to each step, because the same instruction may be compiled into different but semantically equivalent IR statements, for example, by using different variable names or decomposing one instruction into several operations. Instead, we annotate a set of constraints that any correct compilation should satisfy.
Specifically, must_call specifies the API operations that must appear, while must_not_call specifies operations that must not be introduced without support from the instruction. must_ground requires concrete arguments, such as file paths or URLs, to be supported by the instruction or its context. must_thread specifies the producer-consumer dependencies that must be preserved between operations, regardless of the concrete variable names used. Finally, must_abstain indicates that a step contains no supply-chain-security-relevant operation and should therefore generate no operational IR statement. A complete annotation example is provided in Appendix F3.
We construct a gold set containing 400 instruction steps. This sample size is chosen because approximately 385 independent observations are required to estimate a binomial proportion at a 95% confidence level with a worst-case margin of error of approximately . We round this number up to 400 to provide sufficiently precise estimates of both the overall step-level correctness and the individual property satisfaction rates.
Two annotators independently label each sample based only on the original instruction and its context, following a predefined annotation guideline detailed in Appendix F4. Each property is assigned an explicit expected value, where the absence of a required operation or dependency is also treated as a valid expectation. The generated IR is then evaluated as satisfying or violating each property, and a step is considered correct only when all five properties are satisfied. We measure inter-annotator agreement using Cohen's , resolve disagreements through a third annotator, and report a 95% Wilson confidence interval for each result.
- Results: The two annotators achieved Cohen's values of 0.90, 0.93, 0.89, 0.84, and 0.89 for must_call, must_not_call, must_ground, must_thread, and must_abstain, respectively. The macro-average Cohen's was 0.89, indicating a high level of agreement on the gold annotations. Table IV reports the compilation accuracy for each annotated property across the five evaluated LLMs. Across these models, all property accuracies remain above 94%. We further evaluate the overall step-level accuracy, where a step is considered correct only when all five property requirements are simultaneously satisfied. Under this stricter criterion, the evaluated models achieve accuracies ranging from 92.5% to 94.5%, with a cross-model difference of only 2.0 percentage points. The consistently high performance across different models indicates that the compilation pipeline is relatively insensitive to the choice of LLM.
TABLE IV NL-TO-IR COMPILATION ACCURACY ACROSS LLMs ON THE GOLD SET. EACH CELL REPORTS ACCURACY WITH A 95% CONFIDENCE INTERVAL.
| Model | must_call | must_not_call | must_ground | must_thread | must_abstain | Overall |
|---|---|---|---|---|---|---|
| GPT-5.4 | 95.5% (93.0–97.1) | 99.2% (97.8–99.7) | 97.5% (95.5–98.6) | 99.5% (98.2–99.9) | 95.5% (93.0–97.1) | 92.5% (89.5–94.7) |
| Sonnet-4.6 | 96.2% (93.9–97.7) | 99.8% (98.6–100.0) | 97.0% (94.8–98.3) | 100.0% (99.0–100.0) | 96.8% (94.5–98.1) | 93.8% (90.9–95.7) |
| GPT-OSS-120B | 95.0% (92.4–96.7) | 99.8% (98.6–100.0) | 98.0% (96.1–99.0) | 99.5% (98.2–99.9) | 97.0% (94.8–98.3) | 94.2% (91.5–96.1) |
| Qwen3-235B-A22B | 96.0% (93.6–97.5) | 99.8% (98.6–100.0) | 98.0% (96.1–99.0) | 100.0% (99.0–100.0) | 94.8% (92.1–96.5) | 94.5% (91.8–96.3) |
| DeepSeek-R1-671B | 95.5% (93.0–97.1) | 99.5% (98.2–99.9) | 97.8% (95.8–98.8) | 99.5% (98.2–99.9) | 95.8% (93.3–97.3) | 94.0% (91.2–95.9) |
Summary of RQ2: We evaluate the NL-to-IR compiler, the key LLM-dependent stage underlying subsequent cross-domain analysis, using a step-level gold set constructed from 400 randomly sampled real-world ClawHub skills and five semantic compilation properties. Across five evaluated LLMs, SCS achieves 92.5%–94.5% overall step-level correctness, while all individual property accuracies exceed 94%. These results indicate reliable and consistent NL-to-IR compilation across different LLMs.
D. RQ3: Real-World Malicious Skill Analysis
We conduct a large-scale analysis of the real-world ClawHub ecosystem using a snapshot collected on 20 April 2026, which contains 66,157 publicly available skills. Applying SCS to the complete corpus produces 2,473 candidate skills, each accompanied by one or more static evidence paths. To further validate these candidates, we exercise the candidate skills through the auxiliary dynamic validation procedure described in Appendix G, which collects runtime evidence from tool calls, file accesses, process executions, and network events. We then manually review the static and runtime evidence together and ultimately confirm 627 malicious skills. Dynamic validation serves only as supporting evidence, while the final maliciousness decisions are made through manual review. The complete analysis results and related artifacts are publicly available in the artifact described in Appendix B.
The confirmed malicious skills are highly concentrated among a small number of publishers: hightower6eu contributes 354 skills (56.46%), sakaen736jih contributes 198 (31.58%), and zaycv contributes another 20 (3.19%), with the first two publishers together accounting for 88.04% of all confirmed cases. We further examine the subsequent status of these malicious skills using registry records retrieved through ClawHub's official public API [38]. Notably, all malicious skills published by the two dominant publishers had been removed from the public ClawHub registry by the time of our follow-up check on 15 July 2026. Overall, only 23 of the 627 confirmed malicious skills remain identifiable, including 19 labeled malicious and four labeled suspicious. This substantial reduction suggests considerable temporal change in the availability of malicious skills within the public ecosystem.
Summary of RQ3: Applying SCS to 66,157 real-world ClawHub skills identifies 2,473 candidate skills, of which 627 are confirmed as malicious through auxiliary dynamic validation and manual review. These malicious skills are highly concentrated among a small number of publishers and show substantial temporal change in subsequent registry records: most are absent from the later registry, including all confirmed malicious skills associated with the two dominant publishers.
VI. DISCUSSION
A. Coverage of Security-Relevant Behaviors
The current API set and security rules cover recurring behaviors identified in software supply-chain and agent-skill security studies. Previously unseen behaviors or unsupported library calls may remain outside this coverage and lead to false negatives. Such behaviors can be incorporated by adding the corresponding API definitions, TSC transfer rules, and detection rules without changing the underlying xPDG representation.
B. Static Analysis Scope and Auxiliary Dynamic Validation
As a pre-install static analyzer, SCS infers TSC properties from statically observable information in skill artifacts, which may not fully capture runtime-resolved resources, dynamically generated values, or execution context. For example, a known credential path can be classified as sensitive, whereas sensitive data stored under an uninformative or dynamically generated path may not be recognized. In the real-world study, we apply auxiliary dynamic validation to every candidate skill identified by SCS, providing runtime evidence to support subsequent manual confirmation. This procedure is not part of the core detection pipeline: RQ1 evaluates the static SCS pipeline alone, while dynamic validation is used only to support the final review in RQ3.
C. LLM-Related Uncertainty
NL-to-IR compilation and context-dependent judgments for ambiguous instructions still rely on LLMs and may introduce omissions, hallucinated operations, or incorrect dependencies. Although the constrained IR, legality checks, and dependency reconstruction reduce such errors, they cannot completely eliminate the uncertainty of interpreting open-ended natural-language instructions.
VII. RELATED WORK
A. Supply Chain Security in Software and LLM Agents
Traditional software supply chains. Software supply chain security has been extensively studied in ecosystems such as npm, PyPI, and RubyGems. Representative works detect malicious packages through metadata signals, static analysis, and dynamic analysis [27], [30], [39]. A common assumption in this line of work is that the attack payload is ultimately expressed in executable code, such as installation scripts, import-time logic, or hidden runtime behaviors, and can therefore be analyzed with conventional code-centric techniques.
Agent supply chain security. LLM agent supply chains expose a broader attack surface because third-party artifacts can influence behavior through both code and natural-language instructions. This risk is closely related to prompt injection and jailbreak-style manipulation [40], [41], [42], making model-facing instructions themselves security-relevant. Recent studies characterize this emerging supply chain in terms of architecture, threat taxonomy, and trust boundaries [43], [44], [45], while others demonstrate practical attacks through skill injection, document-borne payloads, supply-chain poisoning, and automated exploitation [11], [12], [13], [14]. Together, these works show that agent supply chains extend conventional code-centric threats to hybrid instruction-and-code artifacts.
B. Security Studies on Agent Skills
Adversarial studies. Recent studies show that agent skills can be exploited through diverse mechanisms. Skill-inject and SkillJect examine skill-based prompt injection, while supply-chain poisoning and SkillAttack study document-borne payloads and exploitation of latent vulnerabilities [11], [12], [13], [14]. SkillTrojan and BadSkill further demonstrate skill-level and model-in-skill backdoors [15], [46], while other work reports credential leakage risks from cross-modal interactions among skill artifacts [37]. Dedicated benchmarks and large-scale empirical studies further characterize malicious skill behaviors in public marketplaces [31], [47]. Collectively, these studies highlight a multifaceted attack surface spanning prompt injection, supply-chain poisoning, vulnerability exploitation, and stealthy backdoors.
Detection and auditing methods. Recent defense research has proposed several approaches for auditing malicious agent skills. Open-source tools like Caterpillar [23] and SkillScanner [35] use rule-based and ML methods to detect risky behaviors. Several papers extend this line with more advanced techniques. AGENTARMOR constructs a security program dependence graph (sPDG) from runtime tool invocations to detect unsafe behaviors [48]. MalSkills combines symbolic rules with LLM-assisted reasoning to extract Sensitive Security Operations (SSOs) and assess maliciousness [19]. SkillProbe uses multi-turn semantic auditing to verify whether a skill's behavior matches its declared capabilities [20]. SkillSieve integrates lightweight filters and LLM-based checks over intent, permissions, stealth, and consistency [21]. SkillFortify formalizes skill adversaries and dependency resolution in a unified framework [18]. Additionally, MaliciousAgentSkillsBench offers a large-scale empirical study of malicious skills, helping benchmark malicious behaviors [31]. SkillClone focuses on clone detection and propagation in the skill ecosystem [49]. Malicious Or Not improves classification by incorporating repository context to reduce false positives [50]. Together, these works show the growing interest in pre-install skill auditing, with designs differing in runtime monitoring, LLM reasoning, and capability modeling.
C. Static Analysis and Information-Flow Techniques
Traditional static analysis tools such as Semgrep, CodeQL, and Joern [51], [52], [53] provide practical support for code-centric security auditing through pattern matching, relational querying, and code property graphs. FlowDroid [54] further demonstrates the value of precise interprocedural source-to-sink reasoning in security analysis. More broadly, taint analysis and information-flow control provide widely used abstractions for modeling trust propagation and sensitive data flow [55], [56], [57], [58], while IFDS/IDE offers a standard graph-based framework for interprocedural propagation [59], [60]. Systems such as TaintDroid and DroidSafe [61], [62] further illustrate how precise flow modeling can uncover leakage and misuse in complex applications. Although these techniques were not originally designed for hybrid agent artifacts, they provide important building blocks for our SCS, including graph construction, source-to-sink reasoning, and structured flow propagation.
D. Natural-Language Procedural Representation
Prior work has explored translating natural language into structured program representations. NL2Bash maps natural-language requests to executable commands [63], while PAGED and related procedural-graph methods recover actions and their logical dependencies from documents [24], [64]. WorkflowLLM and the FLOW-GEN approach introduced in FLOW-BENCH represent natural-language workflows using Python-style intermediate programs [25], [26]. BREX and ExIde further study business-rule dependencies through structured and executable grounding [65]. Inspired by these designs, SCS adopts a constrained program-like IR, but specializes it for static security analysis by explicitly modeling security-relevant operations, arguments, and cross-step data dependencies.
VIII. Conclusion
In this paper, we present SCS, a static analysis framework for auditing the supply-chain security of LLM agent skills. SCS brings natural-language instructions and bundled code into a unified program-analysis pipeline through constrained NL-to-IR compilation, cross-domain dependence modeling with xPDG, and TSC-based security property propagation. This design enables SCS to reason about security-relevant behavior chains that span heterogeneous skill artifacts.
Across five LLMs, SCS achieves the highest average accuracy, recall, and F1-score among the evaluated methods while maintaining a favorable effectiveness–cost trade-off. Its
NL-to-IR compiler correctly translates over 92% of human-annotated instruction steps. On 66,157 self-collected ClawHub skills, SCS identifies 2,473 candidate skills, of which 627 are confirmed as malicious through auxiliary dynamic validation and manual auditing, illustrating the practical applicability of program analysis to hybrid natural-language and code artifacts.
ETHICS CONSIDERATIONS
Our study analyzes only publicly available skill artifacts. Dynamic validation is conducted in disposable, isolated environments using synthetic files and nonfunctional canary credentials, without exposing real user data or production credentials. Potentially malicious findings are manually reviewed before any disclosure.
REFERENCES
[1] Agent Skills, “Overview - agent skills,” 2026. [Online]. Available: https://agentskills.io/home
[2] Model Context Protocol, “What is the model context protocol (mcp)?” 2026. [Online]. Available: https://modelcontextprotocol.io/docs/getting-started/intro
[3] OpenAI, “Plugins,” 2026. [Online]. Available: https://developers.openai.com/codex/plugins
[4] Anthropic, “Extend claude with skills,” 2026. [Online]. Available: https://code.claude.com/docs/en/skills
[5] OpenAI, “Agent skills,” 2026. [Online]. Available: https://developers.openai.com/codex/skills
[6] Google, “Set up your coding assistant with gemini mcp and skills,” 2026. [Online]. Available: https://ai.google.dev/gemini-api/docs/coding-agents
[7] Cursor, “Agent skills — cursor docs,” 2026. [Online]. Available: https://cursor.com/docs/skills
[8] OpenClaw, “openclaw/skills: Archive of clawhub skills,” 2026. [Online]. Available: https://github.com/openclaw/skills
[9] Skills, “The agent skills directory,” 2026. [Online]. Available: https://skills.sh/
[10] SkillsMP, “Agent skills marketplace - claude, codex & chatgpt skills — skillsmp,” 2026. [Online]. Available: https://skillsmp.com/
[11] D. Schmotz, L. Beurer-Kellner, S. Abdelnabi, and M. Andriushchenko, "Skill-inject: Measuring agent vulnerability to skill file attacks," arXiv preprint arXiv:2602.20156, 2026.
[12] X. Jia, J. Liao, S. Qin, J. Gu, W. Ren, X. Cao, Y. Liu, and P. Torr, "SkillJect: Effectively automating skill-based prompt injection for skill-enabled agents," arXiv preprint arXiv:2602.14211, 2026.
[13] Y. Qu, Y. Liu, T. Geng, G. Deng, Y. Li, L. Y. Zhang, Y. Zhang, and L. Ma, “Supply-Chain Poisoning Attacks Against LLM Coding Agent Skill Ecosystems,” arXiv preprint arXiv:2604.03081, 2026.
[14] Z. Duan, Y. Tian, Z. Yin, L. Pang, J. Deng, Z. Wei, S. Xu, Y. Ge, and X. Cheng, “Skillattack: Automated red teaming of agent skills through attack path refinement,” arXiv preprint arXiv:2604.04989, 2026.
[15] Y. Feng, Y. Ding, Y. Tan, B. Zheng, Y. Guo, X. Li, K. Zhai, Y. Li, and W. Huang, “Skilltrojan: Backdoor attacks on skill-based agent systems,” arXiv preprint arXiv:2604.06811, 2026.
[16] Snyk, “Snyk Finds Prompt Injection in 36%, 1467 Malicious and Vulnerable AI Agent Skills,” 2026. [Online]. Available: https://snyk.io/blog/toxicskills-malicious-ai-agent-skills-clawhub/
[17] Koi Security, “ClawHavoc: 341 malicious clawed skills found by the bot they were targeting,” https://www.koi.ai/blog/clawhavoc-341-malicious-clawedbot-skills-found-by-the-bot-they-were-targeting, 2026.
[18] V. P. Bhardwaj, “Formal analysis and supply chain security for agentic AI skills,” arXiv preprint arXiv:2603.00195, 2026.
[19] S. Wang, J. He, Y. Zhao, Y. Wang, K. Yu, and H. Wang, “MalSkills: Detecting Malicious Skills in the Agentic Supply Chain via Neuro-Symbolic Reasoning,” in 41st IEEE/ACM International Conference on Automated Software Engineering (ASE), 2026, to appear.
[20] Z. Guo, Z. Chen, X. Nie, J. Lin, Y. Zhou, and W. Zhang, “SkillProbe: Security auditing for emerging agent skill marketplaces via multi-agent collaboration,” arXiv preprint arXiv:2603.21019, 2026.
[21] Y. Hou and Z. Yang, “SkillSieve: A Hierarchical Triage Framework for Detecting Malicious AI Agent Skills,” arXiv preprint arXiv:2604.06550, 2026.
[22] aisa-group, “promptinject-agent-skills,” 2026. [Online]. Available: https://github.com/aisa-group/promptinject-agent-skills
[23] alice-dot io, “Caterpillar,” 2026. [Online]. Available: https://github.com/alice-dot-io/caterpillar
[24] W. Du, W. Liao, H. Liang, and W. Lei, “PAGED: A benchmark for procedural graphs extraction from documents,” in Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), L.-W. Ku, A. Martins, and V. Srikumar, Eds. Bangkok, Thailand: Association for Computational Linguistics, Aug. 2024, pp. 10829–10846. [Online]. Available: https://aclanthology.org/2024.acl-long.583/
[25] S. Fan, X. Cong, Y. Fu, Z. Zhang, S. Zhang, Y. Liu, Y. Wu, Y. Lin, Z. Liu, and M. Sun, “WorkflowLLM: Enhancing workflow orchestration capability of large language models,” in The Thirteenth International Conference on Learning Representations, 2025. [Online]. Available: https://openreview.net/forum?id=3Hy00Wvabi
[26] E. Duesterwald, S. Huo, V. Isahagian, K. R. Jayaram, R. Kumar, V. Muthusamy, P. Oum, D. Saha, G. Thomas, and P. Venkateswaran, "FLOW-BENCH: Towards conversational generation of enterprise workflows," in Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing: Industry Track, S. Potdar, L. Rojas-Barahona, and S. Montella, Eds. Suzhou (China): Association for Computational Linguistics, Nov. 2025, pp. 1426–1436. [Online]. Available: https://aclanthology.org/2025.emnlp-industry.100/
[27] M. Ohm, H. Plate, A. Sykosch, and M. Meier, “Backstabber’s knife collection: A review of open source software supply chain attacks,” in International Conference on Detection of Intrusions and Malware, and Vulnerability Assessment. Springer, 2020, pp. 23–43.
[28] P. Ladisa, H. Plate, M. Martinez, and O. Barais, “SoK: Taxonomy of attacks on open-source software supply chains,” in 2023 IEEE Symposium on Security and Privacy (SP). IEEE, 2023, pp. 1509–1526.
[29] W. Guo, Z. Xu, C. Liu, C. Huang, Y. Fang, and Y. Liu, “An empirical study of malicious code in PyPI ecosystem,” in Proceedings of the 38th IEEE/ACM International Conference on Automated Software Engineering, 2023.
[30] N. Zahan, T. Zimmermann, P. Godefroid, B. Murphy, C. Maddila, and L. Williams, “What are weak links in the npm supply chain?” in Proceedings of the 44th International Conference on Software Engineering: Software Engineering in Practice, 2022, pp. 331–340.
[31] Y. Liu, Z. Chen, Y. Zhang, G. Deng, Y. Li, J. Ning, and L. Y. Zhang, ““Do Not Mention This to the User”: Detecting and Understanding Malicious Agent Skills in the Wild,” in 35th USENIX Security Symposium (USENIX Security 26). Baltimore, MD: USENIX Association, Aug. 2026. [Online]. Available: https://www.usenix.org/conference/usenixsecurity26/presentation/liu-yi
[32] Tree-sitter, “tree-sitter,” 2026. [Online]. Available: https://github.com/tree-sitter/tree-sitter
[33] NVIDIA, “Skillspector,” 2026. [Online]. Available: https://github.com/nvidia/skillspector
[34] Tencent, “AI-Infra-Guard,” 2026. [Online]. Available: https://github.com/Tencent/AI-Infra-Guard
[35] Cisco AI Defense, “Cisco skill scanner,” 2026. [Online]. Available: https://github.com/cisco-ai-defense/skill-scanner
[36] Snyk, “Agent scan,” 2026. [Online]. Available: https://github.com/snyk/agent-scan
[37] Z. Chen, Y. Zhang, Y. Liu, G. Deng, Y. Li, Y. Zhang, J. Ning, L. Y. Zhang, L. Ma, and Z. Li, “How your credentials are leaked by LLM agent skills: An empirical study,” in 41st IEEE/ACM International Conference on Automated Software Engineering (ASE), 2026, to appear.
[38] OpenClaw, “ClawHub HTTP API,” 2026. [Online]. Available: https://docs.openclaw.ai/clawhub/http-api
[39] R. Duan, O. Alrawi, R. P. Kasturi, R. Elder, B. Saltaformaggio, and W. Lee, “Towards measuring supply chain attacks on package managers for interpreted languages,” in Proceedings of the Network and Distributed System Security Symposium (NDSS), 2021.
[40] K. Greshake, S. Abdelnabi, S. Mishra, C. Endres, T. Holz, and M. Fritz, “Not what you’ve signed up for: Compromising real-world llm-integrated applications with indirect prompt injection,” in Proceedings of the 16th ACM workshop on artificial intelligence and security, 2023, pp. 79–90.
[41] A. Zou, Z. Wang, N. Carlini, M. Nasr, J. Z. Kolter, and M. Fredrikson, "Universal and transferable adversarial attacks on aligned language models," arXiv preprint arXiv:2307.15043, 2023.
[42] Y. Liu, G. Deng, Y. Li, K. Wang, Z. Wang, X. Wang, T. Zhang, Y. Liu, H. Wang, Y. Zheng et al., “Prompt injection attack against llm-integrated applications,” arXiv preprint arXiv:2306.05499, 2023.
[43] R. Xu and Y. Yan, “Agent skills for large language models: Architecture, acquisition, security, and the path forward,” arXiv preprint arXiv:2602.12430, 2026.
[44] Z. Li, J. Wu, X. Ling, X. Cui, and T. Luo, “Towards secure agent skills: Architecture, threat taxonomy, and security analysis,” arXiv preprint arXiv:2604.02837, 2026.
[45] Y. Jiang, D. Li, H. Deng, B. Ma, X. Wang, Q. Wang, and G. Yu, "SoK: Agentic Skills—Beyond Tool Use in LLM Agents," arXiv preprint arXiv:2602.20867, 2026.
[46] G. Tie, J. Shi, P. Zhou, and L. Sun, “Badskill: Backdoor attacks on agent skills via model-in-skill poisoning,” arXiv preprint arXiv:2604.09378, 2026.
[47] Y. Liu, W. Wang, R. Feng, Y. Zhang, G. Xu, G. Deng, Y. Li, and L. Zhang, “Agent skills in the wild: An empirical study of security vulnerabilities at scale,” arXiv preprint arXiv:2601.10338, 2026.
[48] P. Wang, Y. Liu, Y. Lu, Y. Cai, H. Chen, Q. Yang, J. Zhang, J. Hong, and Y. Wu, “AgentArmor: Enforcing program analysis on agent runtime trace to defend against prompt injection,” arXiv preprint arXiv:2508.01249, 2025.
[49] J. Zhu, L. Zhang, W. Guo, and Y. Liu, “SkillClone: Multi-modal clone detection and clone propagation analysis in the agent skill ecosystem,” arXiv preprint arXiv:2603.22447, 2026.
[50] F. Holzbauer, D. Schmidt, G. Gegenhuber, S. Schrittwieser, and J. Ullrich, “Malicious or not: Adding repository context to agent skill classification,” arXiv preprint arXiv:2603.16572, 2026.
[51] Semgrep, “Docs home — semgrep,” 2026. [Online]. Available: https://semgrep.dev/docs/
[52] GitHub, “CodeQL,” 2026. [Online]. Available: https://codeql.github.com/
[53] F. Yamaguchi, N. Golde, D. Arp, and K. Rieck, “Modeling and discovering vulnerabilities with code property graphs,” in 2014 IEEE symposium on security and privacy. IEEE, 2014, pp. 590–604.
[54] S. Arzt, S. Rasthofer, C. Fritz, E. Bodden, A. Bartel, J. Klein, Y. Le Traon, D. Octeau, and P. McDaniel, “FlowDroid: Precise context, flow, field, object-sensitive and lifecycle-aware taint analysis for android apps,” ACM sigplan notices, vol. 49, no. 6, pp. 259–269, 2014.
[55] E. J. Schwartz, T. Avgerinos, and D. Brumley, “All you ever wanted to know about dynamic taint analysis and forward symbolic execution (but might have been afraid to ask),” in 2010 IEEE symposium on Security and privacy. IEEE, 2010, pp. 317–331.
[56] A. Sabelfeld and A. C. Myers, “Language-based information-flow security,” IEEE Journal on selected areas in communications, vol. 21, no. 1, pp. 5–19, 2003.
[57] D. E. Denning, “A lattice model of secure information flow,” Communications of the ACM, vol. 19, no. 5, pp. 236–243, 1976.
[58] A. C. Myers and B. Liskov, “A decentralized model for information flow control,” ACM SIGOPS Operating Systems Review, vol. 31, no. 5, pp. 129–142, 1997.
[59] T. Reps, S. Horwitz, and M. Sagiv, “Precise interprocedural dataflow analysis via graph reachability,” in Proceedings of the 22nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, 1995, pp. 49–61.
[60] M. Sagiv, T. Reps, and S. Horwitz, “Precise interprocedural dataflow analysis with applications to constant propagation,” Theoretical Computer Science, vol. 167, no. 1-2, pp. 131–170, 1996.
[61] W. Enck, P. Gilbert, S. Han, V. Tendulkar, B.-G. Chun, L. P. Cox, J. Jung, P. McDaniel, and A. N. Sheth, “TaintDroid: an information-flow tracking system for realtime privacy monitoring on smartphones,” ACM Transactions on Computer Systems (TOCS), vol. 32, no. 2, pp. 1–29, 2014.
[62] M. I. Gordon, D. Kim, J. Perkins, L. Gilham, N. Nguyen, and M. Rinard, "Information-flow analysis of android applications in DroidSafe," in Proceedings of the Network and Distributed System Security Symposium (NDSS), 2015.
[63] X. V. Lin, C. Wang, L. Zettlemoyer, and M. D. Ernst, “NL2Bash: A corpus and semantic parser for natural language interface to the linux operating system,” in Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018),
N. Calzolari, K. Choukri, C. Cieri, T. Declerck, S. Goggi, K. Hasida, H. Isahara, B. Maegaard, J. Mariani, H. Mazo, A. Moreno, J. Odijk, S. Piperidis, and T. Tokunaga, Eds. Miyazaki, Japan: European Language Resources Association (ELRA), May 2018. [Online]. Available: https://aclanthology.org/L18-1491/
[64] W. Ying, Y. Liu, X. Zhao, W. Cheng, Z. Chen, W. Yu, Y. Fu, and H. Chen, “Multi-agent procedural graph extraction with structural and logical refinement,” in Findings of the Association for Computational Linguistics: EACL 2026, V. Demberg, K. Inui, and L. Marquez, Eds. Rabat, Morocco: Association for Computational Linguistics, Mar. 2026, pp. 3021–3034. [Online]. Available: https://aclanthology.org/2026.findings-eacl.158/
[65] C. Yang, R. Xu, R. Li, B. Cao, and J. Fan, “Business as rulesual: A benchmark and framework for business rule flow modeling with LLMs,” in Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). San Diego, California, United States: Association for Computational Linguistics, Jul. 2026, pp. 35198–35220. [Online]. Available: https://aclanthology.org/2026.acl-long.1625/
[66] G. A. Kildall, “A unified approach to global program optimization,” in Proceedings of the 1st annual ACM SIGACT-SIGPLAN symposium on Principles of programming languages, 1973, pp. 194–206.
APPENDIX
A. Generative AI Usage
We used GPT-5.4 for minor linguistic refinements, including grammar correction and improvements to expression clarity. We also used Claude Code to assist with implementing parts of the experimental codebase and related analysis scripts. All AI-assisted code, experimental outputs, and summarized results were manually reviewed by the authors. We validated the correctness of the implementation and results through code inspection, repeated experiment execution, and consistency checks on the generated data and reported conclusions.
B. Open Science
All artifacts associated with this paper are available at the following anonymous repository:
https://anonymous.4open.science/r/scs-F00A
The repository includes:
• Implementation: The implementation of SCS, including the NL-to-IR compilation pipeline, xPDG construction, TSC property propagation, and security-rule evaluation.
• Evaluation Artifacts: The datasets, experimental configurations, and results used in the evaluation, including the benchmark comparison, NL-to-IR compilation evaluation, and real-world auditing analysis.
C. Node and Edge Types in xPDG
Table V summarizes the node and edge types used in xPDG. The node types represent the hierarchical and executable units of a skill, including skills, functions, statements, parameter and return interfaces, and control predicates. The edge types capture both intra-domain program dependencies and cross-domain connections, including containment, invocation, data flow, parameter binding, return binding, and control dependence. Together, these elements allow xPDG to preserve the program structure within each domain while explicitly connecting data and control dependencies between natural-language instructions and bundled code.
TABLE V NODE AND EDGE TYPES IN xPDG.
| Kind | Type | Description |
|---|---|---|
| Node | SKILL | analysis root |
| FUNCTION | function unit (both domains) | |
| STMT | statement unit (both domains) | |
| ACCESS_PATH_PORT | parameter / return interface | |
| CONDITION | control predicate node | |
| Edge | CONTAINS | hierarchical inclusion |
| CALLS | invocation relation | |
| DATA_FLOW | def-use dependency | |
| PARAM_BINDING | argument to input binding | |
| RETURN_BINDING | return to caller binding | |
| CONTROL_DEP | control dependency |
D. TSC Propagation Algorithm
Algorithm 1 presents the complete fixed-point procedure used to propagate TSC security properties over the xPDG. Section IV-B describes how the output state of an individual statement is derived from its input variables, API security properties, argument-to-output transfer rules, and literal-dependent refinements. Such local transfer rules are sufficient for linear dependency chains, where each state can be computed once in dependency order.
Real-world programs, however, may contain branching structures, loops, interprocedural calls, and other cyclic dependencies. In these cases, a state update at one node may affect statements that have already been processed, and states arriving through multiple predecessors must be conservatively combined. SCS therefore applies a Kildall-style worklist algorithm [66] to perform global propagation over the xPDG. The complete worklist-based propagation procedure is presented in Algorithm 1.
The algorithm initializes every variable to the lattice bottom and processes statements in reverse postorder. For each statement, it applies the transfer rules defined in Section IV-B to compute the state of its output variable. Whenever an output state changes, all dependent statements connected through def-use, parameter-binding, return-binding, or other xPDG dependency edges are re-enqueued for further processing. This allows newly derived security information to propagate through both intra-domain and cross-domain dependencies.
The procedure continues until no variable state changes. Because the TSC domain is finite and every transfer operation is monotonic, each state can only move upward in the lattice, and the analysis is guaranteed to terminate at a fixed point. The resulting states therefore conservatively summarize all security information propagated through the xPDG.
E. Limited IR API Security Properties
This section summarizes the default TSC security properties assigned to the limited IR APIs. Each API is assigned base Trust and Sensitivity properties for its return value, together with the intrinsic Capability introduced by the API invocation. These properties serve as the initial inputs to the propagation
Algorithm 1: TSC Security Property Propagation
Input: xPDG ; API properties
Output: fixed-point variable states
1 foreach variable in do 2 | ; 3 end 4 ; 5 worklist ReversePostorder(); 6 while worklist do 7 worklist.dequeue(); 8 InvokedAPI(); 9 if or HasOutput() then 10 | continue; 11 end 12 ; 13 if then 14 foreach do 15 BindArgument(); 16 if is a variable then 17 ; 18 end 19 end 20 else 21 foreach InputVars() do 22 ; 23 end 24 end 25 ; 26 foreach do 27 if .condition() then 28 .adjust(); 29 end 30 end 31 OutputVar(); 32 ; 33 if then 34 ; 35 foreach Dependents() do 36 if worklist then 37 worklist.enqueue(); 38 end 39 end 40 end 41 end 42 return ;
procedure described in Section D; they may be further refined by argument-to-output transfer rules and literal-dependent conditions.
Table VI presents the complete security properties of the limited IR APIs. SCS additionally defines security properties for the supported Python, JavaScript, and Shell functions used in Code-PDG construction. Due to space limitations, the com-plete language-specific function lists and their corresponding TSC properties are provided in our publicly available artifact described in Appendix B.
F. NL-to-IR Gold-Set Annotation
- Sample Construction and Dataset Characteristics: We construct a manually annotated gold set containing 400 natural-language instruction steps for evaluating the NL-to-IR compilation capability of SCS. We randomly select 400 distinct skills from the collected ClawHub corpus and then randomly choose one non-empty instruction step from each skill. This procedure yields 400 instruction steps from 400 distinct skills, ensuring that no skill contributes more than one sample.
Table VII summarizes the distribution of the resulting gold-set samples.
The collected instructions span diverse linguistic forms and document structures. As shown in Table VII, the gold set includes list items, code blocks, headings, inline code, ordinary paragraphs, and both single- and multi-operation instruction spans.
The instruction length ranges from 25 to 476 characters, with a median of 78.5 characters and an average of 97.5 characters. Most samples are relatively concise, supporting clear step-level annotation, while the longer samples retain more complex operations and contextual information.
The sampled instructions also cover nine behavioral categories, including execution, file access, network communication, package management, environment operations, cross-skill invocation, input handling, data transformation, and non-operational cases. Together, these characteristics provide a diverse test set for evaluating whether NL-to-IR compilation preserves operations, concrete arguments, and data dependencies across different forms of natural-language instructions.
- Annotation Contract: Each instruction unit is annotated using five properties that describe the semantic requirements of NL-to-IR compilation:
-
must_call: required IR API invocations. Each element represents a required API group, allowing equivalent alternatives when applicable;
-
must_not_call: prohibited API invocations unsupported by the instruction;
-
must_ground: concrete literals that must be preserved, including URLs, paths, commands, or identifiers;
-
must_thread: required producer-consumer dependencies between operations;
-
must_abstain: whether the instruction should not generate executable IR actions.
The final annotation set covers all five properties. These labels constrain the required semantics while allowing different but semantically equivalent IR implementations.
- Annotation Example: Consider the following instruction:
First read the Timezone: field from USER.md, and then extract the corresponding value.
The instruction requires reading the specified file and extracting the corresponding field from the retrieved content. Its gold annotation is:
{ "must_call": [ ["read_file"], ["extract"] ], "must_not_call": [ "bash", "http_get", "http_post", "write_file" ], "must_ground": [ "USER.md", "Timezone:" ], "must_thread": [ { "from": ["read_file"], "to": ["extract"] } ], "must_abstain": false }
This annotation requires the compiler to generate both operations, preserve the referenced file name and field identifier, and maintain the dependency between the file-reading and extraction steps. The annotation specifies the required semantic constraints without prescribing a specific IR program or variable naming strategy.
- Annotation Procedure and Criteria: Two annotators independently label every sampled instruction using the same annotation guideline. They are shown only the instruction and its surrounding context and remain blind to compiler outputs, model predictions, and each other's annotations.
Before labeling the complete sample, the annotators first annotate a shared calibration set and use disagreements to refine the guideline. After independent annotation, Cohen's is calculated for each property. Remaining disagreements are resolved through a third annotator to produce the final gold labels.
Annotators record only behaviors explicitly supported by the instruction itself. An API is required only when the corresponding operation is expressed in the text. Literals are recorded only when they are supported by the instruction or its provided context, and producer-consumer dependencies are labeled only when the instruction states or clearly implies that one operation uses the result of another.
Descriptive prose, headings, and documentation-only references are labeled as abstention cases when they do not specify executable behavior. If a property admits multiple reasonable interpretations during independent annotation, the annotators record the ambiguity rather than forcing a speculative label.
G. Dynamic Validation of Real-World Findings
To validate the malicious behaviors identified during the real-world study, we develop an auxiliary dynamic validation procedure. This procedure is not part of the primary detection pipeline of SCS; instead, it is used to collect runtime evidence for statically identified candidate skills. Its purpose is to
TABLE VI DEFAULT TSC SECURITY PROPERTIES OF THE LIMITED IR API SET
| Category | API Functions and Parameters | Trust | Sensitivity | Capability |
|---|---|---|---|---|
| File System | read_file(path) | PROVISIONED | PUBLIC | READ |
| glob(pattern) | PROVISIONED | PUBLIC | READ | |
| search(pattern, path) | PROVISIONED | PUBLIC | READ | |
| write_file(path, content) | - | - | WRITE | |
| edit_file(path, content) | - | - | WRITE | |
| Execution | bash(cmd, *args) | TRUSTED | PUBLIC | EXEC |
| run_script(path, *args) | TRUSTED | PUBLIC | EXEC | |
| Network | http_get(url) | PROVISIONED | PUBLIC | NETWORK |
| http_post(url, *payloads) | PROVISIONED | PUBLIC | NETWORK | |
| send_email(to, subject, body) | - | - | NETWORK | |
| scp(dest, payload) | - | - | NETWORK | |
| sftp(dest, payload) | - | - | NETWORK | |
| rsync(dest, payload) | - | - | NETWORK | |
| ssh(dest, payload) | - | - | NETWORK | |
| nc(dest, payload) | - | - | NETWORK | |
| ncat(dest, payload) | - | - | NETWORK | |
| Environment | get_env(name) | DERIVED | INTERNAL | ENV |
| set_env(name, value) | - | - | ENV | |
| Package Management | install_package(manager, package) | - | - | INSTALL |
| Data Transformation | encode(data, encoding) | TRUSTED | PUBLIC | - |
| decode(data, encoding) | TRUSTED | PUBLIC | - | |
| parse_json(text) | TRUSTED | PUBLIC | - | |
| extract(data, pattern) | TRUSTED | PUBLIC | - | |
| Cross-Skill | invoke_tool(name, **kwargs) | UNTRUSTED | INTERNAL | ELEVATE |
| import_skill(name) | UNTRUSTED | INTERNAL | ELEVATE | |
| tool_arg() | UNTRUSTED | SECRET | - | |
| User Input | user_input(prompt) | TRUSTED | INTERNAL | - |
| Agent Control | attempt_policy_override(nl) | - | - | CONTROL_OVERRIDE |
Note: Trust and Sensitivity report the API base state before input-state propagation and conditional state increases. For APIs without a return value, these two entries are denoted by “-”. In the Capability column, “-” indicates that the API introduces no intrinsic capability.
determine whether a suspicious behavior can be reproduced in a controlled environment, rather than to replace the static analysis or independently classify all skills. A candidate skill may contain one or more static findings. Accordingly, while RQ3 reports results at the skill level, dynamic validation operates at the finding level over individual evidence paths.
- Validation Workflow: The dynamic validation procedure takes as input a skill package, the corresponding static findings, and the source and sink locations identified by SCS. Each skill is installed and exercised inside a disposable sandbox that contains a synthetic user environment, controlled tools, and nonfunctional canary credentials. No real user data, host credentials, or cloud permissions are exposed to the analyzed skill.
Unlike conventional package sandboxes that only execute explicit entry points, the validation environment includes an instrumented agent that loads and uses the skill through its intended activation mechanism. This is necessary because security-relevant behavior may be triggered by natural-language instructions in SKILL.md, rather than by directly executing a bundled script. When a skill also contains executable components, the procedure may additionally invoke its installation scripts or identified program entry points.
The overall workflow is as follows:
• SCS provides the suspicious source, sink, and cross-domain evidence path identified during static analysis.
• A validation task is constructed to exercise the skill in a realistic usage context related to the static finding.
• The skill and the agent are executed inside an isolated, short-lived sandbox containing synthetic files and canary values.
• Runtime file, process, tool-call, and network events are collected and correlated with the original static finding.
• Deterministic validation rules classify the finding as confirmed, refuted, or inconclusive.
- Static-Guided Skill Execution: Dynamic execution is guided by the results of the static analysis. For each candidate finding, the validation procedure uses the declared skill functionality, relevant instructions in SKILL.md, and the source-to-sink path reported by SCS to construct one or more triggering tasks. The tasks are phrased as ordinary user requests rather than explicit attack instructions.
TABLE VII DISTRIBUTION OF THE NL-TO-IR GOLD-SET SAMPLES.
| Dimension | Stratum | Steps |
|---|---|---|
| Language | English | 274 |
| Chinese or mixed Chinese-English | 115 | |
| Other languages | 11 | |
| Construct | List item | 134 |
| Multi-operation span | 56 | |
| Code block | 48 | |
| Heading | 44 | |
| Single-operation span | 44 | |
| Non-operational prose | 38 | |
| Inline code | 21 | |
| Ordinary paragraph | 15 | |
| Instruction length | 25–50 characters | 107 |
| 51–100 characters | 150 | |
| 101–180 characters | 98 | |
| 181–280 characters | 37 | |
| More than 280 characters | 8 |
For example, if static analysis reports that a skill may read an SSH private key and send its content to an external endpoint, the validation environment may ask the agent to perform a legitimate private-repository task according to the skill's documented instructions. A synthetic SSH key containing a unique canary value is placed at the expected location. If the skill reads this file and the canary subsequently appears in an outbound request, the execution provides direct evidence supporting the static finding.
The triggering task may be generated from predefined templates or with LLM assistance. However, task generation is used only to improve path coverage. Neither the triggering model nor the executing agent is allowed to determine whether the skill is malicious.
- Isolation and Runtime Evidence: Each validation run is performed in a disposable isolated environment with bounded CPU, memory, process, network, and execution time. The skill is provided with a synthetic home directory and workspace containing nonfunctional credential files, environment variables, and project artifacts. Each sensitive canary is unique to one validation run, allowing any observed use or disclosure to be attributed to a specific skill and execution.
The environment records evidence at multiple levels:
• Agent and tool events, including skill activation, tool invocations, normalized arguments, and execution outcomes;
• Language and process events, including script execution, subprocess creation, file access, environment access, and dynamically loaded components;
• Network events, including DNS queries, connection destinations, HTTP metadata, and request content when available.
Events generated by the analyzed skill are distinguished from sandbox initialization and agent-runtime activity. The collected events are associated with the validation task and the corresponding static finding, enabling the runtime behavior to be compared with the source, sink, and dependency path reported by SCS.
- Validation Decisions: The final validation result is derived from runtime events and predefined rules, rather than from the natural-language judgment of the agent or an LLM. We use the following three outcomes:
• Confirmed: the suspicious operation is reached and runtime evidence supports the security consequence identified by the static finding. Examples include a canary secret appearing in an outbound request, execution of a downloaded payload, or an unauthorized modification of a protected artifact.
• Refuted: the relevant static location is successfully exercised under complete monitoring, but the predicted security consequence is not observed.
• Inconclusive: the suspicious location is not reached, the agent refuses or fails to activate the skill, the execution times out, monitoring is incomplete, or the observed evidence is insufficient to support either confirmation or refutation.
Failure to reproduce a behavior is not treated as evidence that the skill is benign. In particular, a finding cannot be marked as refuted unless the corresponding operation is demonstrably reached under a successful and sufficiently monitored execution. This coverage-aware design prevents agent refusal, conditional triggers, and incomplete sandbox execution from being incorrectly interpreted as negative evidence.
The dynamic result is finally linked back to the original SCS finding and used together with manual inspection when confirming malicious skills in the real-world study.