Going Anonymous On The Web With Proxychains And Tor

In this module, we are going to learn how we can do so on Linux using proxychains and Tor. The internet can be a scary place at times and one can never be too careful on the web. Sometimes, it is advised to be as anonymous on the web as possible.

What Are Proxychains ?

Proxychains is a UNIX program that helps us to redirect our network traffic so as to hide our true IP address. It redirects our TCP connections through several proxies like TOR, SOCKS4, SOCKS5, and HTTP(S).

Proxychains also allow us to chain proxy servers for greater anonymity and can also be instrumental in evading IDS/IPS and Firewalls.

Prerequisites

First we need to install some dependencies with the apt command

$ sudo apt install tor proxychains4

Next up, switch to root user with :

$ sudo -i

Once root, first we need to enable tor service with :

# systemctl start tor

You can also check the if tor is running successfully or not with :

# systemctl status tor
● tor.service - Anonymizing overlay network for TCP
     Loaded: loaded (/usr/lib/systemd/system/tor.service; disabled; vendor preset: disabled)
     Active: active (running) since Wed 2021-03-17 19:51:08 IST; 3h 33min ago
    Process: 45902 ExecStartPre=/usr/bin/tor -f /etc/tor/torrc --verify-config (code=exited, status=0/SUCCESS)
   Main PID: 45904 (tor)
      Tasks: 1 (limit: 4590)
     Memory: 37.2M
     CGroup: /system.slice/tor.service
             └─45904 /usr/bin/tor -f /etc/tor/torrc

Configuring Proxychains

We need to make some changes to the configuration files used by proxychains. The file is located at /etc/proxychains.conf so open it using your favorite text editor :

Proxychains Config Opened In Vim
Proxychains Config Opened In Vim

1. Enabling Dynamic Chains

To enable dynamic_chain you need to :

  • Uncomment the line “dynamic_chain”
  • Comment out “strict_chain”, “round_robin_chain” and “random_chain”

2. Prevent DNS Leaks

To prevent DNS leaks which would help us in going completely anonymous on the web :

  • Uncomment “proxy_dns”

This will prevent any DNS Leaks and help us go completely anonymous on the web.

3. Add SOCKS5 Proxy

At the end of the file add the following line to enable SOCKS5 Proxy :

socks5  127.0.0.1 9050

Note: Make sure the line socks4 127.0.0.1 9050 has been uncommented while using tor.

Adding Extra Layer Of Proxies

You can also add additional layers of proxy services like HTTP/HTTPS proxy and such by adding them to the end of the file in the format :

<protocol> <IP Of Proxy Server> <Port>

Once you have made your changes, save and exit the file.

Running Proxy Chains

First, check your Public IP with :

$ curl ifconfig.me

Next, start proxy chains with :

$ proxychains firefox www.google.com

This should spawn a firefox tab with Google

Proxy Chains In Action
Proxy Chains In Action

You can test for DNS Leaks here. You should see an IP different than your original IP which is an indicator that proxychains was successful in doing what we intended it to do.

DNS Leak Test With Proxy Chains Enabled
DNS Leak Test With Proxy Chains Enabled

As we can see, not only is our IP spoofed, but also our location cannot be determined by the website.

Conclusion

Thus we saw how to go anonymous on the web and secure our privacy online. Proxychains can also be integrated with security tools like Nmap and Burpsuite and often helps in evading IDS, IPS and Firewalls.