feat(analyzer): detect skills snooping on the agent ecosystem (other skills, MCP config, agent memory)#77
Open
CharmingGroot wants to merge 1 commit into
Conversation
A skill that reads other parts of the agent ecosystem — agent config/home dirs, MCP server configuration, or another installed skill's files — was not flagged by any analyzer. E3 matches generic credential paths (~/.ssh, ~/.aws) but agent-specific paths slipped through entirely. Add a `static_patterns_agent_snooping` analyzer: AS1 (agent config/home dirs like ~/.claude, ~/.codex), AS2 (MCP config such as .mcp.json), AS3 (reading another skill's SKILL.md). Adds an "Agent Ecosystem Snooping" category. The analyzer de-duplicates matches per (rule, line) to avoid duplicate findings. Add tests for detection, same-line de-duplication, a false-positive guard (ordinary project file access), and the node entrypoint. Signed-off-by: CharmingGroot <ohyes9711@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_snoopinganalyzer under a new "Agent Ecosystem Snooping" category:~/.claude/,~/.codex/,~/.gemini/,~/.cursor/) where API keys and settings live — HIGH.mcp.json,mcp_servers) which holds server tokens/endpoints — HIGHskills/*/SKILL.md) — MEDIUMWhy 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, orbehavioral_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/andruff format --check src/ tests/pass.pytest -m 'not integration'passes (606 passed, 11 skipped).static_patterns_agent_snoopingat 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.