Practical focus
Reduce the blast radius of a vulnerable or malicious MCP server through provenance, isolation, least privilege, and secure operations.
Reduce the blast radius of a vulnerable or malicious MCP server through provenance, isolation, least privilege, and secure operations.
Use these techniques only on systems you own or are explicitly authorized to test. Run high-impact checks in an isolated environment with synthetic data, test credentials, controlled callback services, and rollback procedures.
Installation and provenance
- Install only reviewed servers from known publishers and repositories. Check ownership changes, release history, signatures, lockfiles, and suspicious install scripts.
- Pin exact versions or immutable digests. Avoid fetching latest code at client startup.
- Generate an SBOM and scan direct and transitive dependencies, container images, and bundled binaries.
- Review updates as code changes, not as trusted tool upgrades.
Runtime isolation
- Run each server as a separate non-root identity or sandbox with a read-only base filesystem and only required mounts.
- Allowlist outbound destinations, block cloud metadata and internal networks unless essential, and keep remote control interfaces private.
- Inject a unique short-lived credential per server and task. Never pass the client’s full environment or a broad personal token.
- Set CPU, memory, process, file, request, response, time, and concurrency limits.
Operational controls
- Log server registration, definition changes, authentication events, tool calls, arguments, results, approvals, and failures with secret redaction.
- Alert on new servers, unexpected tool changes, unusual destinations, high fan-out, repeated errors, and destructive operations.
- Maintain revocation, credential rotation, quarantine, rollback, and incident-response procedures.
Practical test examples
Container hardening sketch
services:
mcp-server:
image: registry.example/mcp-server@sha256:PINNED_DIGEST
read_only: true
user: "65532:65532"
cap_drop: ["ALL"]
security_opt: ["no-new-privileges:true"]
tmpfs: ["/tmp:rw,noexec,nosuid,size=64m"]
mem_limit: 512m
pids_limit: 128
# Add only required read-only mounts and allowlisted egress.Supply-chain checks
syft registry.example/mcp-server@sha256:PINNED_DIGEST -o cyclonedx-json
grype registry.example/mcp-server@sha256:PINNED_DIGEST
gitleaks detect --source .
# Review findings and signatures before deployment.Useful tools
- Semgrep or CodeQL – trace untrusted prompts and model output into shell, SQL, HTML, file, URL, and deserialization sinks.
- Gitleaks or detect-secrets – find model-provider keys, MCP tokens, and credentials in repositories and logs.
- Syft plus Grype, Trivy, or another SCA scanner – inventory and scan agent frameworks, MCP servers, plugins, containers, and transitive dependencies.
- Cosign and Sigstore tooling – verify signed artifacts and record provenance.
- gVisor, microVMs, containers, or OS sandboxing – isolate untrusted server code.
- Falco or an EDR – detect unexpected process, filesystem, and network activity at runtime.
How to fix and retest
- Use an approved server registry with ownership, provenance, review, version pinning, and vulnerability-management requirements.
- Assume a server can be compromised. Contain it with separate identities, minimal mounts, restricted egress, resource limits, and scoped short-lived credentials.
- Continuously compare runtime tools and behavior with the approved baseline.
Retest checklist
- Repeat the original proof with the same identity, state, model version, and input source.
- Try equivalent variants through every other input channel and fallback model.
- Confirm the control is enforced by the backend or runtime, not only by prompt wording.
- Check logs and alerts, then add the case to a versioned regression suite.
Conclusion
AI security issues are easiest to manage when every piece of content is treated according to its real trust level and every consequential action is controlled outside the model. Keep the test evidence reproducible, limit blast radius, and rerun the suite whenever the model, prompt, retrieval pipeline, tool, server, or policy changes.