# Security Considerations **What the exit can and cannot do.** The exit observes target addresses and traffic volumes — it must, to meter and to enforce egress policy — but never terminates TLS, so when the application uses TLS the exit never sees plaintext application content and payload integrity and confidentiality are end-to-end between the application and the target. The exit relays raw TCP and does not require TLS: traffic an application sends without it is readable and modifiable at the exit. **Identity separation.** A client's transport identity (its iroh endpoint key) and its paying account (the Ethereum-style address) are distinct; the account is bound to each session by a fresh challenge signature, so an endpoint key alone cannot spend an account. The account key can, and so can a billing token issued for that account while it is valid (24 hours). **Metering integrity.** Byte accounting is exit-authoritative and reported cumulatively to multiple independent billing legs; settlement is watermark-idempotent, making double-charging impossible by construction, and unspent balances are always withdrawable. When the metering pipeline fails, it errs toward under-charging: a stale or duplicate settler can only under-collect, and the overage of an unfinished package is forgiven. **Registry integrity.** Signed registrations bind an exit listing to possession of the exit's key, with replay protection; expiry by missed heartbeats keeps listings live and prevents stale-exit pinning. **Coordination trust.** The billing layer is a trusted coordinator in the current deployment, operated by the Foundation at launch, with trust progressively decentralized over time. Proxy usage fees are designed to flow to the validators whose devices carry the traffic; the settlement contract, prepaid balances, and watermark accounting are already on-chain. ## Egress Protection The exit enforces a normative egress policy before connecting to any target. A resolved address is refused if it falls into any of the following classes: - **IPv4:** loopback (`127/8`); link-local including cloud metadata (`169.254/16`); private ranges (`10/8`, `172.16/12`, `192.168/16`); carrier-grade NAT (`100.64/10`); unspecified, multicast, and broadcast addresses. - **IPv6:** loopback and unspecified (`::1`, `::`); multicast (`ff00::/8`); link-local (`fe80::/10`); unique-local (`fc00::/7`). - **IPv4 embedded in IPv6:** mapped (`::ffff:0:0/96`), NAT64 well-known prefix (`64:ff9b::/96`), 6to4 (`2002::/16`), and IPv4-compatible forms are *unwrapped and re-checked* against the IPv4 rules — a private address cannot be smuggled through an IPv6 literal. Name resolution happens exactly once; the connection is made to the already-verified address. There is no second lookup between check and connect, eliminating DNS-rebinding time-of-check/time-of-use attacks. ## Resource Limits The exit bounds its resource exposure at every layer (values are the current node-embedded configuration): | Limit | Current value | |---|---| | Concurrent client connections per exit | 50 | | Connections per client endpoint identity | 8 | | Concurrent tunnels per connection | 100 | | New tunnels per second per account (rate limit) | 100 | | Target address length | $\le$ 512 bytes | | Handshake / session-open / target-header timeouts | 20 s / 8 s / 15 s | | Target resolve-and-connect timeout | 10 s | | Relay buffer per direction | 8 KiB | Exceeding the rate limit yields status `0x03` rather than degraded service. Global and per-peer connection caps and a per-account rate limit on new tunnels bound how much proxy work the exit admits, and the exit runs on an iroh endpoint of its own, apart from the one that carries consensus; an account that keeps hitting the rate limit is disconnected and blocked on that exit for a while, and the operator can deny a client from a list the exit re-reads without a restart. The caps bound sessions and tunnel openings, not bytes, so they do not by themselves keep proxy traffic from competing with the validator's consensus duties for CPU and bandwidth. ## Deployment Topologies **Node-embedded exit.** The default deployment: the exit runs inside a Phase validator node, on a second iroh endpoint under its own identity and ALPN. Enabling it takes one flag and the address of a billing service; the mobile build's defaults do not switch it on. **Standalone exit.** The exit also ships as a standalone binary speaking the identical ALPN and wire protocol. Any client works with either deployment without configuration changes. Standalone exits suit operators who want to serve egress from hardware that does not validate. **Redundant billing.** An exit may be configured with several billing services; sessions then carry multiple legs ([Anchors and legs](proxy-protocol.md)), so metering and charging survive the loss of any individual service. Billing services likewise read the chain through multiple RPC endpoints. ## Versioning and Interoperability Protocol versioning is coarse. The tunnel protocol is versioned by its ALPN string; the billing API is versioned by its URL path prefix. Individual messages carry *no* version fields, no sequence numbers, and no terminators — each frame's length is either fixed or explicitly prefixed. Since v1.0 the protocol has grown in place, under the same ALPN and path: billing messages gained optional fields that default when absent (`attestation`, `completed_package_bytes`, `reason`, `active_sessions`, `signed_at`/`signature`), the handshake gained the U4 verdict, and the tunnel gained the statuses `0x02` and `0x03`. The exit reads fixed-size handshake frames and ignores trailing bytes. All length prefixes are little-endian 16-bit values; for the signature recovery byte see [Authentication Handshake](proxy-protocol.md#authentication-handshake).