Skip to content

feat(analyzer): implement MCP rug-pull detection (RP1-RP3)#125

Open
tcconnally wants to merge 1 commit into
NVIDIA:mainfrom
tcconnally:feat/mcp-rug-pull-analyzer
Open

feat(analyzer): implement MCP rug-pull detection (RP1-RP3)#125
tcconnally wants to merge 1 commit into
NVIDIA:mainfrom
tcconnally:feat/mcp-rug-pull-analyzer

Conversation

@tcconnally

Copy link
Copy Markdown

Summary

Implements the MCP rug-pull analyzer that was previously a TODO stub (mcp_rug_pull.py — SADD B.3.3). Adds three detection rules for supply-chain rug-pull risks in agent skills.

New Detection Rules

RP1: Unpinned MCP Server References (MEDIUM)

Detects MCP server/package references without version pinning:

  • npx @scope/server (no @version)
  • uvx package-name (no ==version)
  • pip install mcp-server (no ==version)
  • docker run org/image (no :tag or @sha256:)

Uses a two-step approach: find command references, then check line context for version pinning indicators. This avoids the backtracking false positives that simpler regex-only approaches produce.

RP2: Permission Pre-Staging (LOW)

Detects manifest language suggesting future permission/capability expansion — a common pre-staging tactic for rug-pull attacks.

RP3: Version Unpinned (LOW)

Detects wildcard (*, latest, any) or broad (>=, ^) version constraints in manifest metadata that allow silent major-version updates.

Testing

  • 8 new unit tests covering all three rules (detection, false-positive avoidance, empty state)
  • All 629 existing tests pass
  • Test file: tests/test_mcp_rug_pull.py

Design Notes

  • RP1 uses two-step detection (find + verify) rather than single-regex, avoiding the backtracking issues that cause regex-based version-pin detection to produce false positives on compound names like @scope/mcp-server@1.2.3.
  • RP2 is intentionally low-confidence (0.60-0.70) — permission pre-staging language is an indicator, not definitive proof.
  • RP3 reads the version key directly from manifest dict rather than regex on str() output, which is more robust against different dict serialization formats.

Replaces the mcp_rug_pull analyzer stub with full RP1-RP3 detection.

RP1: Unpinned MCP server references — detects npx, uvx, pip install,
and docker commands that reference MCP servers/packages without
version pinning (@Version, ==version, :tag, @sha256:).

RP2: Permission pre-staging — detects manifest language suggesting
future permission/capability expansion (rug-pull pre-staging).

RP3: Version unpinned — detects wildcard/broad version constraints
in manifest version field allowing silent major-version updates.

Includes 8 unit tests covering all three rules.

Previously tracked as TODO(SADD B.3.3) stub.

Signed-off-by: Perseus Computing <51974392+tcconnally@users.noreply.github.com>
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