How heisenbergg4/mcploit works
Purpose and CLI Entry Point
MCPloit is a Python security assessment tool for Model Context Protocol (MCP) servers. It supports live-server enumeration, passive and active scanning, exploit execution, and source-code auditing. The command dispatcher is mcploit.py, which coordinates target connection and modes such as connect, enum, scan, audit, exploit, and full-scan.
Paths: mcploit.py, core/mcp_client.py, utils/output.py
MCP Transport and Interactive Access
MCPClient is the boundary to MCP targets, handling auto-detected STDIO, SSE, and HTTP transports. It exposes MCP operations used throughout the product: discover tools/resources/prompts, call tools, read resources, and render prompts. Interactive mode wraps that client in a command shell for manual reconnaissance and custom calls.
Paths: core/mcp_client.py, core/interactive.py, core/enumerator.py
Capability Enumeration
The enumerator retrieves a target’s exposed MCP surface and normalizes it for CLI output and downstream security analysis. This is the primary reconnaissance stage and feeds tool names, schemas, resources, and prompts into scanner and exploitation workflows.
Paths: core/enumerator.py, analysis/metadata_extractor.py, analysis/report.py
Black-Box Analysis Pipeline
Live-target analysis is coordinated by analysis/engine.py. Passive scanning uses vulnerability-specific detector modules against enumerated capability metadata; optional active probing sends controlled payloads to validate suspected findings. Schema analysis and network-oriented inspection extend live assessment beyond static tool descriptions.
Paths: analysis/engine.py, modules/scanner.py, analysis/blackbox/active_prober.py, analysis/blackbox/schema_analyzer.py
Detector Architecture
Each vulnerability family is modeled as a detector behind a shared base abstraction. The scanner selects detectors for categories including prompt injection, code execution, path traversal, secret exposure, token theft, tool poisoning, and typosquatting. Findings are represented centrally for aggregation and reporting.
Paths: modules/detectors/base_detector.py, modules/detectors/prompt_injection.py, modules/detectors/code_execution.py, analysis/finding.py
White-Box Source Audit
Source auditing combines regex/SAST scanning, AST-driven MCP entry-point and data-flow inspection, and optional AI-assisted triage. AST analysis identifies likely tool functions and risky behavior; the AI reviewer sends selected code/findings to Anthropic when explicitly enabled, making the Anthropic API an external data boundary.
Paths: analysis/whitebox/sast_scanner.py, analysis/whitebox/entry_point_detector.py, analysis/whitebox/desc_vs_behavior.py, analysis/whitebox/ai_reviewer.py
Exploit and Payload Execution
The exploit engine orchestrates module-targeted attacks, selecting payloads from a categorized library and executing them through the MCP client. Base exploit and payload abstractions separate execution mechanics from payload definitions. Safety controls are enforced at the CLI/workflow level for active probing, CVE execution, and unsafe payload sets.
Paths: exploits/engine.py, exploits/base_exploit.py, payloads/manager.py, payloads/base.py
Reporting and Integrations
Assessment stages produce structured findings and reports, with JSON and Markdown-oriented output implied by CLI workflows. Burp integration provides an external proxy boundary for intercepting or observing traffic. Runtime dependencies are Python packages declared in requirements.txt; targets may be local Python/Node processes or remote HTTP/SSE MCP services.
Paths: analysis/report.py, integrations/burp_proxy.py, utils/logger.py, requirements.txt
Main entry points: engine.py Analysis engine · mcp_client.py MCP client · mcploit.py MCPloit dispatcher · enumerator.py Capability enumerator
Components 20
CLI & Access
- MCPloit dispatcher · Coordinates connect, enum, scan, audit, exploit, and full-scan modes.
mcploit.py - MCP client · Auto-detects STDIO, SSE, and HTTP MCP transports.
core/mcp_client.py - Interactive shell
core/interactive.py
Reconnaissance
- Capability enumerator · Retrieves tools, resources, prompts, and schemas.
core/enumerator.py - Metadata extractor
analysis/metadata_extractor.py
Security Analysis
- Analysis engine · Coordinates passive and optional active live-target assessment.
analysis/engine.py - Vulnerability scanner
modules/scanner.py - Detector families · Covers injection, execution, traversal, secrets, tokens, poisoning, and typosquatting.
modules/detectors/base_detector.py - Active prober
analysis/blackbox/active_prober.py - Schema analyzer
analysis/blackbox/schema_analyzer.py - SAST scanner · Performs regex and static source scanning.
analysis/whitebox/sast_scanner.py - AST entry-point analysis · Finds MCP tools and risky data flows.
analysis/whitebox/entry_point_detector.py - AI reviewer · Sends selected code and findings only when enabled.
analysis/whitebox/ai_reviewer.py
Exploitation
- Exploit engine · Runs module-targeted attacks through the MCP client.
exploits/engine.py - Payload manager · Selects categorized payloads for exploit execution.
payloads/manager.py
Reporting & Integrations
- Findings · Central aggregation of assessment results.
analysis/finding.py - Reports · Produces assessment reports for CLI workflows.
analysis/report.py - Burp proxy · Intercepts or observes MCP traffic.
integrations/burp_proxy.py
Other components
- MCP target · Local process or remote HTTP/SSE MCP service.
- Anthropic API · External code and finding data boundary.
Connections 25
- MCPloit dispatcher → MCP client: connects
- MCPloit dispatcher → Interactive shell: starts
- MCPloit dispatcher → Capability enumerator: runs enum
- MCPloit dispatcher → Analysis engine: runs scan/audit
- MCPloit dispatcher → Exploit engine: runs exploit
- MCP client → MCP target: MCP transport
- Interactive shell → MCP client: manual MCP calls
- Capability enumerator → MCP client: discovers capabilities
- Capability enumerator → Metadata extractor: normalizes
- Metadata extractor → Analysis engine: capability metadata
- Analysis engine → Vulnerability scanner: passive scan
- Vulnerability scanner → Detector families: selects and runs
- Analysis engine → Active prober: optional validation
- Analysis engine → Schema analyzer: inspects schemas
- Active prober → MCP client: controlled payloads
- Analysis engine → SAST scanner: source audit
- Analysis engine → AST entry-point analysis: AST audit
- Analysis engine → AI reviewer: optional triage
- AI reviewer → Anthropic API: selected code/findings
- Vulnerability scanner → Findings: findings
- Analysis engine → Findings: aggregates
- Findings → Reports: renders
- Exploit engine → Payload manager: selects payloads
- Exploit engine → MCP client: executes via
- MCP client → Burp proxy: proxy traffic