You need root in both devices (as you are going to create new interfaces) and the sshd config has to allow root login: PermitRootLogin yesPermitTunnel yes
ssh [email protected] -w any:any ip addr add 1.1.1.2/32 peer 1.1.1.1 dev tun0 ip addr add 1.1.1.1/32 peer 1.1.1.2 dev tun0
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
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: RpivotOpenVPN can also bypass it, setting these options in the configuration file:
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.
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.