ostp/ostp-core/src/crypto
ospab f904695760 fix(server): rate-limit + cache the O(N_keys) handshake trial path (CPU DoS)
Every datagram from an unrecognized source ran the full key-trial loop:
for each registered access key, an HKDF (derive_all_secrets) plus two
HMACs (junk markers) plus a Noise read. A garbage flood from spoofed
sources could therefore force unbounded O(N_keys) crypto per packet — a
CPU-amplification DoS with no throttle (the existing token bucket only
guarded the roaming path, not this one).

Two mitigations:
  - Memoize the per-key derived secrets (pure function of key+version) and
    the per-window junk markers, so the trial loop is now cheap comparisons
    plus one Noise read per key instead of HKDF+2*HMAC per key per packet.
    Also speeds up every legitimate new connection. Caches are pruned in
    on_tick when keys are deleted.
  - Gate the trial path behind a global token bucket (TRIAL_RATE=100/s,
    same burst). The established-session fast path and roaming are not
    gated, so live sessions are unaffected; only unknown-datagram trials
    are bounded. Over-budget datagrams are dropped silently.
2026-07-11 21:18:05 +03:00
..
aead.rs Initial public release: Ospab Stealth Transport Protocol v0.1.0 2026-05-14 21:41:54 +03:00
mod.rs feat(core): time-rotating junk marker — kill the static per-user fingerprint 2026-07-09 14:43:40 +03:00
noise.rs fix(crypto)!: derive transport keys from DH-inclusive Noise Split, not the handshake hash 2026-07-11 21:14:15 +03:00
obfuscation.rs fix(server): rate-limit + cache the O(N_keys) handshake trial path (CPU DoS) 2026-07-11 21:18:05 +03:00
obfuscation_tests.rs feat(core): time-rotating junk marker — kill the static per-user fingerprint 2026-07-09 14:43:40 +03:00