qqt

Security

The tunnel’s security model

Mutual TLS, cert custody, the validity window and revocation — what holds, and what it does not claim.

|hadron|: QQT-004 the client certificate is the whole access-control surface in both directions — a holder may make the server dial any target it can reach and, with -R, bind any address and port its process can bind; the client in turn dials only the targets it registered, so a compromised server gains no dial authority the client did not name.

Reporting

Found something? Open an issue on the project’s repository with a title prefixed security:. This is a young project maintained in spare time — reports are read, fixed, and credited. Please include the qqt version (qqt -V), both sides’ log lines, and a reproduction if you have one.

The trust model — read this before deploying

qqt is a trusted-crew tool. The mutual-TLS client certificate is the entire access-control surface, and a certificate holder is considered fully trusted. Concretely:

  • The server dials whatever a certified client names. Loopback, the metadata address, internal ranges — anything the server process can reach. There is no dial allow-list, and the server does not inspect the TLS ClientHello’s SNI (the client pins SNI to quic-tun and verifies the server certificate against it; both sides require the ALPN quic-tun).
  • No per-connection or per-stream caps beyond qqt’s own stream ceiling. A connection may open up to MAX_STREAMS (1024) concurrent streams — that is qqt’s raised limit, not quinn’s default of 100; nothing limits how many connections a client (or many clients) may hold, and no per-stream deadline exists. A hostile-but-certified client can pin all 1024 stream slots of a connection with incomplete stream headers, and keep them pinned while it keeps any traffic flowing (the 60 s idle timeout only fires on a fully silent path).
  • The server binds whatever a certified client names (reverse forwards). A -R spec makes the server listen on any address and port its process can bind, and whatever connects there reaches whatever the holder’s client dials — the dial authority, mirrored. A port below 1024 needs the server process to hold the privilege to bind it; a bind the server cannot make is reported to the client and costs nothing else. One control frame names at most 4096 listeners, so a single client cannot pin the server’s whole fd budget from one frame. On the client side the reverse header is validated against the registered -R targets: a server may only make the client dial what the client itself named, so a compromised server gains no arbitrary dial authority into the client’s network. A refused bind is not always instant: an in-use port is retried for ~70 s (a redial can race the server’s reaping of a dead predecessor) before the client is told.
  • If your certificate holders are less than fully trusted, the compensating controls are firewall rules on the server’s egress and distinct CAs per trust boundary (a client cert from CA-A never authenticates against a server trusting CA-B). qqt does not pretend to enforce what it cannot see.

Certificate custody

  • gencert mints a private CA plus server and client role sets; the CA key stays with the operator — treat it like a root password. In the per-customer model (qqt mint), each customer’s client cert chains to their own CA and the operator’s keyset only authenticates the server — the operator holds no key that admits a client.
  • Leaf certificates carry a 365-day validity window by default (--valid-days; the CA 3650), enforced by the TLS handshake on both sides — an expired leaf stops admitting on its own. A CA’s own window is not date-checked by the verifier (webpki treats a trust anchor as trusted whatever its dates), so a CA is retired by removing it from the server’s bundle or revoking it, never by waiting for it to expire. qqt expiry reports both windows; the leaf is the one the handshake enforces, so that is what the re-mint gates on.
  • Certificates can be revoked: qqt revoke appends a SHA-256 fingerprint to a flat list, and the server re-reads the list at every handshake and closes any connection whose presented chain (leaf or CA) contains a match. Because a client decides what it presents, the server also resolves the leaf’s issuer from its own trust bundle, one hop: a CA on the list kills every leaf it signed directly, whether or not the client ships the CA block. A customer who mints under their own intermediate is offboarded by removing that CA from the bundle — the one-hop resolution does not walk a sub-CA tree. There is no CRL, no OCSP. The bounds: the check sits after the handshake (a live connection keeps its streams until it drops or the server restarts), the client has no revocation check of the server cert, and the list file must not be attacker-writable on the server box — whoever can edit it can un-revoke. A trust bundle that cannot be read is fatal, not ignored: the admission roots are built at startup and the file is re-read on every accept, so a malformed bundle stops the server (a supervised unit restarts it) rather than admitting anyone with revocation undecided. The runbook is docs/instructions_qqt-remint.md.
  • Keys are written 0600, certs 0644, directories 0700, with atomic temp-file writes; two concurrent gencert runs serialize on a lock. The cert directory must not be attacker-writable — anyone with write access there can pre-plant symlinks that the atomic-write temp names follow, or simply swap PEMs. On the operator machine that means: the operator machine is part of the trust boundary.

What the TLS layer enforces (and what it does not)

Verified against the exact dependency versions this project pins (rustls 0.23, rustls-webpki 0.103 via quinn 0.11):

  • Every handshake requires a client certificate chaining to a CA in the server’s trust bundle (the bundle PEM may hold several CAs — the per-customer minting model); there is no anonymous mode, no plaintext mode, no token.
  • The end-entity certificate’s validity window (not_before / not_after — 365 days by default) is checked against the current time at every handshake, on both sides.
  • The verifier requires the end-entity certificate’s EKU to permit client authentication when an EKU extension is present (RFC 5280 semantics: an absent EKU is unrestricted and would also authenticate — gencert-minted client certs always carry the ClientAuth EKU).
  • The CA certificate itself cannot be presented as a client certificate (CA-basicConstraints end-entities are rejected), so the public CA cert — which ships everywhere — grants nothing without its key.
  • Non-CA role certificates cannot act as intermediate signing CAs, and chains are limited to six subordinate CAs; only the operator-held CA key can ever mint an intermediate, and gencert mints none.
  • The handshake is TLS 1.3 only (QUIC requires it), with the ring provider pinned at startup so a future second crypto-provider dependency cannot turn into a runtime panic.

QUIC posture

  • QUIC’s anti-amplification limit (at most 3× received bytes toward an unvalidated address) is enforced by the transport. A spoofed-source handshake cannot complete — the spoofer never sees the server’s flight — it can only cost the server bounded reply bytes and handshake state until timeout.
  • The server does not issue QUIC stateless retries (address validation happens implicitly at handshake completion). If you expose the UDP port to genuinely hostile networks, that is the first hardening knob to consider.
  • Address-validation tokens are single-use-checked via a bloom filter.

Supply chain

  • Builds are reproducible: cargo build --release --locked against the committed Cargo.lock (the runbook’s install path).
  • The lockfile passes cargo audit (0 findings at the time of the last review) and the declared minimum toolchain is enforced by CI.
  • Direct dependencies are deliberately few: quinn (QUIC), rustls + ring (TLS, and the SHA-256 fingerprints the revocation list keys on), rcgen (cert minting; its x509-parser feature reads existing certs for leaf re-mints and qqt expiry), time (validity-window math and formatting), tokio (runtime), clap (CLI), fs2 (the gencert lock), dirs (home fallback).

← All documentation