4

Is it possible to runnmap via Tor?

When I googled around, I got the impression that Tor uses Polipo / Privoxy, which are socks5 proxies. So any TCP / UDP aware applications should be able to use them as a gateway to route their traffic. But somewhere it also said that nmap uses raw packets, so it can't be run over Tor!

1 Answer 1

8

Short answer

Yes it is possible, use tsocks nmap -sT IP

Long answer

First of all Tor doesn't use privoxy, Tor provides an socks proxy for connecting via the Tor network.

This means you won't see any network routes or things like that on your system but you have to configure your applications to use the Tor socks proxy to connect via Tor.

Typical Tor installations have privoxy or other proxy serves to provide HTTP Proxies as some browsers try to resolve the hostname locally if they are using a socks proxy. But these http proxy servers have nothing to do with connecting arbitrary applications through Tor.

Applications like tsocks allow to use arbitrary applications to connect via the Tor network. This is done by hooking into specific syscalls like connect and connect them automatically via the socks proxy. This only works if the program uses the specific syscalls and is dynamically linked.

To use nmap via Tor you have to use a program like tsocks to redirect the connections via the socks proxy and use a scanning options which uses the connect syscall. Fortunately nmap provides the -sT option:

-sT (TCP connect scan)

TCP connect scan is the default TCP scan type when SYN scan is not an option. This is the case when a user does not have raw packet privileges.

So yes it is possible to run specific nmap scans (the TCP connect scan) via the TOR network if you use tsocks.

3
  • You can also use the --unprivileged argument, which will prevent Nmap from doing any strange things with sockets that require privilege, making it more likely that your scan will work through the proxy. Aug 5, 2012 at 21:49
  • This returns "NSOCK ERROR [2.6540s] nsock_make_socket(): Socket trouble: Operation not permitted" when run with torsocks nmap -sT --unprivileged facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd.onion
    – Hut8
    Jun 16, 2022 at 19:02
  • Does tsocks prevent nmap from breaking out of the proxy with unsupported protocols? Jan 3, 2023 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .