convez.ai
MCP ServerSegurançaAvançado
m0rvayne

MCP Redteam - Auditor de Segurança para MCP Servers

m0rvayne/mcp-redteam

Audita MCP servers, encontra RCE e vulnerabilidades, gera relatórios interativos

Ver no GitHub
InicialPluginScore · de 0 a 100

Ferramenta de teste de segurança ativo para MCP servers que combina análise de código-fonte, exploração ao vivo e correção automática. Detecta vulnerabilidades como RCE, injeção, path traversal e problemas de configuração em connectors MCP através de análise estática (Semgrep) e comportamental com IA.

Instalação

$npx convez-ai m0rvayne/mcp-redteam

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
4
Forks
0
Acompanhando
0
Saúde
57%
Último commit
há 2 meses
Versão
v0.5.2
Issues abertas
1
Contribuidores
1

Casos de uso

  • Auditoria de segurança em MCP servers antes de produção
  • Detecção de código vulnerável (RCE, injeção, SSRF) em connectors MCP
  • Verificação de saúde de configuração (credenciais expostas, servidores zumbis)
  • Integração em CI/CD com relatórios SARIF no GitHub Security
  • Análise de cadeias de ataque cross-server entre múltiplos connectors

Veredito

Ferramenta madura e bem-testada (75+ testes) que resolve um problema real: auditar MCP servers em produção. Suporta tanto análise determinística em CLI quanto profunda via Claude Code plugin. Saída SARIF pronta para CI/CD e histórico de auditorias. Recomendado para times que deployam múltiplos MCP connectors.

README

A tradução para o português deste README ainda está na fila.

It doesn't tell you where your walls are thin. It walks through them.

Tests PyPI License: MIT OWASP MCP Top 10 Claude Code Plugin


I build MCP connectors and AI automation for businesses. 70+ connectors deployed across client projects. Some of them started acting up — dropping connections, config conflicts, servers I forgot to remove still sitting in config eating resources.

Went looking for something to audit this. Found mcp-scan — only reads tool descriptions, doesn't touch source code. Cisco's scanner — 78% false positives. Nothing that actually reads the server code and says "line 42, you have exec() with unsanitized input."

Built my own. Ran it on 106 public MCP servers. 7 had remote code execution. One of them had 25K GitHub stars.

Open-sourced because if my connectors had these problems, so do yours.


Two modes of operation:

  • Claude Code plugin — reads source code, probes tools, detects behavioral mismatches, maps cross-server attack chains. Interactive HTML report.
  • Standalone CLI — deterministic scan. 25 Semgrep rules, config health checks, SARIF output. Works in CI/CD without Claude.

What works today

FeatureStatusHow
Config health scannerWorkingDead servers, scope conflicts, credential exposure, supply chain, CVE checks
Semgrep code analysisWorking14 rules (Python + JS/TS): injection, traversal, SSRF, eval, secrets, stdout
SARIF outputWorkingGitHub Security tab integration
JSON outputWorkingMachine-readable for CI/CD
Terminal outputWorkingRich colored tables with risk scores
CI exit codesWorking--fail-on critical returns exit 1
LLM behavioral analysisWorkingAnthropic SDK, behavioral mismatch detection (optional)
Audit historyWorkingJSONL log, cross-run comparison (new/confirmed/fixed)
Self-security auditWorking10 vulnerabilities found and fixed in own code
Claude Code pluginWorkingAI-driven deep audit with HTML report
75+ testsPassingUnit, security, stress, edge cases, Hypothesis fuzzing

What doesn't work yet

  • Cross-server chain detection in CLI (exists in Claude Code plugin only)
  • Auto-fix in CLI (exists in Claude Code plugin only)
  • HTML report generation in CLI
  • MCPTox benchmark validation
  • Community rule contributions

Install

Claude Code plugin (deep AI-native audit):

claude plugin marketplace add m0rvayne/mcp-redteam
claude plugin install mcp-redteam
/mcp-redteam

Standalone CLI (deterministic, CI/CD ready):

pip install redteam-mcp
mcp-redteam scan ./your-mcp-server --no-llm

Remote MCP server (via URL, OAuth or token):

mcp-redteam scan-remote https://your-server.com/mcp --token <bearer>

Requires Python 3.10+. Semgrep installed separately for code analysis: pip install semgrep.

What it checks

Config Health (deterministic)

Dead/disconnected servers, scope conflicts (same server in multiple scopes), credentials in git-tracked config files (CVE-2025-59536), unpinned npx/uvx packages (supply chain), enableAllProjectMcpServers bypass (CVE-2026-21852), orphaned MCP processes.

Code Security (Semgrep, 25 rules)

RuleWhat it detectsLanguages
Shell injectionsubprocess + shell=True with user inputPython
Path traversalopen()/Path() without realpath checkPython, JS/TS
SSRFHTTP requests with user-controlled URLPython, JS/TS
Eval injectioneval()/exec()/new Function() with user inputPython, JS/TS
Hardcoded secretsAPI keys, tokens, passwords in sourcePython, JS/TS
Stdout pollutionprint()/console.log() in stdio handlersPython, JS/TS
Missing error handlingTool functions without try/catchPython, JS/TS
Credential in responseAPI keys/tokens in tool return valuesPython, JS/TS
Missing signal handlerServer without SIGTERM/SIGINTPython
Blocking sync callsrequests.get() inside async functionsPython
OAuth over-privilegeExcessive OAuth scopes (gmail.modify, admin)Python
No timeout on HTTPhttpx/requests/fetch without timeoutPython, JS/TS
No timeout on subprocesssubprocess/spawn without timeoutPython, JS/TS
Dangerous parameter namesTool params named cmd, exec, eval, codeJS/TS
Env secrets without rotationAPI keys from os.getenv used directlyPython

Based on 48+ CVEs, OWASP MCP Top 10, and research from Invariant Labs, Trail of Bits, Palo Alto Unit 42, OX Security, and Snyk.

LLM Behavioral Analysis (optional, requires API key)

  • Behavioral mismatch: tool description claims X, code does Y
  • Hidden operations: undeclared network requests, file writes, subprocess calls
  • Credential mishandling: secrets logged, leaked in errors, stored insecurely

How it compares

mcp-scan (Snyk)Cisco MCP Scannermcp-redteam
ApproachStatic description scanYARA + LLM-as-judgeSemgrep taint + LLM behavioral
Reads source codeNoPython onlyYes — Python + JS/TS
Config validationNoConfig discoveryYes — 6 checks, CVE detection
Behavioral mismatchNoNoYes (LLM layer)
SARIF outputNoNoYes
CI exit codesYesNoYes
Self-testedUnknownUnknown75+ tests, self-security audit
Cloud dependencySnyk API requiredCisco API (optional)No — fully local

Why not just use mcp-scan?

mcp-scan reads what a server says about itself — tool descriptions. mcp-redteam checks what a server actually does — source code analysis + behavioral analysis.

A server with clean descriptions but leaky code: mcp-scan passes it. We catch it.

Real findings mcp-scan cannot detect (they live in code, not descriptions):

  • Trello API keys in .env committed to git
  • Instagram session cookies stored in plaintext
  • AppleScript injection via unescaped clipboard input
  • Google OAuth tokens with permissions 644

Audit History

Each audit saves a compact JSONL log to ~/Desktop/redteam-results/. On the next run, mcp-redteam reads previous results and compares:

  • confirmed — found again, higher confidence
  • new — first time seeing this
  • fixed — was in previous audit, now gone

This turns LLM non-determinism into an advantage: each run is a new perspective, the intersection is ground truth.

Architecture

 /mcp-redteam
      |
 +-----------------+
 | Phase 0: Config |
 +-----------------+
      |
 +-----------+
 | Discovery |
 +-----------+
      |
      |   1 server = 1 agent
      |
 +----------+ +----------+ +----------+ +----------+
 | Agent-01 | | Agent-02 | | Agent-03 | | Agent-N  |
 | youtube  | | trello   | | instagram| | server-N |
 | health   | | health   | | health   | | health   |
 | arch     | | arch     | | arch     | | arch     |
 | complete | | complete | | complete | | complete |
 | security | | security | | security | | security |
 +----+-----+ +----+-----+ +----+-----+ +----+-----+
      |            |            |            |
      +------+-----+-----+------+
             |
 +-------------------------+
 | Chain analysis + report |
 +-------------------------+
             |
    +----------------+
    | HTML + Fix     |
    +----------------+

Tests

75+ tests across 6 test files:

  • test_semgrep.py — each vulnerable fixture detected, each benign fixture clean
  • test_self_security.py — 21 tests: our own code audited for vulnerabilities
  • test_stress.py — 1000/10000 findings, concurrent scans, unicode
  • test_fuzzing.py — Hypothesis property-based: any input, no crash
  • test_edge_cases.py — corrupt JSON, missing files, null bytes, timeouts
  • test_models.py + test_formatters.py — unit tests for core logic

Current Limitations

  • Plugin requires Claude Code with connected MCP servers
  • CLI requires semgrep for code analysis (graceful skip if not installed)
  • LLM analysis requires ANTHROPIC_API_KEY
  • Destructive tests intentionally skipped — read-only probing only
  • Source code analysis works for local servers; pip/npm packages may have limited access
  • Plugin report quality scales with model capability (Opus > Sonnet > Haiku)
  • False positive rate not yet measured on production MCP servers

Known False Positive Patterns

  • SSRF rule triggers on httpx.get() with URL built from config, not user input
  • Path traversal rule triggers on open() where path is validated but validation isn't recognized as sanitizer
  • Stdout pollution flags print() in __main__ block (safe, not in MCP handler)

Docs

The docs/ folder is useful independently:

References

License

MIT

Ver o original no GitHub

Bom para

Relacionados