Skip to content

STUN/TURN Endpoint Cache Poisoning via Malicious Peer Relay Claims #140

Description

@JamesEjembi

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

  1. In relay-ticket.rs, implement a ticket scheme: relay signs (relay_id, target_id, epoch, expiry) with its Ed25519 identity key.
  2. In endpoint-cache.rs, reject PUT operations where the ticket verification fails or the ticket's target_id does not match the cache key.
  3. Add a poison-penalty counter: on failed verification, increment peer penalty; at threshold, drop all entries from the offending peer.
  4. In stun-bind.rs, attach a ticket to every STUN binding response before forwarding to cache.
  5. Fuzz test: submit 1,000 malicious binding updates with forged tickets, verify zero cache-poisoning successes.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions