# Validate vulnerabilities inside isolated microVMs

URL: https://docs.hanzo.ai/docs/guides/cyber/sandboxed-exploit-repro

> Eliminate false-positive security findings by running deterministic proof-of-reproduction tests inside ephemeral /v1/sandbox microVMs.

**A vulnerability finding is a hypothesis until a minimal test reproduces it deterministically.** Run candidate reproducers inside isolated `/v1/sandbox` microVMs with zero production secrets mounted.

## Architecture & contract

Each lease provisions a fresh microVM with strict TTL and quota controls. Capture exit code and sanitizer trace as proof, score blast radius with Kai, and tear down the sandbox in a `finally` block.

**Primary endpoint:** `POST /v1/sandbox/lease` · \*_Status:_\* `shipped` · \*_Level:_\* `specialist`

## Run it across all four surfaces

**CLI**

```bash
SANDBOX_ID=$(hanzo sandbox lease --data '{"image":"alpine:3.20","ttl_seconds":300}' | jq -r '.id')
hanzo sandbox exec "$SANDBOX_ID" --data '{"cmd":["sh","-c","echo running security reproducer && exit 0"]}'
hanzo sandbox stop --data "{"id":"${SANDBOX_ID}"}"
```

**SDK**

**TypeScript**

```ts
import { Configuration, SandboxApi } from 'hanzoai';

const sb = new SandboxApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data: lease } = await sb.postSandboxLease({ image: 'alpine:3.20', ttl_seconds: 300 });
try {
  const { data: out } = await sb.postSandboxByIdExec(lease.id, { cmd: ['sh', '-c', 'echo verified'] });
  console.log(out);
} finally {
  await sb.postSandboxStop({ id: lease.id });
}
```

**Python**

```python
import os
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import SandboxApi

api = SandboxApi(ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"])))
lease = api.post_sandbox_lease({"image": "alpine:3.20", "ttl_seconds": 300})
try:
    print(api.post_sandbox_by_id_exec(lease["id"], {"cmd": ["sh", "-c", "echo verified"]}))
finally:
    api.post_sandbox_stop({"id": lease["id"]})
```

**HTTP**

```bash
SANDBOX_ID=$(curl -s -X POST https://api.hanzo.ai/v1/sandbox/lease \
  -H "Authorization: Bearer $HANZO_API_KEY" -H "Content-Type: application/json" \
  -d '{"image":"alpine:3.20","ttl_seconds":300}' | jq -r '.id')

curl -s -X POST "https://api.hanzo.ai/v1/sandbox/${SANDBOX_ID}/exec" \
  -H "Authorization: Bearer $HANZO_API_KEY" -H "Content-Type: application/json" \
  -d '{"cmd":["sh","-c","echo verified"]}' | jq '.'

curl -s -X POST https://api.hanzo.ai/v1/sandbox/stop \
  -H "Authorization: Bearer $HANZO_API_KEY" -H "Content-Type: application/json" \
  -d "{"id":"${SANDBOX_ID}"}"
```

**MCP**

```bash
curl -s -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "sandbox",
      "arguments": {"op": "get_sandbox_quota", "input": {}}
    }
  }'
```

## Verify the outcome

- Verify the sandbox terminates cleanly and `GET /v1/sandbox/quota` reflects released capacity.

## Production guardrails

- Restrict validation strictly to systems you own or hold explicit written testing authorization for.

## Next steps & Hanzo University

- [Vulnerability Validation](https://docs.hanzo.ai/docs/cybersecurity/vulnerability-validation) · [Autonomous SecOps Patching](https://docs.hanzo.ai/docs/guides/cyber/autonomous-secops-patching)

- **[CYB 201 — Agentic Cybersecurity](https://hanzo.university/agentic-cybersecurity)** ([Launch interactive lab on hanzo.app/learn](https://hanzo.app/learn/agentic-cybersecurity))

- **[CYB 301 — Autonomous SecOps](https://hanzo.university/autonomous-secops)** ([Launch interactive lab on hanzo.app/learn](https://hanzo.app/learn/autonomous-secops))
