Home Pentesting - Pivoting
Post
Cancel

Pentesting - Pivoting

Interestings Tools for Tunneling and Port Forwarding

Enable forwarding on the server side:

1
echo 1 > /proc/sys/net/ipv4/ip_forward

Autoroute

Syntax:

1
autorute -s <IP-range>

proxychains

ProxyChains is a tool that allows users to route network connections through proxy servers, enabling anonymity and bypassing network restrictions. It supports multiple proxy types, such as HTTP, SOCKS4, and SOCKS5, and can be configured to chain proxies together, enhancing privacy and security during internet activities.

First, you need to install and configure ProxyChains on your system. You define the chain of proxy servers in the ProxyChains configuration file (usually located at /etc/proxychains.conf on Linux).

Chisel

Chisel is a lightweight and versatile tunneling tool designed to establish secure communication channels between two systems. It operates over HTTP and HTTPS protocols, making it suitable for bypassing firewalls and accessing internal networks remotely. Chisel is commonly used by penetration testers, system administrators, and red teamers to create encrypted and authenticated tunnels for secure data transfer and remote network access.

Step-by-Step Example:

  1. Setup Chisel Server:
1
chisel server -p 8080 --reverse
  1. Setup Chisel Client:
1
chisel client 192.168.1.100:8080 R:1337:127.0.0.1:80
  1. Access the Web Service:
1
http://127.0.0.1:1337

Download: https://github.com/jpillora/chisel.git

SSH Tunneling

Dynamic Port Forwarding

Syntax:

1
ssh -D <port> -i <id_rsa> <user>@<IP>

Now, we can open a web browser, for example Firefox and then click on ‘Settings’ option and in the ‘Connections’ section the proxy is modified to manual mode, and the chosen port is added for the SSH tunnel.

Example of command for Local Port Forward:

1
ssh -L 1234:localhost:3306 Ubuntu@10.129.202.64

Netsh (for Windows)

Example of usage:

1
C:\> netsh.exe interface portproxy add v4tov4 listenport=8080 listenaddress=10.129.15.150 connectport=3389 connectaddress=172.16.5.25

Verifying Port Forward:

1
C:\> netsh.exe interface portproxy show v4tov4
This post is licensed under CC BY 4.0 by the author.