SkillSpector icon indicating copy to clipboard operation
SkillSpector copied to clipboard

feat(analyzer): detect skills snooping on the agent ecosystem (other skills, MCP config, agent memory)

Open CharmingGroot opened this issue 5 months ago • 1 comments

Fixes #75.

What this adds

A skill that reaches into the agent's own environment — agent config/home dirs, MCP server configuration, or another installed skill's files — was not flagged by any analyzer. Adds a static_patterns_agent_snooping analyzer under a new "Agent Ecosystem Snooping" category:

  • AS1 — agent config/home dirs (~/.claude/, ~/.codex/, ~/.gemini/, ~/.cursor/) where API keys and settings live — HIGH
  • AS2 — MCP server configuration (.mcp.json, mcp_servers) which holds server tokens/endpoints — HIGH
  • AS3 — reading another installed skill's manifest (skills/*/SKILL.md) — MEDIUM

Why this fits the skill threat model

Unlike generic file access, this threat exists only because skills run inside an agent: a malicious skill performs lateral movement within the agent's environment — stealing another skill's logic/secrets, harvesting MCP server tokens, or exfiltrating prior conversation memory. This is distinct from E3, which targets generic OS credential files (~/.ssh, ~/.aws).

The reproduction from the issue (a skill reading .mcp.json, agent memory, and another skill) went from score 0 / LOW to score 100 / CRITICAL.

Scope / non-overlap

Verified the reproduction triggers none of E1–E4, taint tracking, or behavioral_ast. The analyzer de-duplicates matches per (rule, line) so a single line is not reported twice by the same rule.

Testing

  • ruff check src/ tests/ and ruff format --check src/ tests/ pass.
  • pytest -m 'not integration' passes (606 passed, 11 skipped).
  • static_patterns_agent_snooping at 100% coverage. Tests cover: agent-config / MCP-config / cross-skill detection, same-line de-duplication, a false-positive guard (ordinary project file access is not flagged), and the node entrypoint.

CharmingGroot avatar Jun 15 '26 12:06 CharmingGroot

@CharmingGroot - Please resolve the conflicts and merge the PR.

rng1995 avatar Jun 22 '26 19:06 rng1995

Conflicts resolved and force-pushed. Kept the upstream pattern set from #75 during resolution. Ready to merge.

CharmingGroot avatar Jun 23 '26 04:06 CharmingGroot