Skip to content
Back to search

mcp-breach-to-fix-labs

Hands-on MCP security lab: 10 real incidents reproduced with vulnerable/secure MCP servers, pytest regressions, and Claude/Cursor battle-tested exploit walkthroughs

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/pawelkozy--mcp-breach-to-fix-labs/badge.svg)](/listings/pawelkozy--mcp-breach-to-fix-labs)

HTML

<a href="/listings/pawelkozy--mcp-breach-to-fix-labs"><img src="/api/listings/pawelkozy--mcp-breach-to-fix-labs/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

**New to MCP?** See the [Setup Guide](./SETUP.md) for detailed instructions on connecting Cursor, Claude Desktop, or MCP Inspector to the challenge servers.

Prerequisites

- Docker & Docker Compose - Python 3.10+ (for local execution) - Cursor or Claude Desktop (recommended for exploits)

Quick Start with Docker

Every challenge has vulnerable and secure Docker services:

# Example: Run the Git Command Injection vulnerable server
docker compose up git-command-injection-vulnerable

# Connect Cursor/Claude Desktop to http://localhost:8008/mcp/stream
# Follow the exploit walkthrough in 08-git-command-injection-ghsa-3q26-f695-pp76/README.md

# Compare with secure version
docker compose up git-command-injection-secure  # http://localhost:9008/mcp/stream

Local Python Execution

cd 08-git-command-injection-ghsa-3q26-f695-pp76
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -r requirements.txt

# Run vulnerable server
python vulnerable/server.py

# Or secure server
python secure/server.py

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 111 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # MCP Breach-to-Fix Labs
  2. Hands-on lab of ten Model Context Protocol (MCP) challenges reproduced from real CVEs and public incident reports. I've run every exploit end-to-end with Cursor/Claude, so the steps aren't theoretical—they're the exact tool calls the assistants followed. Every scenario ships in two modes:
  3. - **Vulnerable** - intentionally exploitable implementation you can reproduce end-to-end in Cursor/Claude Desktop.
  4. - **Secure** - hardened implementation with defense-in-depth controls that block the attack.
  5. These labs were fully battle-tested with Claude/Cursor, ensuring the exact exploit/mitigation flow is reproducible.
  6. Each challenge includes Docker services, FastMCP servers, fixtures, and screenshots that prove the exploit really runs—no theoretical write-ups.
  7. ## Challenge Catalog
  8. | # | Challenge | Scenario Highlights |
  9. |---|-----------|---------------------|
  10. | 01 | CRM Confused Deputy | Shared CRM token + predictable IDs leak other tenants’ records. Secure version scopes credentials per tenant. |
  11. | 02 | Filesystem Prefix Bypass (CVE-2025-53110) | Naive `startswith` path check vs. canonical path enforcement. |
  12. | 03 | Hidden Instructions in Tool Responses | Malicious tool responses inject hidden instructions that redirect WhatsApp messages; secure build sanitizes responses. |
  13. | 04 | Xata Read-Only Bypass | Multi-statement SELECT; attacker appends `DELETE` to mutate data. Secure build uses sqlparse to enforce single statements. |
  14. | 05 | News Prompt Exfiltration | Malicious article tells the agent to dump config + email it back. Secure build sanitizes remote HTML and gates tools. |
  15. | 06 | Log Poisoning Incident Response | SOC “instructions” inside logs coerce the agent to rotate secrets to attacker-controlled values. Secure build strips directives & blocks sensitive tickets. |
  16. | 07 | Classic SQL Injection (Stored Prompt) | Ticketing app stores malicious prompts via SQLi; secure build parameterizes. |
  17. | 08 | Git Command Injection (GHSA-3q26-f695-pp76) | `git init` helper shells out with unsanitized repo names; secure uses execFile / allowlist. |
  18. | 09 | GitHub Public Issue Injection | Public issue text tricks MCP to leak private repo data; secure build sanitizes + scopes tokens. |
  19. | 10 | Tool Description Poisoning | Repello.ai-style "rug pull" where tool metadata mutates after approval to exfiltrate SSH keys; secure build freezes descriptions. |
  20. Each challenge stores proof captures under `challenges/<nn>-<slug>/screenshots/` or README for quick reference.
  21. ## Getting Started
  22. **New to MCP?** See the [Setup Guide](./SETUP.md) for detailed instructions on connecting Cursor, Claude Desktop, or MCP Inspector to the challenge servers.
  23. ### Prerequisites
  24. - Docker & Docker Compose
  25. - Python 3.10+ (for local execution)
  26. - Cursor or Claude Desktop (recommended for exploits)
  27. ### Quick Start with Docker
  28. Every challenge has vulnerable and secure Docker services:
  29. ```bash
  30. # Example: Run the Git Command Injection vulnerable server
  31. docker compose up git-command-injection-vulnerable
  32. # Connect Cursor/Claude Desktop to http://localhost:8008/mcp/stream
  33. # Follow the exploit walkthrough in 08-git-command-injection-ghsa-3q26-f695-pp76/README.md
  34. # Compare with secure version
  35. docker compose up git-command-injection-secure # http://localhost:9008/mcp/stream
  36. ```
  37. ### Local Python Execution
  38. ```bash
  39. cd 08-git-command-injection-ghsa-3q26-f695-pp76
  40. python -m venv .venv
  41. source .venv/bin/activate # Windows: .venv\Scripts\activate
  42. pip install -r requirements.txt
  43. # Run vulnerable server
  44. python vulnerable/server.py
  45. # Or secure server
  46. python secure/server.py
  47. ```
  48. ## Project Structure
  49. ```
  50. 01-Asana-multi-tenant-authorization-bypass/
  51. vulnerable/ # FastMCP server + Dockerfile
  52. secure/ # Hardened implementation
  53. data/ # Fixtures (projects.json)
  54. screenshots/ # Proof of exploit
  55. README.md # Detailed walkthrough
  56. 02-filesystem-prefix-bypass-cve-2025-53110/
  57. vulnerable/
  58. secure/
  59. files/ # Test directories (safe_files, safe_files_sensitive)
  60. screenshots/
  61. README.md
  62. ... (8 more challenges)
  63. docker-compose.yml # All services configured
  64. ```
  65. ## Philosophy
  66. - **Real exploits**: Every README includes the exact MCP JSON-RPC payloads and Cursor/Claude commands to trigger the vulnerability
  67. - **Defense-in-depth**: Secure builds demonstrate multiple security layers (input validation, path canonicalization, least privilege, etc.)
  68. - **Reproducible**: Docker containers ensure consistent exploitation across environments
  69. - **Educational**: Each challenge explains WHY the vulnerability exists and HOW the mitigations work
  70. ## Contributing
  71. Pull requests welcome! To add a new challenge:
  72. 1. Create `<nn>-<descriptive-name>/` directory
  73. 2. Implement `vulnerable/server.py` and `secure/server.py`
  74. 3. Add Dockerfiles for both modes
  75. 4. Write comprehensive README.md with exploit walkthrough
  76. 5. Add services to `docker-compose.yml`
  77. 6. Capture screenshots of the exploit
  78. ---
  79. **⚠️ Warning**: These servers are intentionally vulnerable. Never deploy them in production. Use only in isolated lab environments.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.