0b2480bf83
- The expanded ML-DSA-65 key is 34,992 bytes on the stack (QA measured; A_hat's rows are boxed inside ml-dsa), not 64 kB, and it is exactly the secret part. src/sign.rs and docs/02_signatures.md corrected. - S-04: ml-dsa's signing loop leaves rnd, rho'' and y on the stack; a leaked y gives s1. Recorded in docs/02 and docs/THREAT_MODEL.md, with the key-construction stack copy. - S-07: under open question 1, the recommendation for Day 3: a separate, freshly generated composite identity, never a wrapped Tessera Ed25519 seed (RFC 10073 3.1); from_bytes cannot detect reuse (also on its docs). - S-08: verify_binding does not tie id to vk and has no serial; both are the caller's, with the Day 3 replay rule (QA E-07); also on its docs. - S-12: decoded on 2026-11-26, none of the 9 ML-DSA-65 "modified z" sigVer cases at a7f283cd reaches the z infinity-norm bound (max 524,077 < 524,092), so no ACVP case could be added; only Wycheproof covers it. - S-05, S-10, S-11 noted under "As built" and gaps.
70 lines
6.2 KiB
Markdown
70 lines
6.2 KiB
Markdown
# Arcanum threat model
|
||
|
||
Scope: the `arcanum` crate v0.1.0 — the X-Wing hybrid KEM, the mutual exchange, the key schedule, the WireGuard PSK
|
||
derivation and the sealing helper. **Not audited.**
|
||
|
||
## Assets
|
||
|
||
1. The responder's hybrid secret key (a 32-byte seed).
|
||
2. Each exchange's shared secret and the `Session` derived from it.
|
||
3. Each epoch's WireGuard pre-shared key.
|
||
4. The plaintext inside a sealed box.
|
||
|
||
## Adversaries and what Arcanum protects against
|
||
|
||
| Adversary | Can do | Protected? | Why |
|
||
|:--|:--|:--|:--|
|
||
| **Harvest now, decrypt later** | Records every control-channel message and WireGuard packet today; gets a large quantum computer later | **Yes**, the main goal | The PSK comes from X-Wing. Shor breaks X25519, but ML-KEM-768 is believed to resist quantum attack, and X-Wing's secret is secure if either half is. WireGuard mixes the PSK into its key schedule, so recorded traffic stays confidential. |
|
||
| Classical passive eavesdropper | Records traffic, no quantum computer | Yes | Both halves hold. |
|
||
| A future break of ML-KEM (cryptanalysis or an implementation bug) | Recovers `ss_M` | Yes, classically | X25519 still protects the secret (hybrid). |
|
||
| A break of X25519 | Recovers `ss_X` | Yes | ML-KEM still protects it. |
|
||
| Active attacker who modifies ciphertexts | Flips bytes in transit | Detected or harmless | Changed `ct_M` → ML-KEM implicit rejection gives an unrelated secret; changed `ct_X` → different `ss_X`; the transcript hash binds both. The peers' PSKs differ and WireGuard simply fails to handshake. Low-order X25519 values are rejected with a typed error. |
|
||
| Malformed or hostile input | Sends wrong lengths, invalid ML-KEM keys, random bytes | No panic, typed error | Tests 5 and the fuzz target. |
|
||
| **Impersonating one peer** (QA A-15) | Knows both public keys, sends its own encapsulation as if from the initiator | **Yes** | The exchange is mutual: the PSK needs both directions' secrets, and the responder's encapsulation goes to the real initiator's key. Without that secret key the attacker cannot compute the PSK, even after breaking WireGuard's X25519 keys. |
|
||
| Epoch confusion | Replays an old exchange for a new epoch | Harmless for secrecy | The epoch is in every PSK derivation; an attacker who cannot decapsulate cannot compute any epoch's PSK. Refusing to re-install an old PSK (rollback) is the caller's job: Arcanum keeps no state. |
|
||
|
||
## What Arcanum does NOT protect against
|
||
|
||
| Not protected | Why, and who has to handle it |
|
||
|:--|:--|
|
||
| **Endpoint compromise** | Malware on a device reads keys and plaintext from memory. Zeroisation narrows the window; it does not close it. Keys at rest belong in Custos or Tessera. |
|
||
| **Traffic analysis** | Who talks to whom, when and how much is visible on the wire. Padding and cover traffic are the Stealth transport's job (Day 7), and only partly. |
|
||
| **Substituted public keys** | The mutual exchange authenticates whoever holds the secret keys matching the public keys each side was *given*. An attacker who gets a peer to accept her public key in place of the real one learns that exchange's PSK. In Via, WireGuard's static keys still authenticate the tunnel classically, so this falls back to classical security, not to plaintext. Via must distribute both hybrid public keys signed with Tessera (Day 3). If those signatures are classical (Ed25519), a quantum attacker who can forge them can substitute keys; ML-DSA closes that later. |
|
||
| **Theft of static secret keys later** | With static key pairs, whoever later steals both secret keys and has recorded the exchanges can recompute their PSKs. Day 3 must add an ephemeral key pair per exchange (as Rosenpass does) or rotate key pairs. |
|
||
| **Bad randomness** | The caller supplies the RNG. A broken RNG breaks every scheme. The `_derand` functions exist only with the off-by-default `hazmat` feature, for known-answer tests; reusing their seeds is catastrophic. |
|
||
| **Side channels** | Timing and cache behaviour are those of `ml-kem`, `x25519-dalek`, `sha3` and `chacha20poly1305`. Arcanum adds only fixed-length, data-independent glue, but has not been measured. |
|
||
| **Reusing one session for many epochs** | Supported, but a leaked session reveals every epoch's PSK derived from it. Forward secrecy needs one exchange per epoch. |
|
||
| **Denial of service** | An attacker on the path can always drop packets. |
|
||
| **Legacy peers** | Classic WireGuard peers (routers, third-party clients) get no Arcanum PSK and are labelled "not post-quantum" by Via. |
|
||
|
||
## Trust assumptions
|
||
|
||
- ML-KEM-768 is IND-CCA2 secure against quantum adversaries (FIPS 203).
|
||
- X25519 is a secure Diffie–Hellman group against classical adversaries (RFC 7748).
|
||
- SHA3-256, SHAKE256 and HKDF-SHA-256 behave as their standards say; X-Wing's security argument
|
||
(draft-connolly-cfrg-xwing-kem-11) holds.
|
||
- The vetted crates implement those standards correctly; the known-answer tests check the parts
|
||
Arcanum uses, not everything.
|
||
- The caller authenticates the responder's public key and supplies a cryptographically secure RNG.
|
||
|
||
## Blast radius if Arcanum is wrong
|
||
|
||
Via uses Arcanum only as the WireGuard PSK. A total failure of Arcanum (for example, both peers
|
||
derive a predictable PSK) reduces a Via tunnel to plain WireGuard: still authenticated and encrypted
|
||
classically, but open to harvest-now-decrypt-later. It never reduces it below WireGuard. Sealing
|
||
(Custos, Tabellarius) is different: there Arcanum is the only layer, which is why those migrations
|
||
wait for the audit.
|
||
|
||
## Residual memory exposure
|
||
|
||
Moves in Rust copy stack bytes, and `zeroize` cannot reach those copies; hash and HMAC states are
|
||
wiped only as far as the crates' `zeroize` features go. A process memory dump taken while Arcanum
|
||
runs may contain key material. That is accepted for v1 and is one more reason keys at rest live in
|
||
Custos or Tessera, not in Arcanum's callers.
|
||
|
||
v0.2.0 adds two stack exposures in signing, both accepted on the same terms: building a `SigningKey`
|
||
moves the 35 kB expanded ML-DSA key (s1, s2, t0 and their NTT forms) through the stack before it is
|
||
boxed, and `ml-dsa`'s signing loop (`try_raw_sign_mu`) leaves `rnd`, ρ'' and the mask y on the stack
|
||
unwiped after every signature. A leaked y, with the public z, gives c·s1 and so s1. Neither is
|
||
reachable from Arcanum, and neither is visible to the heap allocator probe (QA S-04, PR #2).
|