DEV Community

Cover image for ProxyChaining
Grace Valerie
Grace Valerie

Posted on

ProxyChaining

In a world where digital privacy is a myth, achieving total anonymity has been a top concern for many organizations and individuals. One technique that enables this is using proxychains. The real identity of your original machine is obfuscated by bouncing your internet traffic through multiple proxy servers.

Definition Of Proxy Chaining

Proxy chaining is a more intensive masking technique that involves hiding a proxy behind another proxy and using as many proxies in the chain as needed.

Benefits of using Proxychains

  1. Use of proxychains can make it possible to bypass firewall restrictions and access to resources when conducting reconnaissance without being detected.
  2. Proxychains in combination with other applications such as Nmap and pivoting tools like metasploit can be used to scan networks that are connected to a compromised network.

Using Proxychains

This is a walkthrough on how to set up proxychains on a Kali Linux system. We will be using proxychains-ng instead of proxychains which is an enhanced proxychains project with improved functionality.

Installation

Proxychains-ng comes pre-installed on kali-linux machines. You can confirm this with the command

$ proxychains4
Enter fullscreen mode Exit fullscreen mode

If you get the following response then proxychains is already installed on your machine.

Check if proxychains is installed

You can also install it using apt with the following command:

sudo apt install proxychains4
Enter fullscreen mode Exit fullscreen mode

Configuration

You can use nano or vi to edit the configuration. In this case we will be changing the chain option and adding some proxies to the chain.

Open the configuration file using the command

sudo nano /etc/proxychains4.conf
Enter fullscreen mode Exit fullscreen mode

OR

sudo vi /etc/proxychains4.conf
Enter fullscreen mode Exit fullscreen mode

The editor opens. Scroll down to "dynamic_chain" option and uncomment it then further down to "strict_chain" and comment it. This will enable the dynamic_chain and disable strict_chain.

Enable dynamic chain

Chaining Options

~ Dynamic chain: the proxies used when routing requests changes dynamically and skips non-functional proxies.
~ Strict chain: all specified proxies are used in the order in which they are chained.
~ Round Robin: the chain assumes a circular connection between all proxies. With each request, the next proxy in the list is connected to until all the proxies in the chain are utilized. When the end of the chain is reached, then the next request connects to the first proxy in the list.
~ Random chain: you can specify the number of proxies to use in the request and the chain creates a random combination of proxies for the request.
Scroll down to the bottom of the file to add proxies to your proxychain. You will find an existing loopback address using SOCKS4
proxy list which you need to comment out before adding new proxies. The proxies are specified in the sequence

<type> <host> <port> [username password]
// some proxies do not have usernames or passwords
// types include SOCKS4, SOCKS5, HTTP/HTTPS
Enter fullscreen mode Exit fullscreen mode

Exit from the editor and you are now ready to use the proxychain. Test if its working with the command

$ proxychains4 curl ipinfo.io
$ // returns public ip address of the connected proxy as response
Enter fullscreen mode Exit fullscreen mode

pi address info

To connect to a browser, run the command:

$ proxychains4 firefox google.com
Enter fullscreen mode Exit fullscreen mode

Top comments (0)