Threat model
This page summarises MiraServe's threat model: the assets it protects, the trust boundaries inside a deployment, the seven threat classes it is designed against with the mitigations for each, and what it does not try to protect against. The full document, docs/THREAT_MODEL.md, will be published with the source code.
Protected assets
| Asset | Sensitivity | If compromised |
|---|---|---|
| TLS private keys and ACME account keys | Critical | Traffic impersonation, interception, unauthorised certificate issuance |
| Upstream credentials (mTLS keys, OAuth secrets, API tokens) | Critical | Movement into internal backends, databases and MCP servers |
| Publishing signing keys and the release store | Critical | Site defacement or malicious JavaScript in self-updating sites |
| Host files outside configured document roots | High | Disclosure of files such as /etc/passwd, .env or SSH keys |
| Worker availability and memory | High | Denial of service, data leaking between tenants |
| MCP tool access policies | High | Agents invoking destructive backend tools |
| Request and response confidentiality | Medium to high | Exposure of personal data, session cookies, SNI metadata or secret headers in logs |
Trust boundaries
Everything arriving from the internet is untrusted. It reaches a sandboxed worker process, which in turn crosses six boundaries:
| Boundary | Between | Enforced by |
|---|---|---|
| TB-1 Network edge | Clients and the worker | TLS 1.3 with post-quantum key exchange; QUIC anti-amplification |
| TB-2 Key daemon | Worker and miraserve keyd | A restricted local socket offering only a signing operation |
| TB-3 WASM sandbox | Worker and plugins | Wasmtime with fuel, memory and capability limits |
| TB-4 Filesystem | Worker and the host filesystem | cap-std directory handles (openat2 with RESOLVE_BENEATH on Linux) |
| TB-5 Publish gate | Publishers and the live site | Ed25519 signatures and pre-flight checks before the atomic swap |
| TB-6 Backends | Worker and upstreams | mTLS reverse proxy, out-of-process PHP-FPM over FastCGI, the MCP gateway |
Threats and mitigations
T1. Memory corruption and crash-induced denial of service
Threat: malformed HTTP/1.1, HTTP/2, HTTP/3, QUIC, FastCGI or configuration input causing buffer overflows, use-after-free, integer overflows or panics.
- Unsafe Rust is forbidden in the high-level crates; the few operating-system calls that need it are confined to the sandbox crate.
- Panicking shortcuts (
unwrap,expect,panic) are denied by lint, so bad input produces an error rather than a crash. - No OpenSSL; TLS uses
rustlswithaws-lc-rs, and dependency policy bans OpenSSL crates. - Fuzz targets on the parsers that handle untrusted input.
T2. TLS private key theft
Threat: a bug in the worker, a dependency or an extension exposes worker memory (the Heartbleed class of bug).
- Optional split-daemon mode keeps private keys in
miraserve keyd; the worker requests signatures and never holds the key bytes. See key isolation. - Short-lived ACME certificates (6 days) with ACME Renewal Information limit how long a leaked key is useful.
- Secret buffers are zeroed when dropped.
T3. Harvest-now-decrypt-later and SNI surveillance
Threat: a passive observer records handshakes to decrypt later with a quantum computer, or tracks visited sites through the unencrypted server name (SNI).
- TLS 1.3 only by default, with the
X25519MLKEM768post-quantum hybrid key exchange preferred. - Encrypted Client Hello (ECH) key rotation and DNS record helper.
T4. Request smuggling and protocol-level denial of service
Threat: ambiguous Content-Length and Transfer-Encoding headers desynchronising proxy and backend; HTTP/2 Rapid Reset or CONTINUATION floods; QUIC amplification; slow header trickles (Slowloris).
- A strict HTTP normaliser rejects duplicate
Content-Length, bothContent-LengthandTransfer-Encoding, folded header lines and invalid header bytes. - Per-connection caps on HTTP/2 stream resets,
CONTINUATIONbursts, header compression memory and concurrent streams. - Required timeouts for the TLS handshake, header read, minimum body rate and idle keep-alive.
- QUIC's three-times anti-amplification limit and retry tokens.
T5. Path traversal, symlink escape and legacy CMS compromise
Threat: ../ traversal, encoded tricks, symlink races, or PHP executed from a WordPress uploads directory.
- Static files are opened only through
cap-stddirectory handles, which stop symlink escapes at the operating-system level. - PHP runs only in a separate PHP-FPM process, never inside MiraServe.
- The
wordpress-hardenedpreset denies dotfiles, blocksxmlrpc.phpand PHP under uploads, and rate-limitswp-login.php. See PHP and WordPress.
T6. Malicious AI agent publishing and MCP tool abuse
Threat: a prompt-injected or unauthorised agent overwrites a self-updating site with phishing or script injection, or calls privileged tools such as db_drop or shell_exec.
- Publishing requires an Ed25519 signature or a scoped token, runs pre-flight checks (secret scanning, size limits, optional CSP validation), stores immutable releases and supports instant rollback. See atomic publishing.
- The MCP gateway enforces OAuth (RFC 9728 metadata), tool allow and deny lists with default deny, JSON size and depth limits, and redacted audit logs. See MCP security gateway.
- RFC 9421 Web Bot Auth verifies bot identity cryptographically instead of trusting the
User-Agentheader.
T7. Malicious or buggy plugins
Threat: an infinite loop, memory exhaustion or file theft inside a third-party plugin.
- Plugins run only as WebAssembly in Wasmtime, with fixed memory ceilings, CPU fuel limits and no access to files, network or environment. See WASM plugins.
Out of scope
The threat model states three explicit non-goals:
- MiraServe does not make backend application logic secure. An SQL injection in an upstream PHP or Node application remains a vulnerability, although presets and edge filtering reduce common exploit paths.
- MiraServe does not protect against a compromised root account or a compromised kernel on the host.
- MiraServe does not absorb network-layer floods that saturate the link; that needs upstream filtering such as anycast or scrubbing services.
How this maps to the current release
The threat model describes the design. In the current alpha, a few points differ in practice:
- Key isolation is opt-in. The default is
key-isolation "in-process", where TLS keys are in worker memory. Split-daemon mode cannot be used with built-in ACME. - Short-lived certificates apply only to certificates obtained through the built-in
acmeblock, where they are on by default. Certificates you supply yourself keep whatever lifetime they were issued with. - ECH is not active.
checkrejectsech,ech-public-nameandech-rotate, because server-side ECH decryption is not yet available in the TLS library. - Landlock and seccomp are Linux only. On other platforms, file confinement relies on
cap-stdhandles. - MCP tool lists apply per route, to every authenticated caller of that route, and policy is enforced on
tools/call; other MCP methods are forwarded after authentication. - Publishing pre-flight checks inspect markup, not separate JavaScript files.
To report a weakness in any of these areas, see reporting a vulnerability.