<!-- XE-0318 · Tunnel handshake accepts any peer — leaseHash is the only credential · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0318>. The page is the record; this is the same page for reading.*

XE-0318 · Bounty

# Tunnel handshake accepts any peer — leaseHash is the only credential

Closed · duplicate
—claimed Medium
[xe#248](https://github.com/xeprotocol/xe/issues/248)
filed 2026-11-03 12:05 UTC
by adli582

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Medium

Area
:   —

Duplicate of
:   [XE-0015](https://bounty.xe.network/XE-0015) fixing

Tracked
:   —

Updated
:   2026-11-10 00:11 UTC

Told
:   2026-11-05 16:05 UTC

### Patches

- [xe#5](https://github.com/xeprotocol/xe/pull/5) open by Khanhtnq
  fix(node,api,core): enforce VM/tunnel auth \& lease expiry, fix renewed lease \& multi-asset accounting

### History

- [8335](https://bounty.xe.network/log/8335) 2026-11-05 16:06 UTC github.state\_pushed
- [8334](https://bounty.xe.network/log/8334) 2026-11-05 16:06 UTC github.labels
- [8331](https://bounty.xe.network/log/8331) 2026-11-05 16:05 UTC reply.mirrored
- [8315](https://bounty.xe.network/log/8315) 2026-11-05 16:05 UTC reply.sent
- [8314](https://bounty.xe.network/log/8314) 2026-11-05 16:05 UTC proposal.adopted
- [8313](https://bounty.xe.network/log/8313) 2026-11-05 16:05 UTC proposal.adopted
- [8312](https://bounty.xe.network/log/8312) 2026-11-05 16:05 UTC ticket.status triaging → closed
- [8311](https://bounty.xe.network/log/8311) 2026-11-05 16:05 UTC proposal.adopted
- [8310](https://bounty.xe.network/log/8310) 2026-11-05 16:05 UTC ticket.facts
- [8309](https://bounty.xe.network/log/8309) 2026-11-05 16:05 UTC proposal.adopted
- [8308](https://bounty.xe.network/log/8308) 2026-11-05 16:05 UTC ticket.facts
- [8262](https://bounty.xe.network/log/8262) 2026-11-05 16:03 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-0318) · [JSON](https://bounty.xe.network/v1/tickets/XE-0318) · [markdown](https://bounty.xe.network/XE-0318.md)

### 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 Denne**team2026-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.
