Tunneling and Port Forwarding
SSH
SSH graphical connection (X)
Local Port2Port
Open new Port in SSH Server --> Other port
Port2Port
Local port --> Compromised host (SSH) --> Third_box:Port
Port2hostnet (proxychains)
Local Port --> Compromised host(SSH) --> Wherever
VPN-Tunnel
You need root in both devices (as you are going to create new interfaces) and the sshd config has to allow root login: PermitRootLogin yes
PermitTunnel yes
Enable forwarding in Server side
Set new route on client side
SSHUTTLE
You can tunnel via ssh all the traffic to a subnetwork through a host. Example, forwarding all the traffic going to 10.10.10.0/24
Meterpreter
Port2Port
Local port --> Compromised host (active session) --> Third_box:Port
Port2hostnet (proxychains)
Another way:
reGeorg
You need to upload a web file tunnel: ashx|aspx|js|jsp|php|php|jsp
Chisel
socks
Port forwarding
Rpivot
Reverse tunnel. The tunnel is started from the victim. A socks4 proxy is created on 127.0.0.1:1080
Pivot through NTLM proxy
Socat
Bind shell
Reverse shell
Port2Port
Port2Port through socks
Meterpreter through SSL Socat
You can bypass a non-authenticated proxy executing this line instead of the last one in the victim's console:
SSL Socat Tunnel
/bin/sh console
Create certificates in both sides: Client and Server
Remote Port2Port
Connect the local SSH port (22) to the 443 port of the attacker host
Plink.exe
It's like a console PuTTY version ( the options are very similar to a ssh client).
As this binary will be executed in the victim and it is a ssh client, we need to open our ssh service and port so we can have a reverse connection. Then, to forward a only locally accessible port to a port in our machine:
NTLM proxy bypass
The previously mentioned tool: Rpivot OpenVPN can also bypass it, setting these options in the configuration file:
Cntlm
It authenticates against a proxy and binds a port locally that is forwarded to the external service you specify. Then, you can use the tool of your choice through this port. Example that forward port 443
Now, if you set for example in the victim the SSH service to listen in port 443. You can connect to it through the attacker port 2222. You could also use a meterpreter that connects to localhost:443 and the attacker is listening in port 2222.
YARP
DNS Tunneling
Iodine
Root is needed in both systems to create tun adapters and tunnels data between them using DNS queries.
The tunnel will be really slow. You can create a compressed SSH connection through this tunnel by using:
DNSCat2
Establishes a C&C channel through DNS. It doesn't need root privileges.
Port forwarding with dnscat
Change proxychains DNS
Proxychains intercepts gethostbyname
libc call and tunnels tcp DNS request through the socks proxy. By default the DNS server that proxychains use is 4.2.2.2 (hardcoded). To change it, edit the file: /usr/lib/proxychains3/proxyresolv and change the IP. If you are in a Windows environment you could set the IP of the domain controller.
Tunnels in Go
ICMP Tunneling
Hans
Root is needed in both systems to create tun adapters and tunnels data between them using ICMP echo requests.
Last updated
Was this helpful?