Network Pivoting Techniques

Sshuttle

sshuttle <USER>@<IP> <IP_OF_THE_INTERFACE>/CIDR

Proxychains

ssh -f -N -D 9050 <USER>@<IP>
proxychains <COMMAND>
https://artkond.com/2017/03/23/pivoting-guide/

Windows netsh Port Forwarding

netsh interface portproxy add v4tov4 listenaddress=localaddress listenport=localport connectaddress=destaddress connectport=destport

netsh interface portproxy add v4tov4 listenport=3340 listenaddress=10.1.1.110 connectport=3389 connectaddress=10.1.1.110
  1. listenaddress – is a local IP address waiting for a connection.

  2. listenport – local listening TCP port (the connection is waited on it).

  3. connectaddress – is a local or remote IP address (or DNS name) to which the incoming connection will be redirected.

  4. connectport – is a TCP port to which the connection from listenport is forwarded to.

SSH

SOCKS Proxy

Cool Tip : Konami SSH Port forwarding

Local Port Forwarding

Remote Port Forwarding

Proxychains

Config file: /etc/proxychains.conf

Set the SOCKS4 proxy then proxychains nmap -sT 192.168.5.6

Graphtcp

Same as proxychains, with another mechanism to "proxify" which allow Go applications.

Web SOCKS - reGeorg

reGeorg, the successor to reDuh, pwn a bastion webserver and create SOCKS proxies through the DMZ. Pivot and pwn.

Drop one of the following files on the server:

  • tunnel.ashx

  • tunnel.aspx

  • tunnel.js

  • tunnel.jsp

  • tunnel.nosocket.php

  • tunnel.php

  • tunnel.tomcat.5.jsp

Metasploit

Empire

sshuttle

Transparent proxy server that works as a poor man's VPN. Forwards over ssh.

  • Doesn't require admin.

  • Works with Linux and MacOS.

  • Supports DNS tunneling.

chisel

SharpChisel

A C# Wrapper of Chisel : https://github.com/shantanu561993/SharpChisel

Ligolo

Ligolo : Reverse Tunneling made easy for pentesters, by pentesters

  1. Build Ligolo

  1. Use Ligolo

Gost

Wiki English : https://docs.ginuerzh.xyz/gost/en/

Rpivot

Server (Attacker box)

Client (Compromised box)

Through corporate proxy

Passing the hash

revsocks

ngrok

cloudflared

Basic Pivoting Types

Type

Use Case

Listen - Listen

Exposed asset, may not want to connect out.

Listen - Connect

Normal redirect.

Connect - Connect

Can’t bind, so connect to bridge two hosts

Listen - Listen

Type

Use Case

ncat

ncat -v -l -p 8080 -c "ncat -v -l -p 9090"

socat

socat -v tcp-listen:8080 tcp-listen:9090

remote host 1

ncat localhost 8080 < file

remote host 2

ncat localhost 9090 > newfile

Listen - Connect

Type

Use Case

ncat

ncat -l -v -p 8080 -c "ncat localhost 9090"

socat

socat -v tcp-listen:8080,reuseaddr tcp-connect:localhost:9090

remote host 1

ncat localhost -p 8080 < file

remote host 2

ncat -l -p 9090 > newfile

Connect - Connect

Type

Use Case

ncat

ncat localhost 8080 -c "ncat localhost 9090"

socat

socat -v tcp-connect:localhost:8080,reuseaddr tcp-connect:localhost:9090

remote host 1

ncat -l -p 8080 < file

remote host 2

ncat -l -p 9090 > newfile

Last updated

Was this helpful?