proxychains4: A tool for forcing network connections to go through proxy servers

ProxyChains4 is a powerful tool in Kali Linux that forces any application (e.g., curl, nmap, wget) to use a proxy (or a chain of proxies) for network connections. It helps in maintaining anonymity, bypassing firewalls, and conducting penetration testing through indirect routing.


1. What is ProxyChains4?

ProxyChains4 is an updated version of ProxyChains, a UNIX program that redirects TCP connections through proxies like:

  • HTTP/HTTPS/SOCKS4/SOCKS5 proxies
  • TOR network
  • Custom proxy lists

It supports:

  • Dynamic chaining (random proxy order)
  • Strict chaining (fixed proxy order)
  • Proxy authentication
  • DNS proxying (prevents DNS leaks)

2. How ProxyChains4 Works

ProxyChains4 hijacks network calls from applications and routes them through a predefined proxy chain. It uses LD_PRELOAD (a Linux dynamic linker feature) to intercept:

  • connect()
  • getaddrinfo()
  • gethostbyname()

Proxy Chain Types

  1. Dynamic Chain (dynamic_chain)
  • Randomly selects proxies from the list (best for anonymity).
  1. Strict Chain (strict_chain)
  • Uses proxies in exact order (useful for debugging).
  1. Random Chain (random_chain)
  • Randomly picks proxies (similar to dynamic but less strict).

3. Installation

ProxyChains4 is pre-installed in Kali Linux. If missing, install it via:

Bash
sudo apt update && sudo apt install proxychains4

Verify Installation

Bash
proxychains4 -h

4. Configuration

The main config file is at /etc/proxychains4.conf. Key settings:

Bash
# Proxy types: http, socks4, socks5
[ProxyList]
socks5  127.0.0.1 9050  # TOR (default)
http    192.168.1.1 8080 user pass  # HTTP with auth

# Chain type (uncomment one)
# dynamic_chain
strict_chain
# random_chain

Enable DNS Proxying (Prevent Leaks)

Uncomment:

Bash
proxy_dns

5. Basic Usage

Run Any Command via ProxyChains

Bash
proxychains4 curl ifconfig.me  # Get your public IP via proxy
proxychains4 nmap -sT -Pn target.com  # Scan through proxy
proxychains4 firefox  # Launch Firefox via proxy

Using TOR with ProxyChains

  1. Start TOR:
Bash
sudo systemctl start tor
  1. Test:
Bash
proxychains4 curl ifconfig.me  # Should show TOR exit node IP

6. Advanced Usage

Custom Proxy Lists

Edit /etc/proxychains4.conf and add:

Bash
[ProxyList]
socks5 127.0.0.1 9050  # TOR
http 45.33.12.84 8080  # Public proxy
socks4 91.121.23.45 4145  # Another proxy

Chaining Multiple Proxies

Bash
proxychains4 -f /path/to/custom_config.conf nmap -sT target.com

Bypassing Proxy for Local Traffic

Bash
localnet 127.0.0.0/255.0.0.0
localnet 10.0.0.0/255.0.0.0

7. Command-Line Options

OptionDescription
-qQuiet mode (suppress output)
-f <file>Use custom config file
-aUse all proxies in the list (even if some fail)
-dEnable debug mode

Example:

Bash
proxychains4 -q nmap -sT target.com

8. Real-World Use Cases

  1. Penetration Testing
  • Scan targets anonymously via TOR or public proxies.
Bash
proxychains4 nmap -sT -Pn -p 80,443 target.com
  1. Bypassing Firewalls
  • Access blocked websites via proxy chains.
Bash
proxychains4 wget https://censored-site.com
  1. Anonymous Web Browsing
  • Launch Firefox via TOR.
Bash
proxychains4 firefox
  1. SSH Through Proxy
  • Connect to a remote server via proxy.
Bash
proxychains4 ssh user@remote-server

9. Troubleshooting

Issue: “ProxyChains not working”

  • Check TOR:
Bash
sudo systemctl status tor
  • Check Config:
    Ensure /etc/proxychains4.conf has correct proxy entries.
  • Test with curl:
Bash
proxychains4 curl ifconfig.me
  • Debug Mode:
Bash
proxychains4 -d curl ifconfig.me

Issue: “DNS Leaks”

  • Enable proxy_dns in config.
  • Use -resolve in curl:
Bash
proxychains4 curl --resolve example.com:80:1.2.3.4 http://example.com

Issue: “Connection Timeout”

  • Some proxies may be dead. Try a different proxy list.
  • Use strict_chain for debugging.

Total
0
Shares

Leave a Reply

Previous Post
miredo: A Teredo (IPv6 over IPv4) tunneling daemon for creating a VPN-like connection

miredo: A Teredo (IPv6 over IPv4) tunneling daemon for creating a VPN-like connection

Next Post
proxytunnel A tool that tunnels HTTPS traffic through an HTTP proxy

proxytunnel: A tool that tunnels HTTPS traffic through an HTTP proxy

Related Posts