Structured Security Auditing and Robustness Enhancement for Untrusted Agent Skills

Lijia Lv, Xuehai Tang, Jie Wen, Jizhong Han, Songlin HuarXiv 2026

TL;DR

As LLM-powered agents increasingly rely on loadable "skill packages" to extend their capabilities, they open up a dangerous new attack surface. Traditional prompt guardrails fail to secure these multi-file packages because they flatten the text, losing structural context and falling victim to semantic rewrite attacks. This paper introduces SKILLGUARD-ROBUST, a staged framework that factorizes package auditing into structured evidence extraction, selective semantic verification, and consistency repair, achieving near-perfect detection stability.

What Problem Does This Paper Address?

Modern AI agents use loadable skill packages (comprising SKILL.md files, executable scripts, reference documentation, and repository context) to perform complex tasks. However, this architectural layer allows untrusted third-party content directly into the execution chain.

An attacker can easily hide malicious intent—such as overriding system instructions, disguising unauthorized data transfers, or executing remote bootstraps—by distributing the pieces across different files. Conventional guardrails fail here because they either inspect files in isolation or flatten the entire package into a single prompt. This flat view completely misses cross-file cues and suffers from "label drift" or "suspicious/malicious collapse," where minor, semantics-preserving rewrites cause the guardrail to misclassify a clearly malicious attack as merely "suspicious" or completely benign.

Figure 1: Problem illustration. A skill guardrail must audit a cross-file package rather than a single prompt. Flattening the package into plain text easily loses struc- tured risk evidence and induces label drift under attack rewrites.

Methods

Instead of relying on a massive, expensive, end-to-end black-box LLM classifier, the authors propose SKILLGUARD-ROBUST, a modular, four-stage pipeline designed to handle structural and semantic ambiguities sequentially:

  1. Structured Evidence Extraction: Rather than flattening the package, this stage lifts each file into a role-conditioned evidence vector. It uses a "noisy-or" aggregation strategy to ensure that strong evidence in a single critical file isn't drowned out, while still accumulating weak signals dispersed across multiple files.
  2. Uncertainty Triggering and Semantic Verification: To save on computational costs, an uncertainty trigger evaluates the extracted evidence. Simple cases take a fast track, while ambiguous or borderline cases are routed to a specialized LLM semantic verifier to extract explicit chain-level judgments.
  3. Conflict-Aware Chain Arbitration: When multiple risk chains co-occur (e.g., a package exhibits both remote bootstrap and weak disguised transfer), this module applies explicit policy-based logic to determine which chain dominates the final security label.
  4. Anchor-Consistency Consolidation: This final step exploits the cluster relationship between an original risk package (the anchor) and its rewritten variants, ensuring that the final output label remains stable across surface-level text mutations.
Figure 2: Overview of SKILLGUARD-ROBUST. The architecture resolves four recurrent ambiguities in sequence: distributed cross-file evidence, localized semantic uncertainty, chain-dominance conflict, and anchor–rewrite residual disagreement. Simple samples follow a fast path of structured extraction followed by direct adjudication, whereas uncertain samples are sent to semantic verification before chain- and cluster-level repair.

Datasets

The authors introduced SKILLGUARDBENCH, a benchmark specifically designed for package-level agent skill auditing. They combined it with public-ecosystem extensions to create an expanded pool of 581 package-level samples (253 clean samples, 95 risk seeds, and 233 rewrites).

To thoroughly evaluate robustness, they structured the data into five distinct evaluation views:

  • Main (401 packages): Measures overall in-distribution performance.
  • All-HO (404 packages): An aggregate of held-out diagnostic splits.
  • Int.-stress (344 packages): Focuses on internal stress testing and public transfer cases.
  • Boundary (284 packages): Concentrates on review-heavy, borderline cases.
  • Ext.-eco (254 packages): Built entirely from unseen public skill roots to test open-source repository realism.

Key Insights and Ideas

  • Flattening is Fatal: Treating a structured, multi-file package as a single text span is the primary reason strong baselines fail. Structure recovery must happen before risk adjudication.
  • The "Collapse Gap" is Directional: State-of-the-art models like Qwen2.5-14B don't fail because they are blind to risk; they fail because they consistently downgrade "malicious" packages to "suspicious" when the text is rewritten. They act as high-quality risk finders but unstable malicious adjudicators.
  • Factorization Beats Scale: Achieving robust guardrails doesn't require ever-larger models. Decomposing the problem into local structural aggregation and targeted semantic verification yields better stability and lower token costs than an end-to-end single-shot LLM judge.

Key Results

SKILLGUARD-ROBUST significantly outperformed strong remote baselines (like Qwen2.5-14B) and structured one-shot judges (like BUNDLEJUDGE) across all evaluation views:

  • On the All-HO aggregate view, SKILLGUARD-ROBUST achieved 97.30% overall exact accuracy and 98.33% malicious recall, compared to Qwen2.5-14B's 78.17% and 55.67%.
  • On the Ext.-eco view (unseen public skill roots), it achieved an outstanding 99.66% overall exact accuracy and 100.00% attack exact consistency, proving its ability to maintain stable labels even when surface text changes drastically.
  • It effectively eliminated the "collapse gap," ensuring that malicious intent is explicitly caught rather than being diluted into a generic "suspicious" category.
Quantitative performance comparison across the five large evaluation views.

Limitations and Future Work

While highly effective, the authors note several boundaries to their current work:

  • Verifier Dependence: The framework still relies on a single strong remote LLM instance for its semantic verification stage.
  • Sanitized Data: A substantial portion of the risk samples comes from sanitized reconstructions rather than live, native malware found in the wild.
  • Subjective Boundaries: The line between "suspicious" and "malicious" remains policy-dependent and context-specific.

Future directions include exploring multi-verifier cross-checking, lower-cost local semantic verification, and expanding testing to handle mixed-language content and deeply nested repository structures.

Summary updated

BibTeX
@misc{lv2026structured,
  author = {Lijia Lv and Xuehai Tang and Jie Wen and Jizhong Han and Songlin Hu},
  title = {{Structured Security Auditing and Robustness Enhancement for Untrusted Agent Skills}},
  year = {2026},
  eprint = {2604.25109},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.25109},
}
Figure