DEV Community

dhanush 
dhanush 

Posted on

Proxychains - All the what's and how's.

I’ve been using Ubuntu as my main OS for the past couple of years after a decade of using Windows. To be frank, the Linux experience is pretty awesome. I am learning a lot of things by using Linux as my main OS. One such thing that I learned is the Proxychains. In this post, I’ll explain all about it so we can both get knowledge about Proxychains.

How did I come across it?

I am a computer guy, so obviously, I use VPN. Betternet was the choice of my VPN when I was using Windows. On the Linux side, I tried various options like OpenVPN and many others. But there were problems like slow connection speed, unreliability, etc. I came across Proxychains while I was learning about cybersecurity, and I was quite intrigued by the concept. Now I use Proxychains to access the sites that are blocked by my country without any issue. The Proxychains also provide better anonymity than a regular VPN. Let’s see how.

What is it?

When you use a VPN, there is just only one proxy server between you and your destination. The VPN client present in your system encrypts your data and sends it to the VPN server. This server acts as a proxy on behalf of you and communicates with your target host. This system creates a good level of anonymity for any client. But you leave a trail of your activity with the proxy server every time you use a VPN. If your VPN provider is not up to the standards, then there is a high chance that someone will able to track you even though you use a VPN. There is also a good chance of a DNS leak with your VPN service.

To combat this, you can use Proxychains. Proxychains is a tool that forces every TCP communication coming out of your system to go through different proxies. As the name suggests, you can chain multiple proxies with the Proxychains and your connection will go through these different proxies before reaching your target. This method of chaining proxies gives you much more anonymity than a standard VPN. It also has the option to mitigate the DNS leak problem. With a Proxychain, you can configure different proxy protocols such as SOCKS 4, SOCKS 5, and HTTPS. You can even configure Tor proxy with it. You need to have servers with these aforementioned proxy protocols to work with the proxychains.

How to install it?

Proxychains is a tool that is written only for GNU/Linux systems, so if you are using Windows, you need to find some alternatives. The Proxychains is installed by default on Kali and some other distributions. If you don’t have Proxychains pre-installed, then you can download it from the repository using your package manager tool. I am on Ubuntu, so I use the ‘apt’ command to install the software.

$sudo apt install proxychains

You should also install Tor if you intend to use the tor proxy with proxychains.

$sudo apt install tor

How to configure proxychains?

Once you install Proxychains, you can configure the tool with its configuration file. The proxychians.conf file is located in the /etc/proxychains.conf. Open this file with your favorite text editor. Mine is nano.

$cd /etc/
$nano proxychains.conf

Once you open it, you will see that there are different ways to configure the chain of proxies such as dynamic, random, and strict. You can comment or uncomment the name(dynamic_chain, random_chain, strict_chain) to enable or disable the specific option. I am using the dynamic_chain option to route packets through the proxies. You can read about the options in the configuration file to know more about it. If you scroll down a bit, there will be a line “Proxy DNS requests — no leaks for DNS” commented. You should remove the hashtag to prevent DNS leak while using the proxychains. Scroll down further to see the list where you can add your proxies. The file also gives you some examples of how to add the proxies. By default, the Proxychains use tor. If you don’t want to use tor, you can comment out the first line out and add your own proxies. You can get some https or socks 5 proxy servers from this link. Save and close the file. Then, you can see the Proxychain in action by using it with your favorite browser.

$proxychains firefox

The above command will open firefox and force all the TCP connections to go through the proxies that you configured in the file. You can see how the connections work in the terminal.

If you wish to use the Tor proxy, leave the default proxy configuration list in the proxychains.conf file. By default, the Proxychains send the traffic through our localhost on the port 9050. It is the default Tor configuration port. So you need to start the Tor service on your system and you can use proxychains with your browser. Now, all the connections will go through the tor network.

$sudo service tor start

You can also link other proxies with the Tor to get better anonymity.

Why you should use it?

You may think that using Proxychains is going overboard to stay anonymous. I completely agree. For normal users, VPN does all the job for them. Proxychains shines in providing complete anonymity for people working in the cybersecurity domain. You should not leave any trail of your system when you are pen-testing, data sniffing, etc. That is why proxychain is mainly used along with network tools such as Nmap.

$proxychains nmap 192.168.1.10

If you want complete anonymity on the internet, Proxychains is the best tool that you can use. For the rest of us, Betternet or Proton VPN would suffice.

Top comments (0)