Education

have you ever wanted to port forward from a Windows Host to a WSl2 KALI VM when you are using a NAT’d virtual switch configuraiton with WSL2?

Now there’s some limitations with this (e.g. you can’t do this with UDP to my knowledge) so for DNS tunneling this won’t work. However, for TCP port forwards this works a treat!

netsh interface portproxy reset ipv4
netsh advfirewall firewall delete rule name="WSL Prt4Wrd"

netsh interface portproxy delete v4tov4 listenport=443 listenaddress=0.0.0.0
netsh interface portproxy add v4tov4 listenport=443 listenaddress=0.0.0.0 connectaddress=172.18.xxx.xx


netsh advfirewall firewall add rule name= "WSL Prt4Wrd" dir=in action=allow protocol=TCP localport=443

netsh advfirewall firewall add rule name= "WSL Prt4Wrd" dir=out action=allow protocol=TCP localport=443

Now you can host web services and stage payloads/listeners on TCP with WSL2 and a KALI install, all whilst running from a Windows host.

To clear the configuration run this:

netsh interface portproxy reset ipv4
netsh advfirewall firewall delete rule name="WSL Prt4Wrd"

Hopefully this helps some people operate from a Windows environment where you might want to upgrade the windows box a bit 😉 (oh just incase you didn’t realise, you will need to run the commands from cmd.exe from a admin account)