Chisel - Written in Go. TCP/UDP based tunneling tool. Secured using SSH. Can create a client-server tunnel connection in a firewall restricted environment.
Scenario:
Attacker → Ubuntu → DC(172.16.5.19)
Installation
Chisel Server
After transferring Chisel server to ubuntu machine, let;s start the server session:
Chisel listener will listen for incoming connections on port 1234 using SOCKS5 and forward it to all the networks that are accessible from the pivothost.
Chisel Client
Now on our attacker machine, let’s start chisel client:
Chisel client has created tunnel between chisel server and client and now is listening on port 1080.
Proxychains
Modify /etc/proxychains.conf
and add 1080 port at the end.
Pivoting to DC
Now we can access DC network which is two network hops away from the attacker machine:
Chisel Reverse Pivot
Earlier, we used Ubuntu server as Chisel server.
There are scenarios where firewall rules restrict inbound connections to our compromised target. If this is the case, we use Chisel with the reverse option.
--reverse
: The server will listen and accept connections and they will be proxed through the client.
Chisel Server
Let’s start Chisel server on attacker host:
Chisel Client
Now, we will connect from Ubuntu PivotHost to our attacker host:
Proxychains
Now we can access DC network:
Chisel - Cheatsheet
There are many ways for tunneling but my favorite way is chisel.
Hereis a good chisel cheatsheet created by 0xdf.
Let’s say you are on the compromised system and you found 192.168.122.4 host live and connected to your compromised system. It has port 80 open so I would have to tunnel to access that port 80 running on 192.168.122.4.
- You first upload chisel to the compromised system using wget or curl.
- Now on your local machine, start Chisel server listening on whatever port you prefer (In this case 9000).
- Now on the compromised system, tunnel target machine’s port to local machine’s listener.
- Now on your local machine, you can access port 80 of 192.168.122.4 as if you are accessing service running locally.