Threat model
What hermitbox defends, against whom, where its trust boundaries are, and the invariants a change
must keep. Reviewers, human or automated, use it to judge whether a change weakens hermitbox. It
describes the code on main; each mechanism names the file that implements it. A change that
moves a boundary updates this page in the same pull request and says why.
What hermitbox protects
- The host from its sandboxes. A workload can’t read or write the host’s files, credentials or other sandboxes’ data, can’t reach the host’s own services, and can’t take more memory, CPU or processes than the host admits for it.
- Sandboxes from each other. One tenant’s sandbox can’t read, signal, dial or impersonate another’s, through the host, the edge or a shared port.
- A sandbox’s data, snapshots and secrets. Data is never copied out through a link, a restore never damages the current data, a snapshot is never lost as the only copy, and a secret value never appears in a record, label, log, view or error.
- The fleet’s control. Only an enrolled node with its own key talks to control; only control calls a node; a copy of a sandbox never runs twice; a node runs only a signed hermitboxd.
- The public API and edge. A credential reaches only what it was issued for, and only the edge’s fronts face the internet.
Adversaries
- Code inside a sandbox. Assume it is fully hostile, including root inside its container or
guest where the tier gives that. It controls everything in its data directory, its image, its
guest kernel on the
vmtier, and whatever its agent reports about it. - Another tenant’s sandbox on the same node or elsewhere in the fleet.
- A network attacker between nodes, control, edge, object store and clients.
- The holder of a leaked credential of limited scope: a project API key, a sandbox capability, a file URL, a presigned URL, an enrollment token or the edge token.
- A malicious or tampered release or upstream artifact: a daemon offered by a compromised control plane, a substituted bundle, an image a tenant chose.
- A request trying to relax the host’s policy: a spec or public request asking for less isolation, another image, another user, or a capability the host doesn’t give.
Out of scope: the host’s own root, the operator and whoever holds the operator token or the fleet
CA key, physical access, and bugs in the kernel itself, except where hermitbox chooses a tier
because of them (the vm tier’s own kernel; tiers.md on choosing one).
Trust boundaries
Sandbox and host
What crosses: exec, files, logs, stats, port forwarding and the agent’s own reports; the data
directory, written by the workload and read by hermitboxd; images and specs. Host policy lives in
the host’s configuration, not in requests (src/config.rs), and each
backend fills every isolation setting from it.
| Tier | What enforces the boundary |
|---|---|
container |
All capabilities dropped, no-new-privileges, never privileged, private IPC, PID limit, Docker restart policy no (src/runtime/docker/container.rs); images only from host allowed_images prefixes (src/config/validate.rs); the root-installed nftables table (src/isolation.rs) |
gvisor |
The container tier’s settings under the engine’s pinned runsc (src/runtime/docker/gvisor.rs, deploy/gvisor.json); never served by runc |
process |
Landlock ABI 3 filesystem policy, required in full (agent/src/process_policy.rs); a seccomp filter denying mount, ptrace, bpf, namespace creation, keyrings, io_uring and UID or capability changes (agent/src/process_policy/filter.rs); rlimits; a uid pool where the host allows it (src/runtime/process/journal.rs); namespaces through an unmodified bubblewrap where the host allows them (src/runtime/process/namespaces.rs); a cgroup of its own where controllers are delegated (src/runtime/process/resources.rs); eBPF network policy where the host allows it (src/bpf.rs) |
wasm |
A virtual kernel in a pinned agentOS sidecar, dropped to its own worker uid with no-new-privileges; only the explicit data mount enters the guest (src/runtime/wasm.rs, src/runtime/wasm/boot.rs) |
vm |
A Firecracker guest with its own kernel under KVM; the monitor confined by Landlock and seccomp as an ordinary user, or by the unchanged jailer with a uid of its own per VM as root (agent/src/vm_monitor.rs, src/runtime/vm/machine.rs); root VM authority only in the separate worker service (src/runtime/vm/worker.rs) |
Never trusted from the sandbox side:
- Its data directory. Every walk hermitboxd or the agent makes is descriptor-relative with
O_NOFOLLOWat each step, refuses special files, and never leaves the directory (src/tree.rs,agent/src/files.rs,src/tarball.rs). - Its guest kernel. On the
vmtier the host’s packet helper decides every flow again, so a guest that drops its own rules gains nothing (src/runtime/vm/network.rs); disks a guest wrote are checked and repaired only by confined tools on a staged copy (src/runtime/vm/disk.rs). - Its claims about who owns a socket. The process tier’s port proxy proves the server socket
belongs to the supervisor’s tree from kernel evidence before sending any bytes; a shared UID or
matching port is never proof (
agent/src/process_peer.rs). - Its private runtime state. Process journals and agent signing keys live outside every data
grant, snapshot and export (
src/runtime/process/journal.rs,src/manager/agent_keys.rs).
Sandbox and sandbox
- Containers are kept from each other’s addresses by the bridge’s inter-container switch, and
from each other’s published ports by the nftables table (
src/isolation.rs). They share the host kernel and may share a numeric uid (host-capabilities.md). - Process sandboxes can’t read each other’s data or
/proc(Landlock). With separate UIDs they can’t signal each other. With kernel network policy, a host address reaches only the sandbox’s own sockets (bpf.md); without it they share the host’s network and must be mutually trusted (process-tier.md). - Wasm sandboxes share one sidecar, which is a shared fault domain (agentos.md).
- VMs each have their own kernel; as root each monitor has a uid pair no other VM holds.
- Credentials are bound to one sandbox: a capability names its sandbox and epoch
(
agent/src/auth.rs); a project key’s routes answer 404 for another project’s ids (api.md). A fork gets its own agent key, and a fork with memory reseeds its random generator from host entropy (vm.md).
Sandbox and network
- Egress.
network: noneis the boundary on every tier. Hostname policy (egress) runs only through gateways hermitboxd owns: a dedicated bridge and root firewall for containers (src/runtime/docker/egress.rs), eBPF redirects for process sandboxes (src/runtime/process/network.rs), guest rules plus host gateways on thevmtier. Address rules (egressAddresses) are the process tier’s, with kernel policy. A tier or node that doesn’t announce a policy refuses it by name;gvisorandwasmrefuse hostname egress (tiers.md). - Gateways resolve once, refuse a name if any answer is non-public, an address of this host,
or one the sandbox’s rules refuse, and dial that resolution only
(
src/runtime/egress/gateway.rs). - Always refused: this host’s own addresses, link-local and cloud metadata addresses, and
other nodes’ sandbox and API ports on private addresses (
src/isolation.rs, bpf.md, vm.md). - Outbound on a sandbox’s behalf. Agent URL transfers and control’s webhooks pin a public DNS
answer, refuse private ones and redirects, and keep TLS verification
(
agent/src/transfer_target.rs,control/src/webhook-target.ts). - Ingress reaches a sandbox only on ports hermitboxd published for it, from the edge or control.
Never trusted from the network side: DNS answers, proxy variables in the sandbox, raw IP targets, a guest’s own firewall.
Node and control
- Mutual TLS. The node API is TLS 1.3 only, with no 0-RTT; a client certificate must chain to
the host’s
client_ca, carryclientAuthand name an allowed client (src/api/tls.rs). A node’s key is made on the node and never sent (src/fleet/enroll.rs,src/fleet/identity.rs). Joining trusts the fleet CA only once it matches the token’s hash (src/fleet/token.rs,src/cli/join.rs), and enrollment or renewal naming another CA is refused. Control pins each node’s current client certificate and uses session ids and sequence numbers to catch two hosts sharing one identity (control/src/node-endpoint.ts,control/src/registry.ts). - Epochs and fencing. Control raises a placement’s epoch only by compare-and-set
(
control/src/ledger.ts). Every mutating node verb checks it withcheck_epoch(src/manager/error.rs): start, suspend, exec, export, snapshot and restore need exactly the copy’s epoch; stop, kill and delete accept it or newer; a superseded copy refuses all but teardown. A fence stops a copy, keeps its data, and never starts it again (src/manager/fence.rs). A move fills the new copy before it fences the old one (control/src/rehoming.ts), and the edge closes connections from older epochs (edge/src/routes.ts). - Execution lease. A node restarts or resumes on its own only while its last heartbeat’s lease
lasts (
src/manager/fleet.rs,src/manager/restarts.rs). No timer declares a host lost: an operator confirms it after fencing it outside hermitbox (operations.md). The opt-in object-store lease adds a watchdog that freezes and kills a leased cgroup when its term ends, and control displaces a copy only after winning a conditional fence in the store (src/store_lease/guard.rs,control/src/store-lease.ts, store-lease.md). - Never trusted from control: a request for weaker isolation than host policy, an image outside
allowed_images, an unannounced field (refused with422), or an upgrade that fails the checks below. Control decides what runs; it can’t decide how weakly. - Never trusted from a node: a heartbeat for another node, a certificate that isn’t that node’s pinned one, or observations for a placement it doesn’t hold (protocol.md).
Edge, sandbox and client
- Edge to control uses the private
/edge/v1with a bearer edge token compared in constant time (control/src/edge-api.ts). - Sandbox capabilities are
pa1.tokens the node signs with Ed25519. They name one sandbox, one epoch and a scope (sandbox,routesorfile), live at most five minutes with 30 seconds of clock skew (agent/src/auth.rs), and the edge verifies them offline before any wake (edge/src/sandbox-token.ts,edge/src/sandbox-proxy.ts). A route-only capability can list port assignments but can’t run commands or read data; a file URL is one path and one method for at most a minute (agent.md). The project key never reaches a sandbox. - Client to API. A project key is a bearer key stored only as its SHA-256
(
control/src/keys.ts), and reaches only its own project. The operator API listens apart, on loopback by default, behind the operator token (control/src/operator-api.ts,control/src/config.ts). Authenticated requests are audited before they change state, without headers, bodies or query strings (control/src/audit.ts). - The edge binds its public fronts on purpose (
edge/src/config.ts); its metrics stay on loopback. It terminates TLS only for agent and exposed-port hostnames; ordinary TLS routes pass through untouched.
Releases, joins and bundles
- Upgrades (
src/upgrade/trust.rs). Before anything is downloaded, a node checks that the offered version isMAJOR.MINOR.PATCHand no older than its own, and that the offer carries an ML-DSA-65 signature (FIPS 204), by one of the public keys compiled in fromdeploy/release-keys.pem(a release key and a recovery key), over exactlyhermitboxd release, the version and the lowercase sha256, one per line. It then keeps the download only if its sha256 matches and it prints the offered version, and rolls back if it doesn’t reconcile and beat in time (src/upgrade.rs). Only a debug build also takes the keyHERMITBOXD_TEST_RELEASE_KEYnames. A control plane or its fleet CA can pass a signature on but can’t make one. - Joins and installs. The CLI verifies the fleet bootstrap and the server asset manifest with
the same compiled keys; the fleet CA authenticates transport only
(
cli/src/join-trust.ts,cli/src/bundle-trust.ts). Preview builds carry a separate identity that can’t replace production keys (install.md). - Pinned upstream. The VM descriptor comes from the signed installation, never a workload, and
pins its bundle by size, SHA-256 and a per-file inventory checked before any program runs
(
src/runtime/vm/policy.rs,src/runtime/vm/bundle.rs). The agentOS distribution is checksum-pinned (src/config/wasm.rs); gVisor and bubblewrap are pinned releases; Rust dependencies are locked and checked bydeny.toml. - Tenant images are untrusted input: allowed only by host prefixes, and on the
vmtier each layer is checked against its digest and converted by confined tools (vm.md).
Storage and object store
- Exports and snapshots go to presigned URLs, used once and never logged or stored; their query
strings are redacted wherever they are printed (
src/protocol/transfer.rs). - A restore is checked against the sha256 control recorded, unpacked with links, devices and
traversal refused, assembled in
data.restoring/and swapped in whole (src/store/restore.rs,src/tarball.rs). - The store lease trusts the store’s
Dateand linearizable conditional writes, and nothing else (store-lease.md). Archive contents are never trusted.
Invariants a change must keep
- A request never relaxes the host’s hardening. Capabilities, mounts, images, users, network
rules and limits come from host configuration (
src/config.rs); a request can’t remove a deployment requirement (control/src/public-model.ts). - A requested isolation or capability is given or refused, never weakened in silence. A named
tier is never substituted, and a mutation is never retried on another tier
(
src/runtime/router.rs,src/manager/tiers.rs); required features are checked on create and on an unchanged wake (control/src/workload-capabilities.ts); unannounced guarantees read false (control/src/guarantees.ts). - No walk follows a link out of a sandbox’s data (
src/tree.rs). - No secret value in a record, label, log, view or error. Secret values have no
Debugand never enter the spec digest (src/protocol/spec.rs); control seals them at rest (control/src/sealed-secrets.ts); signing keys stay out of records and responses (agent/src/auth.rs). - No listener on a public address unless it is meant to be. An unauthenticated listener may
bind only loopback or a private address (
private_or_loopbackinsrc/config.rs); workload ports are private; the edge’s fronts are the intended public ones. - Certificate checks are never loosened. mTLS stays TLS 1.3 with client certificates, and no HTTPS call turns off certificate or hostname verification. The one unverified fetch, the fleet CA at join, is checked against the token’s hash before anything uses it.
- A mutating verb checks the epoch through
check_epoch. - A restore never touches current data before it is whole.
- A snapshot’s deletion never drops the only copy. Rest uploads before it releases local data
and keeps it if the upload fails (
control/src/sandboxes.ts); a node’s local snapshots upload before its copy is deleted (control/src/transfers.ts); a template’s snapshot can’t be deleted while a version uses it. - Verbs that aren’t safe to repeat aren’t retried. Node verbs are idempotent and exec takes an
Idempotency-Key(src/manager/exec.rs); an exec with an uncertain outcome is never replayed (control/src/operations.ts); a container start whose answer timed out is inspected, never repeated (tiers.md). - Copyleft code is never linked.
deny.tomladmits permissive licences; GPL and LGPL programs run as separate executables; every licence is in decisions.md before use. - Only signed hermitboxd runs on a node, and never an older one (
src/upgrade/trust.rs).
Known limits and accepted risks
- The process tier shares the host kernel. A kernel escape from a process sandbox escapes its enclosing container. In the plain mode it has no PID, mount or network namespace.
- Shared-UID process sandboxes (an ordinary-user install) share per-UID limits and may signal
each other and same-user services. Use them only for mutually trusted work; creation can require
separate-users. - Without kernel network policy, Internet-enabled process sandboxes can dial the host’s and
neighbours’ listeners, separate UIDs or not. An Internet-enabled process sandbox never has
private-network. - Without delegated cgroups, process memory is a sampled budget, not a hard cap.
- Wasm shares one sidecar with no per-VM CPU rate; host service limits bound it as a whole.
- Containers share the host kernel; rootless Docker is refused at
data-owner-mapping; Podman has no host firewall. - The
vmtier needs x86_64 and KVM that hermitboxd’s user can open. Elsewhere it is off and avmrequest is refused. A move between two VM nodes is untested (vm.md). - The store lease is an opt-in prototype with stated assumptions, not a hard real-time fence. Without it, failover waits for an operator’s confirmed fence.
- A compromised fleet CA cuts nodes off until each re-enrolls; dual CA trust isn’t implemented.
- The edge sees agent and exposed-port traffic in clear, since it terminates that TLS.
- Not post-quantum today: release, bundle and join signatures are ML-DSA-65, but sandbox
capabilities are Ed25519; the node mTLS key exchange uses rustls’s ring provider, whose groups are X25519 and NIST
curves (
src/tls.rs); public WebPKI certificates and SSH host keys (Ed25519,agent/src/tools/ssh.rs) are classical too.
Reporting
Report a weakness privately, as SECURITY.md says. Don’t open a public issue.
$curl -fsSL https://hbx.sh | shInstall Hermitbox and set it up for me