SkillJect: Automating Stealthy Skill-Based Prompt Injection for Coding Agents with Trace-Driven Closed-Loop Refinement

Xiaojun Jia, Jie Liao, Simeng Qin, Jindong Gu, Wenqi Ren, Xiaochun Cao, Yang Liu, Philip Torr

TL;DR

SkillJect is the first automated, closed-loop prompt injection framework targeting coding agent skills (modular bundles like Anthropic’s Agent Skills). By decoupling malicious logic into auxiliary scripts and iteratively optimizing innocent-looking "inducement" prompts—or embedding instructions inside images—it circumvents LLM safety guardrails to achieve an average attack success rate of 95.1% (and up to 100% with visual payloads).

What Problem Does This Paper Address?

Modern coding agents (e.g., Claude Code, OpenAI Codex CLI) increasingly rely on agent skills: modular capability bundles consisting of a natural-language guide (SKILL.md) and executable scripts (.py, .sh) loaded on demand. Because these skills are shared via open registries, they create a dangerous new attack surface: skill-based prompt injection.

Prior prompt injection attacks typically relied on hand-crafted or naive direct prompts (e.g., embedding raw exfiltration commands like curl secret.txt into documentation). However, modern aligned LLMs easily recognize and reject explicit harmful directives. The challenge is: Can an attacker systematically and automatically craft stealthy, context-compliant skills that deceive sophisticated code agents into executing unauthorized operations without triggering safety filters?

Methods

SkillJect automates skill poisoning via a closed-loop multi-agent architecture:

[Attack Agent] ──(Poisoned Skill: SKILL.md + Helper Script)──> [Code Agent (Victim)]
      ▲                                                                │
      │                                                                ▼
      └───────── (Diagnostic Feedback) ─────────── [Evaluate Agent (Trace Verifier)]
  • Malicious Payload Hiding Strategy: Rather than placing dangerous commands in SKILL.md, SkillJect hides the actual exploit in plausible auxiliary scripts (e.g., setup.sh or helper.py). The SKILL.md file only receives an optimized inducement prompt that naturally nudges the agent to run the script as a routine prerequisite or debugging step.
  • Constrained Generation Loop:
  • Attack Agent (GPT-3.5-Turbo): Edits SKILL.md under soft constraints ($\Omega$) enforcing semantic fidelity, structural alignment, style consistency, and minimal edits.
  • Code Agent (Claude Code): Executes the target task in a sandboxed Docker container using one of several underlying LLMs.
  • Evaluate Agent: Monitors the execution trace $\tau$, verifying whether the script was invoked and whether the malicious consequence occurred (e.g., verifying network calls or filesystem modifications). It returns structured diagnostics back to the Attack Agent for iterative prompt refinement.
  • Multimodal Variant (SkillJect-Image): Embeds explicit overriding instructions and commands inside an image asset (instruction.png) referenced by SKILL.md (e.g., framed as a workflow diagram).

Datasets

The authors curated a benchmark of 50 realistic agent skills across three domains:

  1. Data Processing (e.g., CSV parsers, JSON formatters)
  2. Development Utilities (e.g., linters, Git wrappers, environment tools)
  3. Visual Content Generation (e.g., image resizing, graph plotting)

Each skill is paired with a realistic task and workspace designed to legitimately trigger the skill. Attacks were evaluated across four high-severity threat scenarios: Information Disclosure (InfoLeak), Privilege Escalation (PrivEsc), Unauthorized Write (FileMod), and Backdoor Injection (Backdoor).

Key Insights and Ideas

  • The "Safety Paradox" of Instruction-Tuned Models: Claude-4.5-Sonnet proved the most resilient against naive direct injections (only 5.0% attack success), yet it was the most susceptible to SkillJect (97.5% success). Models heavily trained to reject direct harmful commands are paradoxically hyper-compliant with structured procedural documentation.
  • Trace-Driven Emergent Deception: The closed-loop refinement loop autonomously learns social-engineering strategies without templates, discovering tactics like structural camouflage (disguising steps under ## Prerequisites) and visual urgency (using bold > **IMPORTANT** alert blocks to suppress agent hesitation).
  • Cross-Modal Blind Spots: In SkillJect-Image, the coding agent delegates visual processing to a vision or OCR module. The primary reasoning model treats text extracted by tools as verified, trusted environment observations, bypassing standard text-prompt safety guardrails.

Key Results

Attacks were benchmarked against Claude Code powered by four backend LLMs: Claude-4.5-Sonnet, GPT-5-mini, GLM-4.7, and MiniMax-M2.1.

  • Drastic Efficacy Over Baseline: The Naive baseline averaged an attack success rate (ASR) of only 10.9% (and 0.0% across all models for InfoLeak, PrivEsc, and FileMod). SkillJect achieved an average ASR of 95.1% across models:
  • GLM-4.7: 98.5%
  • Claude-4.5-Sonnet: 97.5%
  • MiniMax-M2.1: 96.0%
  • GPT-5-mini: 88.5%
  • Refinement is Essential: In ablation tests, eliminating the iterative feedback loop dropped performance from 98.0% to 56.0% (a 42.0% drop).
  • Multimodal Perfection: Testing SkillJect-Image on GLM-4.7 achieved 100% ASR across all four threat categories.

Limitations and Future Work

  • Routing Assumption: SkillJect assumes the poisoned skill has already been retrieved/selected by the agent's routing mechanism.
  • Defensive Gaps: Current safety filters evaluate inputs in isolation. Mitigations must move toward multi-modal, end-to-end defenses—including cross-file consistency verification between documentation and scripts, behavior-level sandboxing, and runtime policy checks before executing external tool invocations.

Summary updated

BibTeX
@inproceedings{jia2026skillject,
  author = {Xiaojun Jia and Jie Liao and Simeng Qin and Jindong Gu and Wenqi Ren and Xiaochun Cao and Yang Liu and Philip Torr},
  title = {{SkillJect: Automating Stealthy Skill-Based Prompt Injection for Coding Agents with Trace-Driven Closed-Loop Refinement}},
  booktitle = {Advml @ CVPR},
  year = {2026},
  url = {https://openreview.net/forum?id=dxZVTArOxI},
}
Figure