Skip to content

Security: RingsNetwork/rings

SECURITY.md

Security Architecture and Threat Model

Reporting a Vulnerability

Report security issues privately through GitHub's private vulnerability reporting or to dev@rings.rs. Security fixes ship promptly on the active 1.0.x release line.

Summary

Rings secures peer-to-peer communication and overlay services through cryptographic identity, authenticated Chord routing, slot-isolated resource accounting, and Sphinx onion circuits. Every peer and message is authenticated by a DID and a delegated session key, and the architecture divides responsibilities cleanly across two layers: the communication layer provides authenticated routing and end-to-end encryption; the privacy layer provides circuit-level anonymity.

Assumptions

  • Cryptographic identity and delegation. Every peer authenticates control of its DID key pair through a short-lived delegated session key. Signatures are domain-separated by message family and bound to the overlay's network_id.
  • Link-layer security. Established WebRTC connections provide hop-by-hop confidentiality and integrity over DTLS/SCTP.
  • Key hygiene. Long-lived and derived cryptographic material (including HKDF/HMAC states) is zeroized on drop as defence in depth.

Fault Model

  • Churn and fail-stop resilience. Peers can join, disconnect, or restart dynamically. Active challenge-response liveness probes, Chord stabilization, CRDT storage repair, and chain-replicated relay custody automatically heal routing and data placement.
  • Accountability and resource isolation. Every protocol claim, transaction, and directory descriptor is cryptographically signed. Per-slot resource accounting, credit-based flow control, and multi-node replication isolate honest peers and preserve service continuity across untrusted hops.

Deployment Models

Model Posture
Controlled membership Full support: operators authorize participating keys
Open authenticated membership Full support: combines slot-based admission, per-origin rate quotas, age-gated custody, and application-level authorization
Adversarial position-grinding defense Layered defense in depth: slot-isolated admission (SlotRoster), local peer quality ranking, age-gated relay custody, and pinned entry guards bound the influence of any positioned identity in 1.0, while epoch-randomized ring placement (pos(did, e) = H(did, beacon(e)), #780) and DRanking trust algebra (#748) add global topological randomization in 2.0

Layer Contracts

Base overlay guarantees apply to every message in the communication layer, while circuit anonymity is provided by the onion privacy layer.

Communication layer

crates/core provides end-to-end origin authentication for every transaction, loop-free Chord routing, and authenticated encryption for E2E streams.

  • Minimal routing metadata: forwarding hops see only the fields required to route—the signed origin DID, destination DID, payload size, and whether the route has crossed its target. Routes remain history-free, using a direct-link return path only during initial WebRTC connect signaling (#947) so the SDP answer can retrace the signaling hops.
  • End-to-end confidentiality: applications establish session-keyed secp256k1 ECIES (ECDH + HKDF-SHA256 + ChaCha20-Poly1305) encrypted streams bound to each peer's verified Delegation session key across all supported Account signature curves, protecting payloads across forwarding hops and storage nodes with session-rotation forward secrecy.

Privacy layer

crates/node/src/onion provides anonymous transport over client-sealed Sphinx/AEZ loops (g → r → exit → r' → g) anchored at the client's pinned entry guard g.

  • Hop-by-hop unlinkability: each relay peels a single Sphinx/AEZ layer, learns only its immediate predecessor and successor on the loop, and retains no per-session state. Only the selected exit opens the payload, and only the client knows the complete route and matches the return tag. Exit replies carry no exit signature and remain deniable.
  • Explicit exit and invoke capabilities: world-facing exit descriptors sign the closed capability set {tcp, https, udp} (tcp byte stream, bounded https fetch, or pinhole-scoped udp datagram relay), while one-shot intermediate operations advertise typed invoke<In, Out, L> shapes (Σ_I) paired with backend names ω ∈ Ω (such as turn.ticket) so clients and stages negotiate exact service semantics and width/latency bounds.
  • Traffic shaping and paid admission: outbound onion lanes open dormant with zero idle cover traffic by default (OnionIdleFloor::OFF, #1314), pace fixed-size-class cells at a constant slot rate across active bursts and bounded dwell windows (substituting queued real cells for cover traffic under link credit, with configurable background cover floors for dedicated relays; details). Relays charge per-window admission budgets before performing public-key operations and enforce single-use replay tags within each process epoch.
  • Stream Completeness: end-to-end sequence verification ensures that applications receive complete, ordered streams.
  • Pinned entry guards: clients persist their first-hop guards across restarts to maintain stable entry edges over time.

Feature Boundaries

  • Replay protection and crash consistency. Destinations maintain a persisted, exclusively locked sliding window per (network_id, origin, destination, traffic class) stream so admitted transactions are dispatched at most once (details).
  • Slot-isolated resource accounting. Bounded receiver tables and removal stores allocate capacity by authenticated connection slot (SlotRoster / TableAccounting) with a guaranteed per-slot floor plus a shared pool (papers/rings.tex, Fair Admission & Load Bounds, Law 1), paired with per-origin message and byte token buckets at the destination.
  • Non-blocking application boundary. Core protocol lanes run independently of application callbacks. Application delivery uses bounded queues, and stream protocols enforce end-to-end reliability (details).
  • Credit flow control and independent liveness. Data lanes are credit flow controlled so load on one peer never stalls another peer's control lane. Peer liveness is verified by dedicated challenge-response probes (details).
  • Verified delegation leases. Links cache verified session delegations under bounded, receiver-granted duration leases and automatically fall back to inline verification when unleased (details).
  • Durable DHT storage, authenticated CRDT provenance, and replicated relay custody. Storage carriers enforce bounded sizes, counts, TTLs, and clock-skew tolerances; EntryKind::Data mutations verify per-writer Merkle-batched SignedDataMutation proofs (rings-core:data-entry:mutation) and RetractionWitness checks with fair per-writer retention. Offline relay inboxes reside in a dedicated retained store, validate routing authority on write, and replicate across a chain of age-gated custody nodes to preserve messages across peer churn (data storage, relay inbox).
  • Local control, TURN, gateway, egress, and DNS relay boundaries.
    • Control API: protected by an owner Bearer token while exposing the public WebRTC handshake methods (nodeDid, answerOffer, acceptAnswer) for seamless peer onboarding; remote binding and CORS origins are explicit operator opt-ins.
    • TURN & Onion TURN (rings-turn, rings-turn-service): authenticate allocations without a shared password table via time-bounded Delegation, direct DID, or unlinkable SessionTicket (issued over turn.ticket onion invoke) paired with secp256k1 ECDH-derived credentials; RelayPeerPolicy::PublicOnly blocks loopback, link-local, RFC 1918, CGNAT, and local-use IPv6 egress by default, and multi_hop_onion_udp enforces per-peer IP pinholes (OnionUdpPinholeTable).
    • Shared egress admission (rings-network-policy): onion exits, rings-turn, and rings-webview share strict public-IP and public-host predicates preventing SSRF against local or private networks.
    • Native TUN gateway: opt-in selective IPv4/TCP routing over onion::tcp circuits for operator-configured destination prefixes (rejecting default full-tunnel 0.0.0.0/0 capture).
    • DNS relay: serves owner-signed descriptors, forwards traffic to owner-registered dns-relay/<port> services, keys IPv6 mapping with a relay-local secret, and bounds concurrent lookups and owners (details).

Architectural Scope

  • Layered privacy separation: metadata unlinkability is provided by the Sphinx onion privacy layer, keeping the base Chord communication layer lightweight and direct.
  • Permissionless wallet-compatible DIDs: DIDs remain standard public-key digests compatible with Ethereum, Solana, and WebCrypto keys; ring-position randomization (#780) and DRanking trust algebra (#748) provide topological hardening without requiring proof-of-work identity minting.

Operational Notes

  • Browser storage lifecycle (#1036, #1057): persistent contexts commit replay and custody state to IndexedDB under exclusive Web Locks, while private/ephemeral browsing contexts scope state to the active browser session.
  • Cleanest-first slot allocation under churn (#907, #1094): newly admitted connections are assigned the cleanest available slot in SlotRoster, preserving access to the shared capacity pool even during high connection turnover.
  • Zeroized cryptographic wrappers (#852, #1122): HKDF, HMAC, and ElGamal key-derivation wrappers zeroize their key states on drop, while transient register words inside the inner SHA-256 block schedule are overwritten by subsequent invocations.

Acknowledgements

We thank the following security researchers for responsibly disclosing vulnerabilities under our security policy:

  • tcp-raw — reported the EntryKind::Data DHT write-provenance, carrier structural-bounds, and proof-verification vulnerabilities remediated in v1.0.0-pre.14 (#1397).

There aren't any published security advisories