Port forwarding
Proxychains-ng
Version of proxychains that allows to specify different configurations for each connection. Useful for running multiple proxies on different ports when pivoting through several subnets.
SSH
Local port forwarding
Allow to reach an isolated machine connected to an exploited one by using the exploited machine to forward all packages between the Kali host and the target.
On Kali: redirect any traffic (0.0.0.0) to the target by logging in the compromised machine in the middle
Remote port forwarding
Use this technique if the firewall is blocking incoming connections so it is not possible to establish an SSH session between the attacking machine and the target, but we can establish a connection from the targeted machine towards our host bypassing the firewall’s inbound traffic filters.
Can also be used to expose services running as localhost on the remote machine to the attacker, to the remote machine all connections being forwarded will appear as if they were coming from localhost.
On compromised machine: reroute all incoming traffic to attacking machine
Example of exposing services running as localhost
Run the following command on the compromised machine to map the local service port to a new port exposed to the attacker's machine.
We can access the exposed service by navigating to the exposed port in our attacker machine. For instance if the exposed service is a web server and the specified exposed port is 8000 we can access the hosted content by navigating to http://localhost:8000
on the attacker machine
Dynamic port forwarding
Set a local listening port and have it tunnel incoming traffic to any remote destination through a proxy. Works the same way as a local port forwarding but allows to target different ports and machines without having to create different tunnels for each host or port.
On Kali: connect us (127.0.0.1) to any target in network through the machine in the middle
Setup:
Reverse dynamic port forwarding
Works the same way as the Remote port forwarding technique plus the ability to change destination on the target network.
On compromised machine: reroute all traffic from any port to the attacker
Setup:
1. Create public keys on compromised machine
2. Copy the keys in your kali machine
3. configure proxychains
Last updated