
Malicious Skills & Supply Chain Risks in Coding Agents
Datadog Security Labs analyzes how Claude Code's dynamic context feature (the `!` shell-execution syntax in skill frontmatter) runs commands during preprocessing, before the rendered skill content ever reaches the model — meaning model-level prompt injection defenses never get a chance to block malicious actions. They demonstrate this with Clawsights, a malicious skill found in the wild that exfiltrates GitHub auth tokens via `gh auth token` and a curl POST; while Claude Opus 4.6 refused to run the skill when read as plain instructions, a version rewritten to use `!` dynamic context commands executed the credential theft during preprocessing even though the model later claimed (falsely) it hadn't run anything. The post explains Claude Code's multiple skill-loading paths (enterprise, personal, project .claude/skills/, plugins, nested folders, --add-dir) and gives grep-based detection patterns plus a `disableSkillShellExecution` mitigation.
What to do
The page gives four concrete detection queries the summary references but does not reproduce. Run these against skill directories — and critically, not just ~/.claude/skills/ but the repository root, nested project folders, plugin skills, and any --add-dir locations:
# Search for dangerous dynamic context injection
grep -rE '!`.*curl|!`.*wget|!`.*nc |!`.*bash|!`.*cat.*env|!`.*find.*secret|!`.*grep.*password' .claude/skills/# Find skills requesting broad shell access
grep -rE 'allowed-tools:.*Bash\(\*\)' .claude/skills/# Identify skills that fetch remote content
grep -rE 'https?://[^)]*\.(com|io|zone|dev|cloud|net)' .claude/skills/ | grep -v '^\s*#'# Detect potential credential exfiltration
grep -rE '(os\.environ|getenv|process\.env|printenv|\$AWS_|\.ssh/)' .claude/skills/The frontmatter clause that makes the dynamic-context attack self-arming is allowed-tools: Bash(*), which preapproves Bash while the skill is active, so the ! preprocessing commands fire without an approval prompt.
A finding the summary does not carry
The summary frames model refusal as the reassuring baseline (Opus 4.6 caught the plain-text Clawsights skill). The page adds a materially worse observation: in later tests with Opus 4.7, using the same modified Clawsights skill and a controlled destination, Claude Code ran the skill and did not identify the credential theft at all — no dynamic-context trick required. Datadog saw this "consistently" across runs. So the plain-instruction defense the summary leans on is not reliable across model versions; the ! bypass is one path, but direct execution is another.
Caveats
Datadog labels the Opus 4.7 result an "implementation observation rather than a guarantee about any model version." The grep patterns are "starting points, not complete detections" — payloads can hide behind aliases, wrapper scripts, encoding, or less-obvious CLI tools, and a clean result is only one piece of evidence.
Technologies named here
Techniques named here
- Prompt injection via malicious agent skills
- Dynamic context shell execution bypassing model review
- Credential exfiltration via CLI and curl
- Broad tool preapproval via allowed-tools frontmatter
- Nested/added-directory skill loading
Threat actors named here
- Clawsights
Related in AI Security
