Skip to content

feat(rules): MCP server, skill, and plugin detection#5

Open
MiguelHzBz wants to merge 2 commits intoleogr:mainfrom
MiguelHzBz:add-mcp-skill-detection-rules
Open

feat(rules): MCP server, skill, and plugin detection#5
MiguelHzBz wants to merge 2 commits intoleogr:mainfrom
MiguelHzBz:add-mcp-skill-detection-rules

Conversation

@MiguelHzBz
Copy link
Copy Markdown

Summary

Adds rules/user/mcp-skill-detection.yaml with 9 rules covering two distinct attack surfaces — MCP config structure and skill/command file content:

MCP config attacks (CRITICAL/deny) — target .mcp.json / managed-mcp.json:

  • Temp directory command path (/tmp/, /dev/shm/, /var/tmp/)
  • IOC domain in server URL (ClawHavoc campaign hosts)
  • Base64-encoded server command (obfuscation evasion)

Agent self-expansion (WARNING/ask):

  • claude mcp add/install and related self-registration commands via Bash
  • npx -y / npx --yes auto-accept installation of MCP/skill packages

Persistent backdoor vectors (WARNING/ask):

  • Write to .claude/commands/ slash command directory
  • Write CLAUDE.md outside the current working directory

Skill content attacks (CRITICAL/deny) — upgrade the catch-all ask to deny:

  • IOC domain referenced in .claude/commands/ file content
  • Pipe-to-shell pattern (| bash, | sh, bash <(, sh <() in .claude/commands/ content

IOC domains from the ClawHavoc campaign (341 malicious skills, 2024–2025): pastebin.com, transfer.sh, file.io, termbin.com, ix.io, glot.io, hastebin.com, ghostbin.co

Test plan

  • bash tests/test_mcp_skill_rules.sh — 55 test cases covering deny, ask, and allow paths for all 9 rules
  • Requires Falco 0.43+ and the built plugin/interceptor. To replicate: provision an EC2 Ubuntu 22.04 instance, follow the build instructions in the README, then run the test script directly.

Adds rules/default/mcp-skill-detection.yaml with 9 rules covering
two distinct attack surfaces:

MCP config attacks (deny): temp directory command path, IOC domain in
server URL, base64-encoded command — all targeting .mcp.json writes.

Agent self-expansion (ask): claude mcp add/install self-registration,
npx -y auto-accept installation of MCP/skill packages.

Persistent backdoor vectors (ask): writes to .claude/commands/,
CLAUDE.md written outside the working directory.

Skill content attacks (deny): IOC domain or pipe-to-shell pattern in
.claude/commands/ file content — upgrades the catch-all ask to deny
via the broker's deny > ask escalation.

IOC domains from the ClawHavoc campaign (341 malicious skills, 2024-2025):
pastebin.com, transfer.sh, file.io, termbin.com, ix.io, glot.io,
hastebin.com, ghostbin.co.

Includes test_mcp_skill_rules.sh with 55 test cases.
@MiguelHzBz MiguelHzBz force-pushed the add-mcp-skill-detection-rules branch from 47d25c7 to 6236f4f Compare April 10, 2026 10:57
- Extend is_mcp_command_temp: add $TMPDIR, $TMP, $TEMP env vars and /run/user/
  (M1: env var expansion bypass, M6: XDG runtime dir staging)
- Extend is_skill_pipe_bash: add absolute shell paths | /bin/bash, | /bin/sh,
  | /usr/bin/bash, | /usr/bin/sh (M2, M3: absolute path bypass)
- Extend is_npx_auto_accept_mcp_skill: add bunx -y, bunx --yes, yarn dlx, pnpm dlx
  (M4: alternative package runners bypass)
- Add Rule 10: Ask before Bash command writing to .claude/commands/
  (M5: Bash shell redirection bypasses Write/Edit-only Rule 5)
- Add test_mcp_bypass.sh covering all 6 bypass sections (~20 test cases)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant