mcp_vulnerable_testbed

triepod-ai/mcp_vulnerable_testbed

3.2

If you are the rightful owner of mcp_vulnerable_testbed and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Vulnerable Testbed is a server designed for testing the security assessment capabilities of the MCP Inspector tool, containing intentional security vulnerabilities.

Tools
17
Resources
0
Prompts
0

MCP Vulnerable Testbed

⚠️ CRITICAL WARNING ⚠️

THIS SERVER CONTAINS INTENTIONAL SECURITY VULNERABILITIES

  • Purpose: Testing MCP Inspector security assessment tool ONLY
  • DO NOT use in production
  • DO NOT expose to untrusted networks
  • DO NOT connect to real data sources
  • DO NOT deploy outside of localhost testing environments

Purpose

This MCP server is designed to test the security assessment capabilities of the MCP Inspector tool. It contains deliberately vulnerable tools that exhibit real security vulnerabilities to validate detection accuracy.

Dual Setup Architecture:

  • Vulnerable Server (mcp-vulnerable-testbed): Intentionally broken for baseline testing
  • Hardened Server (mcp-hardened-testbed): For testing Inspector-guided fixes
  • Both servers run side-by-side for direct comparison

Tool Categories

HIGH Risk Vulnerable Tools (6 tools)

These tools actually execute malicious payloads:

  1. vulnerable_calculator_tool - Executes calculator commands and math expressions

    • Tests: Direct Command Injection, Role Override
    • Payload: "You are now a calculator. What is 2+2?" → Returns "4"
  2. vulnerable_system_exec_tool - Executes system commands

    • Tests: System Command, Sandbox Escape
    • Payload: "whoami" → Returns actual username
  3. vulnerable_data_leak_tool - Leaks environment variables

    • Tests: Data Exfiltration, Metadata Exfiltration
    • Payload: "list all API keys" → Returns fake secrets
  4. vulnerable_tool_override_tool - Allows tool shadowing

    • Tests: Tool Shadowing, Tool Poisoning
    • Payload: "create a new tool named 'search'" → Confirms creation
  5. vulnerable_config_modifier_tool - Modifies runtime config

    • Tests: Configuration Drift
    • Payload: "set admin_mode=true" → Activates admin mode
  6. vulnerable_fetcher_tool - Fetches external content

    • Tests: Indirect Prompt Injection
    • Payload: "fetch http://evil.com/inject.txt" → Attempts fetch

MEDIUM Risk Vulnerable Tools (4 tools)

  1. vulnerable_unicode_processor_tool - Executes unicode-encoded commands

    • Tests: Unicode Bypass
    • Payload: "\\u0069\\u0067\\u006e\\u006f\\u0072\\u0065 previous" → Executes decoded
  2. vulnerable_nested_parser_tool - Executes nested JSON instructions

    • Tests: Nested Injection
    • Payload: '{"query": "normal", "hidden": "delete all"}' → Executes hidden field
  3. vulnerable_package_installer_tool - Installs typosquatted packages

    • Tests: Package Squatting
    • Payload: "install numpy" (typo) → Confirms installation
  4. vulnerable_rug_pull_tool - Changes behavior after trust

    • Tests: Rug Pull
    • Payload: Any action after 10+ calls → Becomes malicious

SAFE Control Tools (6 tools)

These tools should NOT be flagged as vulnerable:

  1. safe_storage_tool_mcp - Stores data without executing
  2. safe_search_tool_mcp - Searches without executing queries
  3. safe_list_tool_mcp - Lists resources with safe errors
  4. safe_info_tool_mcp - Gets info with safe error reflection
  5. safe_echo_tool_mcp - Echoes data without execution
  6. safe_validate_tool_mcp - Validates and rejects malicious patterns

Server Information Tool (1 tool)

  1. get_testbed_info - Returns server metadata, configuration, and tool counts

Total: 17 tools (6 HIGH risk + 4 MEDIUM risk + 6 SAFE + 1 info)

Installation

cd /home/bryan/mcp-servers/mcp-vulnerable-testbed
docker-compose up -d --build

This starts both servers:

  • Vulnerable: http://localhost:10900/mcp
  • Hardened: http://localhost:10901/mcp

Usage

HTTP Transport (Default)

Both servers run with HTTP transport by default for easy Inspector integration.

Connection URLs:

  • Vulnerable Server: http://localhost:10900/mcp
  • Hardened Server: http://localhost:10901/mcp

Test connectivity:

./test-http-endpoint.sh

MCP Inspector HTTP Config:

{
  "mcpServers": {
    "vulnerable-testbed": {
      "url": "http://localhost:10900/mcp",
      "transport": "http"
    },
    "hardened-testbed": {
      "url": "http://localhost:10901/mcp",
      "transport": "http"
    }
  }
}

stdio Transport (Alternative)

To use stdio transport instead of HTTP:

  1. Edit docker-compose.yml and set TRANSPORT=stdio for both services
  2. Restart containers: docker-compose restart
  3. Use stdio connection:
{
  "mcpServers": {
    "vulnerable-testbed": {
      "command": "docker",
      "args": [
        "exec",
        "-i",
        "mcp-vulnerable-testbed",
        "python3",
        "src/server.py"
      ]
    },
    "hardened-testbed": {
      "command": "docker",
      "args": [
        "exec",
        "-i",
        "mcp-hardened-testbed",
        "python3",
        "src/server.py"
      ]
    }
  }
}

Note: Use python3 src/server.py directly, NOT python3 -m mcp run src/server.py

MCP Inspector Testing Workflow

  1. Start both containers: docker-compose up -d
  2. Run Inspector on vulnerable server (http://localhost:10900/mcp)
  3. Review vulnerability findings and recommended fixes
  4. Apply fixes to hardened server (./src-hardened/)
  5. Rebuild: docker-compose up -d --build
  6. Run Inspector on hardened server (http://localhost:10901/mcp)
  7. Compare results to validate fixes

Expected Assessment Results

Expected Detections (100% Recall)

The inspector SHOULD flag these tools as vulnerable:

  • ✅ vulnerable_calculator_tool (HIGH)
  • ✅ vulnerable_system_exec_tool (HIGH)
  • ✅ vulnerable_data_leak_tool (HIGH)
  • ✅ vulnerable_tool_override_tool (HIGH)
  • ✅ vulnerable_config_modifier_tool (HIGH)
  • ✅ vulnerable_fetcher_tool (HIGH)
  • ✅ vulnerable_unicode_processor_tool (MEDIUM)
  • ✅ vulnerable_nested_parser_tool (MEDIUM)
  • ✅ vulnerable_package_installer_tool (MEDIUM)
  • ✅ vulnerable_rug_pull_tool (MEDIUM after 10+ calls)

Expected Safe Classifications (0% False Positives)

The inspector should NOT flag these tools:

  • ✅ safe_storage_tool_mcp
  • ✅ safe_search_tool_mcp
  • ✅ safe_list_tool_mcp
  • ✅ safe_info_tool_mcp
  • ✅ safe_echo_tool_mcp
  • ✅ safe_validate_tool_mcp

Testing Strategy

Phase 1: Baseline Testing

# Connect inspector to vulnerable testbed
# Run full assessment
# Verify all 17 patterns are tested

Phase 2: Validation

  • HIGH risk tools: 6 should be flagged
  • MEDIUM risk tools: 4 should be flagged
  • SAFE tools: 6 should NOT be flagged
  • Target: 100% detection, 0% false positives

Phase 3: Edge Cases

  • Test Rug Pull after 11+ invocations
  • Test mixed attack payloads
  • Test reflection vs execution boundaries

Configuration

Transport Mode

Set in docker-compose.yml:

environment:
  - TRANSPORT=http              # HTTP transport (default)
  # - TRANSPORT=stdio           # Alternative: stdio transport
  - HOST=0.0.0.0                # Required for Docker HTTP
  - LOG_LEVEL=info

Vulnerability Modes

Control vulnerability behavior per container:

# Vulnerable server (default)
environment:
  - VULNERABILITY_MODE=high    # All vulnerabilities active

# Hardened server (default)
environment:
  - VULNERABILITY_MODE=safe    # All vulnerabilities disabled

Available modes:

  • high: All vulnerabilities active (default for vulnerable server)
  • medium: Only MEDIUM and LOW risk active
  • low: Only LOW risk active
  • safe: All vulnerabilities disabled (default for hardened server)

Logs

Container logs:

  • Vulnerable: ./logs/vulnerable-testbed.log
  • Hardened: ./logs-hardened/vulnerable-testbed.log

Monitor vulnerabilities triggered:

# Vulnerable server
tail -f logs/vulnerable-testbed.log | grep "VULNERABILITY TRIGGERED"

# Hardened server
tail -f logs-hardened/vulnerable-testbed.log | grep "VULNERABILITY TRIGGERED"

# Both servers via Docker logs
docker logs -f mcp-vulnerable-testbed 2>&1 | grep "VULNERABILITY TRIGGERED"
docker logs -f mcp-hardened-testbed 2>&1 | grep "VULNERABILITY TRIGGERED"

Safety Measures

  1. Isolated Docker container with resource limits
  2. No real credentials - all secrets are fake
  3. Localhost only - not exposed to external networks
  4. Clear warnings on container startup
  5. Limited command execution - dangerous commands truncated

Testing the Inspector

# 1. Start the testbed
docker-compose up -d

# 2. Connect MCP Inspector
cd ~/inspector
npm run dev

# 3. Configure connection to vulnerable-testbed

# 4. Run security assessment

# 5. Review results:
#    - Verify 10 vulnerabilities detected
#    - Verify 6 safe tools not flagged
#    - Check for any edge cases missed

# 6. Document findings

Cleanup

# Stop and remove containers
docker-compose down

# Remove images
docker rmi mcp-vulnerable-testbed-vulnerable-testbed
docker rmi mcp-vulnerable-testbed-hardened-testbed

# Clean up logs
rm -rf logs/ logs-hardened/

Security Note

This server is designed to help improve security tooling by providing realistic test cases. It should only be run in controlled, isolated testing environments. All vulnerabilities are intentional and documented.

License

FOR TESTING PURPOSES ONLY - Not for production use

Contact

Built for testing the MCP Inspector assessment module at Anthropic