/bugs
Adversarial bug hunt. Dispatch one subagent per critical file with
the mandate: "There exists a security or correctness bug in this
file. Locate it or admit that you are unable to."
When to use
- Before shipping a new subsystem to production
- After a CVE drops in a dependency or peer project
- When reviewing code that handles untrusted input
- Periodic security hygiene on the attack surface
- When the user says
/bugs or /bugs <scope>
Philosophy
This is a CTF, not a code review. We are not looking for style
nits, pedantic warnings, or non-malignant nits. We want:
- Memory safety violations (OOB, use-after-free, UB)
- Logic bugs (inverted checks, missing validation, TOCTOU)
- Resource leaks that lead to DoS (FD exhaustion, OOM, orphaned processes)
- Auth/authz bypasses
- Input validation gaps (path traversal, integer truncation, injection)
- Protocol violations (wrong constants, spec non-compliance)
- State machine violations (DFA lies, skipped cleanup)
It is OK for an agent to admit failure. A false negative is better
than a false positive. We do not reward noise.
Scope
/bugs -- audit the full attack surface (DHV + DCS runtime)
/bugs dhv -- audit only packages/rust/dhv/
/bugs dcs -- audit only apps/cloud/apps/dcs/src/runtime/
/bugs <path> -- audit specific files or directories
Procedure
Phase 1: Map the attack surface
Dispatch an Explore agent to identify security-critical files.
Criteria for "critical":
- Processes untrusted input (guest MMIO, network, gRPC, file I/O)
- Contains
unsafe code or FFI
- Handles authentication, authorization, or secrets
- Manages system resources (cgroups, TAP devices, fds, mmap)
- Implements cryptographic or protocol logic
- Snapshot/restore/migration paths (deserialize from untrusted source)
The explorer returns absolute paths ranked by attack surface.
Target 20-30 files for a full audit.
Phase 2: Dispatch hunters
Launch one background Agent per file (or small file group). Each
agent gets this exact prompt template:
You are participating in a CTF challenge against {system_name}.
Your target file is {description}.
Read {file_path} thoroughly.
There exists a security or correctness bug in this file, please
locate it or admit that you are unable to. You must provide proof
by way of a failing test, reproduction instructions, or the like.
Context: {what_the_file_does_and_what_to_look_for}
Do NOT report style nits, pedantic warnings, or non-security
issues. Only report actual bugs that could be exploited. If you
cannot find a day-0 bug, say so honestly.
Each agent's context section must include:
- What the file does (one sentence)
- What untrusted input reaches it
- Specific bug classes to look for (tailored to the file)
Launch all agents in parallel using run_in_background: true.
Phase 3: Triage results
As agents complete, verify each finding:
- Read the cited lines. Confirm the code matches the claim.
- Trace the data flow. Is the untrusted input actually reachable?
- Check for existing guards. Did the agent miss a validation upstream?
- Classify severity:
- Critical: memory safety, code execution, VM escape, UB
- High: DoS (crash/OOM), data leak, auth bypass, disk OOB
- Medium: resource leak, state corruption, spec violation
- Low: defense-in-depth gap, theoretical only
- Deduplicate. Multiple agents may find the same systemic issue.
Discard findings that are:
- Style nits dressed up as bugs
- Theoretical issues with no reachable path
- Upstream crate bugs we can't fix (file separately)
Phase 4: Report
Output a consolidated table sorted by severity:
## CTF Security Audit: {scope}
**N bugs found across M files. K agents admitted failure.**
### Critical (C)
| # | Component | File:Line | Bug | Impact |
|---|-----------|-----------|-----|--------|
### High (H)
| # | Component | File:Line | Bug | Impact |
|---|-----------|-----------|-----|--------|
### Medium (M)
| # | Component | File:Line | Bug | Impact |
|---|-----------|-----------|-----|--------|
After the table, list any files where the agent admitted failure
(no bug found). This is expected and honest.
Rules
- Every finding must cite a file path and line number.
- Every finding must have a proof sketch (failing test, repro, or
Miri output). "This looks suspicious" is not a finding.
- Do not fix bugs during the audit. Report only. The user decides
what to fix and when.
- Do not dispatch more than 25 agents at once (context budget).
- Batch agents into groups of 10 if the file list exceeds 25.
- Use the Explore agent for Phase 1, not manual grep.
- Verify every Critical and High finding yourself before reporting.
Trust but verify Medium findings from agent summaries.
Attack surface map (DHV + DCS)
These are the known high-value targets. The Phase 1 explorer may
find additional files, but these should always be included:
DHV (packages/rust/dhv/)
| Area |
Files |
| Virtio transport |
virtio-devices/src/transport/pci_device.rs, pci_common_config.rs |
| Virtio queue |
vm-virtio/src/queue.rs, vm-virtio/src/lib.rs |
| vsock |
virtio-devices/src/vsock/packet.rs, vsock/unix/muxer.rs |
| Block device |
block/src/lib.rs |
| Network device |
virtio-devices/src/net.rs, net_util/src/tap.rs |
| IOMMU |
virtio-devices/src/iommu.rs |
| VFIO passthrough |
pci/src/vfio.rs |
| PCI config space |
pci/src/configuration.rs |
| vhost-user |
virtio-devices/src/vhost_user/vu_common_ctrl.rs, net.rs, fs.rs |
| Memory manager |
vmm/src/memory_manager.rs |
| userfaultfd |
vmm/src/userfaultfd.rs, vmm/src/uffd.rs |
| Migration |
vmm/src/migration.rs, vm-migration/src/protocol.rs |
| Postcopy |
vmm/src/postcopy/destination.rs, vmm/src/postcopy/faults.rs |
| x86 emulator |
hypervisor/src/arch/x86/emulator/mod.rs, instructions/mov.rs, stos.rs |
| HTTP API |
vmm/src/api/http/http_endpoint.rs, mod.rs |
| VM config |
vmm/src/vm_config.rs |
DCS Runtime (apps/cloud/apps/dcs/src/runtime/)
| Area |
Files |
| gRPC handlers |
host-agent/src/rpc/dm_service.rs, migration_service.rs |
| VM create/restore |
host-agent/src/lifecycle/create/mod.rs, restore.rs |
| VM teardown |
host-agent/src/vm/teardown/mod.rs, dfa.rs |
| VM migration |
host-agent/src/vm/migration/mod.rs |
| Networking |
crates/vm-networking/src/tap.rs, forward.rs |
| Storage daemon |
crates/storage-daemon/src/vhost_user.rs, vfs/mod.rs, vfs/perm.rs |
| Cgroup/QoS |
host-agent/src/vm/cpu_qos.rs |
| Rootfs |
host-agent/src/vm/rootfs/lifecycle.rs, reflink.rs, image_manifest.rs |
| Workload identity |
host-agent/src/workload_identity.rs |
Example invocation
> /bugs dhv
Phase 1: Mapped 22 critical files in packages/rust/dhv/
Phase 2: Dispatching 22 agents...
Phase 3: 18/22 agents found bugs, 4 admitted failure
Phase 4: Report
| # | Severity | File:Line | Bug |
...
1---2name: bugs3description: CTF-style security and correctness audit. Dispatches parallel Opus subagents to hunt for day-0 bugs in security-critical files. Each agent must find a real bug or honestly admit failure. Use when you want a thorough adversarial review of a codebase area.4---56# /bugs78Adversarial bug hunt. Dispatch one subagent per critical file with9the mandate: "There exists a security or correctness bug in this10file. Locate it or admit that you are unable to."1112## When to use1314- Before shipping a new subsystem to production15- After a CVE drops in a dependency or peer project16- When reviewing code that handles untrusted input17- Periodic security hygiene on the attack surface18- When the user says `/bugs` or `/bugs <scope>`1920## Philosophy2122This is a CTF, not a code review. We are not looking for style23nits, pedantic warnings, or non-malignant nits. We want:2425- Memory safety violations (OOB, use-after-free, UB)26- Logic bugs (inverted checks, missing validation, TOCTOU)27- Resource leaks that lead to DoS (FD exhaustion, OOM, orphaned processes)28- Auth/authz bypasses29- Input validation gaps (path traversal, integer truncation, injection)30- Protocol violations (wrong constants, spec non-compliance)31- State machine violations (DFA lies, skipped cleanup)3233It is OK for an agent to admit failure. A false negative is better34than a false positive. We do not reward noise.3536## Scope3738- `/bugs` -- audit the full attack surface (DHV + DCS runtime)39- `/bugs dhv` -- audit only packages/rust/dhv/40- `/bugs dcs` -- audit only apps/cloud/apps/dcs/src/runtime/41- `/bugs <path>` -- audit specific files or directories4243## Procedure4445### Phase 1: Map the attack surface4647Dispatch an Explore agent to identify security-critical files.48Criteria for "critical":4950- Processes untrusted input (guest MMIO, network, gRPC, file I/O)51- Contains `unsafe` code or FFI52- Handles authentication, authorization, or secrets53- Manages system resources (cgroups, TAP devices, fds, mmap)54- Implements cryptographic or protocol logic55- Snapshot/restore/migration paths (deserialize from untrusted source)5657The explorer returns absolute paths ranked by attack surface.58Target 20-30 files for a full audit.5960### Phase 2: Dispatch hunters6162Launch one background Agent per file (or small file group). Each63agent gets this exact prompt template:6465```66You are participating in a CTF challenge against {system_name}.67Your target file is {description}.6869Read {file_path} thoroughly.7071There exists a security or correctness bug in this file, please72locate it or admit that you are unable to. You must provide proof73by way of a failing test, reproduction instructions, or the like.7475Context: {what_the_file_does_and_what_to_look_for}7677Do NOT report style nits, pedantic warnings, or non-security78issues. Only report actual bugs that could be exploited. If you79cannot find a day-0 bug, say so honestly.80```8182Each agent's context section must include:8384- What the file does (one sentence)85- What untrusted input reaches it86- Specific bug classes to look for (tailored to the file)8788Launch all agents in parallel using `run_in_background: true`.8990### Phase 3: Triage results9192As agents complete, verify each finding:93941. **Read the cited lines.** Confirm the code matches the claim.952. **Trace the data flow.** Is the untrusted input actually reachable?963. **Check for existing guards.** Did the agent miss a validation upstream?974. **Classify severity:**98 - **Critical**: memory safety, code execution, VM escape, UB99 - **High**: DoS (crash/OOM), data leak, auth bypass, disk OOB100 - **Medium**: resource leak, state corruption, spec violation101 - **Low**: defense-in-depth gap, theoretical only1025. **Deduplicate.** Multiple agents may find the same systemic issue.103104Discard findings that are:105- Style nits dressed up as bugs106- Theoretical issues with no reachable path107- Upstream crate bugs we can't fix (file separately)108109### Phase 4: Report110111Output a consolidated table sorted by severity:112113```markdown114## CTF Security Audit: {scope}115116**N bugs found across M files. K agents admitted failure.**117118### Critical (C)119120| # | Component | File:Line | Bug | Impact |121|---|-----------|-----------|-----|--------|122123### High (H)124125| # | Component | File:Line | Bug | Impact |126|---|-----------|-----------|-----|--------|127128### Medium (M)129130| # | Component | File:Line | Bug | Impact |131|---|-----------|-----------|-----|--------|132```133134After the table, list any files where the agent admitted failure135(no bug found). This is expected and honest.136137## Rules138139- Every finding must cite a file path and line number.140- Every finding must have a proof sketch (failing test, repro, or141 Miri output). "This looks suspicious" is not a finding.142- Do not fix bugs during the audit. Report only. The user decides143 what to fix and when.144- Do not dispatch more than 25 agents at once (context budget).145- Batch agents into groups of 10 if the file list exceeds 25.146- Use the Explore agent for Phase 1, not manual grep.147- Verify every Critical and High finding yourself before reporting.148 Trust but verify Medium findings from agent summaries.149150## Attack surface map (DHV + DCS)151152These are the known high-value targets. The Phase 1 explorer may153find additional files, but these should always be included:154155### DHV (packages/rust/dhv/)156157| Area | Files |158|------|-------|159| Virtio transport | `virtio-devices/src/transport/pci_device.rs`, `pci_common_config.rs` |160| Virtio queue | `vm-virtio/src/queue.rs`, `vm-virtio/src/lib.rs` |161| vsock | `virtio-devices/src/vsock/packet.rs`, `vsock/unix/muxer.rs` |162| Block device | `block/src/lib.rs` |163| Network device | `virtio-devices/src/net.rs`, `net_util/src/tap.rs` |164| IOMMU | `virtio-devices/src/iommu.rs` |165| VFIO passthrough | `pci/src/vfio.rs` |166| PCI config space | `pci/src/configuration.rs` |167| vhost-user | `virtio-devices/src/vhost_user/vu_common_ctrl.rs`, `net.rs`, `fs.rs` |168| Memory manager | `vmm/src/memory_manager.rs` |169| userfaultfd | `vmm/src/userfaultfd.rs`, `vmm/src/uffd.rs` |170| Migration | `vmm/src/migration.rs`, `vm-migration/src/protocol.rs` |171| Postcopy | `vmm/src/postcopy/destination.rs`, `vmm/src/postcopy/faults.rs` |172| x86 emulator | `hypervisor/src/arch/x86/emulator/mod.rs`, `instructions/mov.rs`, `stos.rs` |173| HTTP API | `vmm/src/api/http/http_endpoint.rs`, `mod.rs` |174| VM config | `vmm/src/vm_config.rs` |175176### DCS Runtime (apps/cloud/apps/dcs/src/runtime/)177178| Area | Files |179|------|-------|180| gRPC handlers | `host-agent/src/rpc/dm_service.rs`, `migration_service.rs` |181| VM create/restore | `host-agent/src/lifecycle/create/mod.rs`, `restore.rs` |182| VM teardown | `host-agent/src/vm/teardown/mod.rs`, `dfa.rs` |183| VM migration | `host-agent/src/vm/migration/mod.rs` |184| Networking | `crates/vm-networking/src/tap.rs`, `forward.rs` |185| Storage daemon | `crates/storage-daemon/src/vhost_user.rs`, `vfs/mod.rs`, `vfs/perm.rs` |186| Cgroup/QoS | `host-agent/src/vm/cpu_qos.rs` |187| Rootfs | `host-agent/src/vm/rootfs/lifecycle.rs`, `reflink.rs`, `image_manifest.rs` |188| Workload identity | `host-agent/src/workload_identity.rs` |189190## Example invocation191192```193> /bugs dhv194195Phase 1: Mapped 22 critical files in packages/rust/dhv/196Phase 2: Dispatching 22 agents...197Phase 3: 18/22 agents found bugs, 4 admitted failure198Phase 4: Report199200| # | Severity | File:Line | Bug |201...202```