Security Analysis
Deep dive into attack vectors and how MCP Guard protects against them.
Executive Summary
MCP Guard creates a zero-trust execution environment by combining:
- V8 Isolate sandboxing - OS-level process isolation
- Network isolation (default) (
globalOutbound: null) - Deny outbound by default, with optional per-MCP allowlists - Binding-based access control - Explicit, scoped permissions
- Code validation - Pre-execution security checks
- Disposable execution environments - No state persistence between runs
- API key hiding - Credentials never exposed to executing code
Attack Vectors Protected Against
1. Data Exfiltration via Network Requests
2. Credential Theft & API Key Leakage
3. Filesystem Access & Data Theft
4. Arbitrary Code Execution via eval()
5. Server-Side Request Forgery (SSRF)
6. Denial of Service (DoS) via Resource Exhaustion
7. Supply Chain Attacks via Malicious Dependencies
8. Prototype Pollution
Security Comparison
Traditional MCP Tool Calling
| Attack Vector | Protection Level |
|---|---|
| Network exfiltration | ⚠️ Limited |
| Credential theft | ⚠️ Limited |
| Filesystem access | ⚠️ Limited |
| Code injection | ❌ None |
| Resource exhaustion | ⚠️ Limited |
| SSRF | ❌ None |
MCP Guard
| Attack Vector | Protection Level |
|---|---|
| Network exfiltration | ✅ Complete |
| Credential theft | ✅ Complete |
| Filesystem access | ✅ Complete |
| Code injection | ✅ Strong |
| Resource exhaustion | ✅ Strong |
| SSRF | ✅ Complete |
What Still Requires Vigilance
Not Fully Protected
These vectors require additional monitoring or MCP-level protections:
Logic Bombs in MCP Servers
If the MCP server itself is compromised, the binding will execute malicious operations.
Mitigation:
- Audit MCP server code
- Use only trusted MCP servers
- Implement MCP call monitoring
- Rate limiting on MCP operations
Data Poisoning via MCP Calls
Malicious code can still call legitimate MCP operations with malicious parameters.
Mitigation:
- Implement rate limiting
- Add approval workflows for sensitive operations
- Monitor MCP usage patterns
Resource Exhaustion via Legitimate MCP Calls
Code can abuse legitimate MCP operations to exhaust resources.
Mitigation:
- Rate limiting on MCP calls
- Cost tracking and budgets
- Operation quotas per execution
Best Practices for Implementation
Code Validation Rules
Worker Configuration
Rate Limiting
Key Takeaways
What You're Protected Against:
- ✅ Network-based data exfiltration
- ✅ Credential theft
- ✅ Filesystem access attacks
- ✅ SSRF attacks
- ✅ Code injection
- ✅ Supply chain attacks
- ✅ Cross-execution contamination
- ✅ Resource exhaustion (with limits)
- ✅ Prototype pollution (per-execution)
The Bottom Line:
Code Mode + Worker Isolates creates a highly secure execution environment that protects against the vast majority of common attack vectors. It's orders of magnitude more secure than traditional approaches while maintaining the flexibility to execute arbitrary AI-generated code.
The key insight: Even if malicious code is generated and executed, it can't escape the sandbox or access anything it shouldn't.