{"id":"XE-0318","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"248","source_url":"https://github.com/xeprotocol/xe/issues/248","reporter_id":134,"title":"Tunnel handshake accepts any peer — leaseHash is the only credential","area":null,"claimed_tier":"medium","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0015","tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-03T12:06:36.643690+00:00","updated_at":"2026-11-10T00:11:28.545513+00:00","source_created_at":"2026-11-03T12:05:37+00:00","told_at":"2026-11-05T16:05:28+00:00","status_changed_at":"2026-11-05T16:05:09.929243+00:00","url":"https://bounty.xe.network/XE-0318","body":"## What happens\n\n`ValidateTunnelLease` in node/node.go (~line 2176) takes a `peerID` param but never looks at it:\n\ngo\nfunc (n *Node) ValidateTunnelLease(leaseHash string, peerID peer.ID) error {\n lease := n.GetLease(leaseHash)\n if lease == nil {\n  return fmt.Errorf(\"lease not found\")\n }\n if lease.State != core.LeaseAccepted {\n  return fmt.Errorf(\"lease not active\")\n }\n if lease.Provider != n.KeyPair.Address() {\n  return fmt.Errorf(\"not the provider for this lease\")\n }\n return nil\n} (1/2)\n\n\nIt also never checks the caller is `lease.Account` — the consumer who is actually paying for the lease. And lease hashes are public data (they're on the lattice via gossip/explorer).\n\nSo in `net/tunnel.go` `SetupTunnelHandler`, any libp2p peer who knows a lease hash gets a raw TCP tunnel dialed to the provider VM's SSH port. The caller's `s.Conn().RemotePeer()` is passed in and then ignored.\n\n## Impact\n\nNot an SSH key bypass — the consumer's access key still protects the shell itself. But it turns the SSH gateway into an open relay for anyone with a public lease hash:\n\n- port exposure / service discovery on provider VMs\n- free brute-force and recon surface against the SSH daemon\n- arbitrary traffic relayed through providers (they eat the bandwidth)\n- a way to hold tunnels open on purpose (TunnelRegistry + DialSSH per attempt = DoS-ish)\n\nLands under \"provider VMs and the SSH gateway\" in scope. Tier Medium-ish since the crypto still holds.\n\n## Repro\n\nEnd to end needs a testnet provider node, but the code path is short:\n\n1. pick any lease in `LeaseAccepted` state, copy its `LeaseHash` (public)\n2. from any peer: `xenet.OpenTunnel(ctx, host, dht, providerPeerID, leaseHash)`\n3. provider calls `ValidateTunnelLease(leaseHash, remotePeer)` -> returns nil regardless of who you are\n4. `DialSSH` runs and your stream is piped to the VM's port 22\n\nA one-line check like `if peerID != n.PeerForAccount(lease.Account) { return err }` would close the gap.\n\nHappy to put together a live repro against testnet if useful.\n\n","patch_refs":[{"id":248,"repo":"xeprotocol/xe","kind":"pr","ref":"5","title":"fix(node,api,core): enforce VM/tunnel auth & lease expiry, fix renewed lease & multi-asset accounting","url":"https://github.com/xeprotocol/xe/pull/5","note":"","state":"open","author":"Khanhtnq","added_by":"desk","created_at":"2026-11-04T01:36:24.869505+00:00"}],"thread":[{"id":302,"source":"github","source_ref":"6662797414","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0015, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, reply with what differs and we will look again.","created_at":"2026-11-05T16:05:28+00:00"}]}