If I have an application that supports a SOCKS proxy, and I point it at a running Tor instance, how can I be sure that all traffic the application sends (including DNS requests) are sent through the proxy?

3 Answers 3


One technique is to firewall your computer off so it can only communicate through Tor, and then use the application, watching your firewall logs.

  1. Set up a Tor bridge on another host in your network/on the internet.

  2. Boot your client/testing machine from a LiveCD.

  3. Install Tor on your client, have it point to the bridge.

  4. Use a firewall such as shorewall or iptables to block access to the internet except for your bridge. This should prevent anything from leaving your machine that doesn't go to that single port on that single IP over TCP.

  5. Tail your firewall logs, and let your machine quiet down. Stop any ntp services, system updates, etc. Get it so your machine is sending no traffic.

  6. Start up the application, use every single feature and make sure it's all being correctly proxied through Tor. Anything that shows up in your logs is a leak. Investigate it.

Shorewall Firewall configuration:

   fw      firewall   net      ipv4
   net     eth0       detect   dhcp
   fw      net        DROP     warn    
   net     fw         DROP     info
   ACCEPT  $FW        bridgeip tcp   bridgeport
  • I also run tcpdump dst port 53 to see if any DNS is leaking out. But firewalling off is safer.
    – zkilnbqi
    Commented Sep 25, 2013 at 19:52

Watching syscalls

Alternative to detecting unwanted traffic on a network level (by firewall or a packet sniffer like tcpdump) is to watch system calls of the application. For example on Linux you can run the application under control of strace:

strace -e trace=socket,getsockopt,setsockopt,getsockname,connect,bind,send,sendto,sendmsg,recv,recvfrom,recvmsg your_application

The network traffic level has advantages that it does not depend on the operating system and kernel interventions to the communication. You see the real communication.

The system calls watching method has advantage that you are closer to what is happening inside the application.

Other possibility is to watch library calls but unfortunately ltrace on Linux does not make many library call parameters accessible.


Tor Project suggest two ways to use Tor :

If you're able to run your application in Tails which is based on Debian GNU/Linux perhaps it's the safer path to take. Tails makes sure that every connection is made through Tor.

A bunch of applications was not designed with anonymity in mind so they might try hard to determine you real external IP, e.g a BitTorrent client.

Nevertheless if you want to check the connections your application makes, you'd better try an isolated environment e.g a virtual machine with VirtualBox. A virtual machine gives you the opportunity to have Windows or Linux.

As long as you prepare you virtual machine, install your appplication and make sure you shutdown as many as you can of the rest applications in the virtual instance. Install and run Tor and point your application to it.

Finally install Wireshark, a network analyzer. Wireshark can capture network traffic from the (virtual) interface. Run and use your torified application and watch in Wireshark for packets coming and going. To help yourself you can make use of the various filters of Wireshark, e.g filtering DNS requests.

Finally be aware that some applications might leak other sensitive informations of yours, apart from your real IP address. Such information can be your username, hardware information, timezone etc.

You must log in to answer this question.

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