Bounty
XE-0318 · Bounty

Tunnel handshake accepts any peer — leaseHash is the only credential

Closed · duplicate —claimed Medium xe#248 filed 2026-11-03 12:05 UTC by adli582

Report

What happens

ValidateTunnelLease in node/node.go (~line 2176) takes a peerID param but never looks at it:

go func (n *Node) ValidateTunnelLease(leaseHash string, peerID peer.ID) error { lease := n.GetLease(leaseHash) if lease == nil { return fmt.Errorf("lease not found") } if lease.State != core.LeaseAccepted { return fmt.Errorf("lease not active") } if lease.Provider != n.KeyPair.Address() { return fmt.Errorf("not the provider for this lease") } return nil } (1/2)

It 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).

So 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.

Impact

Not 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:

  • port exposure / service discovery on provider VMs
  • free brute-force and recon surface against the SSH daemon
  • arbitrary traffic relayed through providers (they eat the bandwidth)
  • a way to hold tunnels open on purpose (TunnelRegistry + DialSSH per attempt = DoS-ish)

Lands under "provider VMs and the SSH gateway" in scope. Tier Medium-ish since the crypto still holds.

Repro

End to end needs a testnet provider node, but the code path is short:

  1. pick any lease in LeaseAccepted state, copy its LeaseHash (public)
  2. from any peer: xenet.OpenTunnel(ctx, host, dht, providerPeerID, leaseHash)
  3. provider calls ValidateTunnelLease(leaseHash, remotePeer) -> returns nil regardless of who you are
  4. DialSSH runs and your stream is piped to the VM's port 22

A one-line check like if peerID != n.PeerForAccount(lease.Account) { return err } would close the gap.

Happy to put together a live repro against testnet if useful.

Thread

Joseph Denneteam2026-11-05 16:05 UTCgithub

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.