proxychains

Installation

sudo apt install proxychains4

Command execution

  1. proxychains preloads a library (LD_PRELOAD) that hooks system network calls like connect().

  2. When your program tries to open a TCP connection:

    • proxychains intercepts it.

    • Instead of connecting directly to the target, it connects to a proxy listed in your config (proxychains.conf).

  3. If the first proxy is available, the connection is forwarded through it; otherwise, it tries the next proxy (unless using strict chaining mode).

  4. If you have a chain of proxies, the data is forwarded hop by hop until it reaches the final destination.

Configuration

Edit the file /etc/proxychains.conf for system-wide ~/.proxychains/proxychains.conf per-user (optional).

For the specification of another configuration file:

  • Your traffic will go through the first available proxy in the list.

  • If chain mode is enabled, traffic must pass through all proxies in order.

Modes of operation

Keyword
Mode
Notes

dynamic_chain

Random proxy per connection

Skips unavailable proxies

strict_chain

Chained proxies

Must pass through all in order

proxy_dns

DNS through proxy

Avoids DNS leaks

quiet_mode

Silent output

Suppresses logs (optional)

Types of proxies supported

proxychains supports proxies over:

  • socks4

  • socks5

  • http

Example - Configuration file

Network configuration

Method 1

strict_chain: traffic MUST go through all the proxies in order

/etc/proxychains.conf on PC

Only TCP-using commands are affected by proxychains (e.g. curl example.com, ssh remotehost, etc.)

Local-only commands like whoami, pwd, ls, etc., are completely unaffected.

Method 2

strict_chain: traffic MUST go through all the proxies in order

/etc/proxychains.conf on PC

To execute local commands, connect using SSH to the last proxy instead of opening a SOCKS proxy and then from that session, execute the commands.

proxychains is a tool to force any TCP application to go through a proxy (SOCKS or HTTP).

  • It intercepts network calls made by programs.

  • Works even if the program doesn’t natively support proxies.

  • Useful for anonymizing connections, routing traffic through specific hosts, or chaining multiple proxies.

Last updated