Problem Statement / Feature Objective
The STUN/TURN relay endpoint cache accepts binding updates from any peer without authenticating the relay-origin claim. A malicious node can poison the cache by advertising itself as a relay for arbitrary target peers, causing traffic to be misrouted through the attacker's node.
Technical Invariants & Bounds
- Cache entry TTL: 300s (configurable 60-600s).
- Max cached endpoints per peer: 16.
- Poisoning detection: >5 incorrect relay claims within 60s triggers blacklist.
- Relay authentication: must present a signed ticket from the relay registry.
- Cache size limit: 10,000 entries total.
Codebase Navigation Guide
src/net/relay/endpoint-cache.rs — cache read/write operations.
src/net/relay/relay-registry.rs — authoritative relay registry.
src/net/relay/stun-bind.rs — STUN binding request handler.
src/attestation/relay-ticket.rs — signed ticket generation and verification.
Implementation Blueprint
- In
relay-ticket.rs, implement a ticket scheme: relay signs (relay_id, target_id, epoch, expiry) with its Ed25519 identity key.
- In
endpoint-cache.rs, reject PUT operations where the ticket verification fails or the ticket's target_id does not match the cache key.
- Add a poison-penalty counter: on failed verification, increment peer penalty; at threshold, drop all entries from the offending peer.
- In
stun-bind.rs, attach a ticket to every STUN binding response before forwarding to cache.
- Fuzz test: submit 1,000 malicious binding updates with forged tickets, verify zero cache-poisoning successes.
Problem Statement / Feature Objective
The STUN/TURN relay endpoint cache accepts binding updates from any peer without authenticating the relay-origin claim. A malicious node can poison the cache by advertising itself as a relay for arbitrary target peers, causing traffic to be misrouted through the attacker's node.
Technical Invariants & Bounds
Codebase Navigation Guide
src/net/relay/endpoint-cache.rs— cache read/write operations.src/net/relay/relay-registry.rs— authoritative relay registry.src/net/relay/stun-bind.rs— STUN binding request handler.src/attestation/relay-ticket.rs— signed ticket generation and verification.Implementation Blueprint
relay-ticket.rs, implement a ticket scheme: relay signs(relay_id, target_id, epoch, expiry)with its Ed25519 identity key.endpoint-cache.rs, rejectPUToperations where the ticket verification fails or the ticket'starget_iddoes not match the cache key.stun-bind.rs, attach a ticket to every STUN binding response before forwarding to cache.