How To Use Proxychains To Evade Detection

Whenever we send a packet to any hostnames or targets, that packet contains our IP address in the IP header. If we make a TCP connection, the target or hostname system will log our IP address as it logs all connections. With Proxychains we decrease the probability of detection.

These events increase the possibility of detection. In order to penetrate anonymously with the least chance of detection, we need to use an intermediary machine whose IP address will be left on the target system. This can be done by using proxies.

These systems are designed to accept our traffic and then forward it on to the hostname or target. Of course, the proxy will likely log our traffic, but an investigator would have to get a subpoena or search warrant to obtain the logs.

If we string multiple proxies in a chain, we make it harder and harder to detect our original IP address. If one of those proxies is outside the jurisdiction of the victim, it makes it very unlikely that any traffic can be attributed to our IP address.

Proxychains Features:

  1. The latest version of Proxychains support SOCKS5, SOCKS4, and HTTP CONNECT proxy servers.
  2. Proxychains can be mixed up with different proxy types in a list
  3. Proxychains also supports Any kinds of chaining option methods, like: random, which is it takes random proxy in the list stored in configuration file. or chaining proxies in the exact order list, different proxies are separated by new line in a file. or dynamic option, that let Proxychains to go through the live only proxies, it will exclude the dead or unreachable proxies, the dynamic option often called smart option.
  4. Proxychains could run or handle any TCP client application, ie., nmap.

 

Configure Proxychains

Let’s start by finding proxychains. Type:

  • kali > locate proxychains

As we can see in the screenshot below, proxychains is in the /usr/bin directory. Since /usr/bin is in our PATH variable, we can use it from any directory. This is just as we would want since we use proxychains with other commands, which may NOT likely be in the PATH variable.

 

The syntax for the proxycahins command is simple and straightforward.

  • kali> proxychains <the command you want proxied> <any arguments>

So, if I wanted to use proxychains to scan a site with nmap anonymously, I could type:

  • kali> proxychains nmap -sS <IP address>
    

Set Up the Config File

Like nearly every application in Linux/Unix, configuration is managed by a simple text file called the config file. In the case of proxychains, this file is /etc/proxychains.conf. We can open it in leafpad or any other text editor (vi, emacs, gedit, kwrite, etc.), by typing:

  • kali > leafpad /etc/proxychains.conf

When we do so, we will see a file like that displayed below. If we scroll down this file a bit, we will see a section labeled “add proxy here…”.

To get proxychains to use intermediary proxies, we simply need to add the IP addresses of the proxies we want to use here. It’s important to note that proxychains defaults to use Tor.

Notice the last line in the screenshot above. It directs proxychains to send the traffic first through our host at 127.0.0.1 on port 9050 (the default Tor configuration). If you are using Tor, leave this as it is. If you are not using Tor, you will need to comment out this line.

Let’s Test It

Now that we have put a proxy between us and any traffic we send, let’s test it out. Simply do a nmap scan to whichever IP address/domain. The command would be as follows:

  • kali > proxychains nmap -sS "ip address"
    

Some More Interesting Options

Now that we have proxychains working, let’s look at some options that we can configure through the proxychains.conf. As we now have it set up, we are simply using a single proxy. We can put in numerous proxies and use all of them, we can use a limited number from the list, or we can have proxychains change the order randomly. Let’s try all of those options.

Add More Proxies

First, let’s add some more proxies to our list. Open /etc/proxychains.config and add more proxy IPs like I’ve done below.

 

Proxychaining

Now that we have multiple IPs in our proxychain.conf we can set up dynamic chaining. Dynamic chaining will enable us to run our traffic through every proxy on our list, and if one of the proxies is down or not responding, it will automatically go to the next proxy in the list without throwing an error.

To do so, let’s first open the proxychains configuration file again.

With this file open, uncomment out the “dynamic_chains” line. This will enable dynamic chaining of our proxies allowing for greater anonymity and trouble-free hacking.

Random Chaining

Finally, we can also use “random chaining”. With this option, proxychains will randomly choose IP addresses from our list and use them for creating our proxychain. This means that each time we use proxychains, the chain of proxy will look different to the target, making it harder to track our traffic from its source.

To do so, open the /etc/proxychains.conf file and comment out “dynamic chains” and uncomment “random chain”. Since we can only use one of these options at a time, make certain that you comment out the other options in this section before using proxychains.

In addition; you may want to uncomment the line with “chain_len”. This will determine how many of the IP addresses in your chain will be used in creating your random proxy chain.

Now that you know how to use proxychains, you can do your hacking with relative anonymity. Always note that no-one is really anonymous, just be cautious and remember your to remove your traces.

Leave a Reply

Your email address will not be published. Required fields are marked *