libtorrent icon indicating copy to clipboard operation
libtorrent copied to clipboard

DNS leak during DHT bootstrap over SOCKS

Open ichorid opened this issue 4 years ago • 4 comments

Libtorrent 1.2.7 in Tribler on Windows and Linux. Libtorrent is using SOCKS5 proxy in Tribler. The same thing happens with client_test.

изображение

The rest of the traffic goes through the tunnel normally.

ichorid avatar Jun 25 '21 13:06 ichorid

this is not as simple as it might seem. I can't think of a way to actually resolve a name via SOCKS5, all you can do is to specify a hostname instead of an IP address when sending packets. The DHT routing table contains IP addresses, not hostnames. Currently there's an extra step to resolve names into IPs before adding them to the routing table.

I'm hesitant to make the routing table able to hold hostnames.

arvidn avatar Jul 24 '21 10:07 arvidn

There is a setting called dht_bootstrap_nodes. Documentation states:

This is a comma-separated list of IP port-pairs. They will be added to the DHT node (if it's enabled) as back-up nodes in case we don't know of any.

Is there a way to completely override the addresses of Mainline DHT nodes? At least in Tribler, we could start providing bootstrap nodes through our own means.

ichorid avatar Jul 24 '21 13:07 ichorid

yes, if you put IP addresses in that setting, there won't be any hostname lookups.

arvidn avatar Jul 24 '21 17:07 arvidn

I started exploring deferring hostname lookups to the DHT socket class, which supports SOCKS5 hostnames in this branch dht-hostname-lookups. It's far from complete and I think I should simplify the DHT implementation a bit first, to avoid the complexity from growing out of control

arvidn avatar Jul 24 '21 17:07 arvidn