Skip to content

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

Open
mimran-khan wants to merge 1 commit into
NVIDIA:mainfrom
mimran-khan:feat/mcp-rug-pull-detection
Open

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

Conversation

@mimran-khan

Copy link
Copy Markdown
Contributor

Summary

The mcp_rug_pull analyzer was a non-functional stub that unconditionally returned empty findings — indistinguishable from "checked and found nothing" in scan output. This gave users a false sense of security when scanning MCP-enabled skills.

This PR implements actual rug-pull detection with two analysis modes:

Manifest Comparison (when previous_manifest is supplied)

Rule Detection Severity
RP1 New parameters added to tools HIGH
RP2 Tool/skill description changed MEDIUM
RP3 Parameters removed from tools MEDIUM

Static Risk Analysis (always runs)

Rule Detection Severity
RP1 Wildcard (*) permissions HIGH
RP2 Dynamic tool loading patterns (fetch_tools, runtime discovery) MEDIUM

Key Behavior Changes

  1. No more silent no-ops: When previous_manifest is unavailable, the analyzer now logs a WARNING instead of silently producing "0 findings"
  2. Actual detection: Identifies concrete rug-pull risk indicators
  3. Actionable findings: Each finding includes specific remediation guidance

How Rug-Pull Detection Works

First scan:   manifest A → stored as baseline
Second scan:  manifest B → compared against A
                          → RP1 if new params added (data capture)
                          → RP2 if descriptions changed (prompt injection)
                          → RP3 if params removed (behavior divergence)

Static analysis runs on every scan regardless, catching:

  • Overly broad permissions that amplify rug-pull impact
  • Dynamic tool loading that makes definitions unpredictable between scans

Testing

15 new tests covering:

  • RP1: New parameter detection
  • RP2: Description change detection
  • RP3: Parameter removal detection
  • No-change produces no findings
  • Empty manifests handled gracefully
  • Wildcard permission flagged
  • Specific permissions pass
  • Dynamic loading patterns caught
  • Normal code not flagged
  • Node integration with/without previous_manifest
  • Warning logged when comparison unavailable

Fixes #150

Replaces the non-functional stub with a real analyzer that detects
MCP rug-pull attack indicators:

Manifest comparison (when previous_manifest available):
- RP1: New parameters added (potential data capture)
- RP2: Description changed (potential prompt injection via description)
- RP3: Parameters removed (behavior divergence)

Static risk analysis (always runs):
- RP1: Wildcard permissions that amplify rug-pull impact
- RP2: Dynamic tool loading patterns (fetch_tools, runtime discovery)

Key behavior changes:
- Logs WARNING when previous_manifest unavailable (was silently returning
  "0 findings" indistinguishable from "checked and found nothing")
- Actually detects rug-pull indicators instead of being a no-op
- Returns actionable findings with remediations

Fixes NVIDIA#150
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.

[Bug] MCP rug-pull analyzer is a non-functional stub that creates false sense of security

1 participant