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
- Dynamic Chain (
dynamic_chain)
- Randomly selects proxies from the list (best for anonymity).
- Strict Chain (
strict_chain)
- Uses proxies in exact order (useful for debugging).
- 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:
sudo apt update && sudo apt install proxychains4Verify Installation
proxychains4 -h4. Configuration
The main config file is at /etc/proxychains4.conf. Key settings:
# 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_chainEnable DNS Proxying (Prevent Leaks)
Uncomment:
proxy_dns5. Basic Usage
Run Any Command via ProxyChains
proxychains4 curl ifconfig.me # Get your public IP via proxy
proxychains4 nmap -sT -Pn target.com # Scan through proxy
proxychains4 firefox # Launch Firefox via proxyUsing TOR with ProxyChains
- Start TOR:
sudo systemctl start tor- Test:
proxychains4 curl ifconfig.me # Should show TOR exit node IP6. Advanced Usage
Custom Proxy Lists
Edit /etc/proxychains4.conf and add:
[ProxyList]
socks5 127.0.0.1 9050 # TOR
http 45.33.12.84 8080 # Public proxy
socks4 91.121.23.45 4145 # Another proxyChaining Multiple Proxies
proxychains4 -f /path/to/custom_config.conf nmap -sT target.comBypassing Proxy for Local Traffic
localnet 127.0.0.0/255.0.0.0
localnet 10.0.0.0/255.0.0.07. Command-Line Options
| Option | Description |
|---|---|
-q | Quiet mode (suppress output) |
-f <file> | Use custom config file |
-a | Use all proxies in the list (even if some fail) |
-d | Enable debug mode |
Example:
proxychains4 -q nmap -sT target.com8. Real-World Use Cases
- Penetration Testing
- Scan targets anonymously via TOR or public proxies.
proxychains4 nmap -sT -Pn -p 80,443 target.com- Bypassing Firewalls
- Access blocked websites via proxy chains.
proxychains4 wget https://censored-site.com- Anonymous Web Browsing
- Launch Firefox via TOR.
proxychains4 firefox- SSH Through Proxy
- Connect to a remote server via proxy.
proxychains4 ssh user@remote-server9. Troubleshooting
Issue: “ProxyChains not working”
- Check TOR:
sudo systemctl status tor- Check Config:
Ensure/etc/proxychains4.confhas correct proxy entries. - Test with
curl:
proxychains4 curl ifconfig.me- Debug Mode:
proxychains4 -d curl ifconfig.meIssue: “DNS Leaks”
- Enable
proxy_dnsin config. - Use
-resolveincurl:
proxychains4 curl --resolve example.com:80:1.2.3.4 http://example.comIssue: “Connection Timeout”
- Some proxies may be dead. Try a different proxy list.
- Use
strict_chainfor debugging.