Skip to content

Threat Model

This document describes the current security model for Witness. It is not a formal audit.

Security Goals

Witness aims to provide:

  • evidence that a SHA-256 hash existed no later than a stated time: a receipt carrying at least a majority of distinct signer signatures, each binding that signer's own clock reading; backdating requires every counted signer to collude
  • a log whose checkpoints signers only sign when they extend the checkpoint each signer last signed, so getting two conflicting histories signed requires at least 2m - N signers (threshold m of N) to sign both
  • verifiable key changes (key epochs), with old receipts handled according to whether the old keys were retired routinely or after compromise
  • content privacy by accepting hashes instead of user content
  • public verification of attestations against a network configuration
  • secret-free distribution of the public verification configuration
  • append-only log proofs for light clients and auditors
  • bounded admission and deployment-level abuse control for public gateways

Non-Goals

Witness does not currently provide:

  • proof of content authorship or ownership
  • global ordering across independent Witness networks
  • consensus, finality, or Byzantine fault tolerance beyond the configured required signer count
  • content confidentiality if clients upload content elsewhere or include identifying metadata
  • anonymity against an operator who correlates IP addresses, timing, User-Agent strings, application identifiers, or reverse-proxy logs
  • protection from timestamp spam beyond configured admission controls
  • tamper-evident operator logs outside the signed tree-head/proof model
  • log completeness: the gateway can leave a receipt out of the log; clients that need logging must check inclusion (--require-log-inclusion)
  • an accurate clock where every signer shares the same wrong time source
  • external durability from third-party systems: anchor providers and federation cross-anchoring were removed in v0.9

Assets

Important assets include:

  • signing server private keys
  • signing bearer tokens
  • gateway SQLite databases
  • gateway network configuration files
  • admin API keys, metrics tokens, and WebSocket tokens
  • release artifacts and container image provenance
  • published SDK contents and dependency metadata

Actors

Actor Capability
Honest client Submits a hash and verifies the returned attestation.
Spam client Attempts to create many attestations cheaply.
Malicious gateway Attempts to omit data, equivocate, or expose metadata.
Compromised signer Signs invalid or misleading attestations.
Signer collusion Controls enough signers to satisfy the required signer count.
Network attacker Observes or modifies traffic when TLS/proxy policy is wrong.
Admin attacker Obtains admin key/session, database access, or deployment config.

Assumptions

  • Clients verify returned attestations against the correct network config.
  • GET /v1/network is treated as a source for a secret-free NetworkVerificationConfig; /v1/config is informational and is not a trust anchor. Clients pin or independently review verification configs when a stronger trust anchor is required.
  • Signing keys are generated with a secure RNG and stored on protected hosts.
  • Signing bearer tokens are high entropy and not reused across unrelated deployments.
  • Production traffic uses HTTPS at the edge.
  • Reverse proxies forward client IP headers only when their CIDRs are explicitly configured in WITNESS_TRUSTED_PROXIES.
  • Public gateways require an operator-controlled admission boundary.
  • Operators back up gateway databases and configuration before upgrades.
  • Operators ensure the configured signing servers are actually independent — the protocol cannot detect three keys on one host.
  • Each signer keeps its checkpoint state file; a signer that loses it accepts the next checkpoint as a fresh start.
  • Signers use independent, synchronized time sources.

Threats and Mitigations

Single signer or key compromise

A compromised signer contributes one bad signature. The receipt is only accepted when the configured required signer count of distinct, individually verified signatures is present, so one compromised key does not by itself produce an accepted receipt. Clients that verify locally are unaffected by a gateway that tries to present fewer signatures.

Residual risk: the compromised signer can still sign misleading data, and a colluding set that reaches the required count can produce an accepted receipt. The signer count is an operator-chosen trust assumption, not agreement.

After a key compromise, operators publish a compromise key transition naming the last trusted log checkpoint. Receipts from the compromised epoch are then accepted only with an inclusion proof at that checkpoint. Whoever holds the compromised keys can also sign transitions, so clients must re-pin the new key file out of band.

Backdating and clock manipulation

The gateway proposes a timestamp; each signer refuses if it is outside its tolerance and signs its own clock reading (signed_at). Verifiers report the latest counted signed_at as the "existed no later than" bound, which a dishonest signer can only make later. Signers refuse to sign after detecting a wall-clock step and, with require_clock_sync on Linux, while the kernel reports the clock unsynchronized.

Residual risk: a consistently wrong time source shared by all counted signers shifts the bound undetectably; m colluding signers can backdate.

Gateway omission, equivocation, and database compromise

A gateway may omit records, expose metadata, or try to present different log histories to different people. Signers keep the last checkpoint they signed and sign a new one only with a valid consistency proof from it, and the threshold must be a majority, so two conflicting histories can both be signed only if at least 2m - N signers sign both (dishonest or with lost state). For 2 of 3 that is a single signer: one dishonest signer plus a different honest signer on each side is enough, and the signers themselves cannot tell because they do not compare state. Each signer publishes the latest checkpoint it signed (GET /<origin hash>/checkpoint), and witness-auditor --signer checks every signer against the gateway's history, so such a split is detected after the fact by an auditor that can reach the signers. It is not prevented. Higher thresholds raise the number of signers needed. Log leaves commit to the full receipt record (hash, timestamp, sequence, network, epoch), so an inclusion proof shows that exact receipt was logged.

The gateway's separate log key authenticates checkpoint requests to signers. Possession of that key does not meet the signer threshold. Clients can also require signatures from external witnesses they choose. An honest witness that receives both histories will refuse the one that conflicts with its saved checkpoint. This protection depends on the witnesses required by the client policy, not on the gateway's list.

The gateway asks signers to sign the current tree again every WITNESS_CHECKPOINT_REFRESH_SECS (default 600) even without new entries, and the auditor reports a stale checkpoint after --max-checkpoint-age (default 3600). A gateway that stops publishing is therefore noticed.

Residual risk: the gateway can omit a receipt from the log; clients that need logging should require an inclusion proof. A gateway can keep refreshing a log while withholding new submissions; freshness shows the log is alive, not that it is complete. Detection of a split depends on someone running the auditor with access to the signers. Gateway SQLite state is operational data, not itself tamper-evident.

Metadata exposure

The gateway and its infrastructure observe source IP, timing, and client identifiers even though content is never uploaded. /ws/events requires an auth token, and when it is unset the endpoint is disabled (HTTP 503) rather than serving an open stream. Events are sent only after the reconciler confirms and persists an attestation, so submission activity and unconfirmed reservations are not streamed at all.

Public log tiles reveal the log's size and growth but do not list submitted hashes or receipt records. Someone who already has a receipt can use the tiles to verify that the log includes it.

Long-term evidence

Evidence records add a time-stamp authority (TSA) and, later, custodians. A record shows that the document and signed receipt existed by the TSA's time, as far as the TSA is trusted. A dishonest or compromised TSA can issue false times; choose TSAs you would trust independently of the gateway. Custodians and verifiers configure their own TSA roots and Witness pin; certificates inside a record are never trusted on their own. A record must be renewed before its newest timestamp can no longer be verified; if every custodian misses that deadline, it cannot be repaired. CRLs are the only revocation evidence supported, and SHA-256 is assumed to stay collision-resistant.

Admin compromise

An attacker with an admin key/session, database access, or deployment configuration may alter operations, expose metadata, or access credentials. Admin API authentication must be paired with reverse-proxy or network-policy restriction, and database/configuration access must be limited to the service and trusted operators.

Spam, replay, and resource exhaustion

A spam client can submit hashes cheaply. The gateway's per-IP/global limits and active-job capacity are defense in depth; public deployments need an additional operator-controlled admission boundary. A job that cannot complete inside its signing window fails terminally rather than being retried forever under a fresh timestamp.

Network interception and proxy confusion

Without TLS, a network attacker can observe or modify traffic, including hashes and bearer credentials. A misconfigured proxy can also make forwarded client IPs spoofable. Terminate TLS at a trusted edge, keep internal paths trusted, and configure only authoritative proxy CIDRs in WITNESS_TRUSTED_PROXIES.

Outbound requests and SSRF

The gateway makes outbound requests only to URLs in its configuration: signers and external witnesses (network.json, --external-witnesses) and the time-stamp authority and its CRLs (--tsa-url, --tsa-crl-url). Nothing a client sends can choose a destination, so server-side request forgery would need control of the configuration. The gateway checks these URLs at startup, never follows redirects, and ignores proxy environment variables, so requests and signer bearer tokens go only where the configuration says. CRL requests are also limited to the exact configured URLs, because CRL locations can appear inside certificates. Private addresses are allowed on purpose: signers usually run on a private network. Review the configured URLs as an operational control.

Availability and durability failure

Signing servers or storage may be unavailable, and a gateway or disk may fail. Use signer-count-aware monitoring, persistent local SQLite storage, tested backups, and deliberate forward-only upgrades. Availability failure below the required signer count prevents new receipts; it does not invalidate receipts already verified. A database backup does not prove historical honesty.

Privacy Model

Witness only receives SHA-256 hashes. Hash privacy depends on the entropy and guessability of the underlying content. A hash of a public document or small dictionary value can be guessed by anyone who knows the candidate content.

Witness does not hide network metadata. Operators and infrastructure providers may still observe:

  • source IP address
  • request timing and frequency
  • User-Agent or client version
  • gateway account or application identifiers layered above Witness
  • reverse-proxy and load-balancer logs

See Privacy properties.

SDK Wire and Release Controls

The TypeScript SDK uses lossless-json for HTTP responses, request bodies, WebSocket events, and WASM JSON inputs. Generated Rust u64 fields are number | bigint; safe integers remain numbers while larger exact values through u64::MAX remain exact bigints. Unsafe JavaScript numbers and invalid u64 values are rejected. This prevents precision loss from changing a signed attestation, signed_at, or log position before local verification.

Hash values emitted or echoed by the SDK are canonical lowercase hex. This is a representation guarantee, not a substitute for cryptographic verification. WebSocket auth_required challenges without a token stop reconnecting and raise AuthRequiredError; authenticated connections reply within the server window, and close/abort cancels reconnect timers.

The npm package is public but pre-1.0 and unaudited. Its release gate runs build, tests, typecheck, the authoritative generation-drift script, and npm pack --dry-run; the dry-run file list must be reviewed for secrets, generated local state, and missing WASM. Publishing does not imply a security audit or Byzantine-fault tolerance.

Replay And Abuse Model

The gateway has per-IP and global rate limits as defense-in-depth controls and an atomic active-job capacity bound. Public gateways should add deployment-level admission controls and should not rely on these limits alone.

Current High-Priority Gaps

  • external cryptographic and protocol audit of protocol v2
  • signed release artifacts (binary archives are checksummed but unsigned)
  • split views using the 2m - N signer overlap (one signer for 2 of 3) are detected by the auditor after the fact, not prevented; independent checkpoint witnesses outside the signer set (C2SP tlog-witness) would let clients refuse such checkpoints up front
  • withheld submissions: a gateway can keep a log fresh while leaving receipts out of it
  • checkpoint and proof serving reads the full leaf list, which will not scale to large logs