How do I portforward my kali VM so I can use reverse shells?

My connection through Virtual Box is NAT and I tried to use ifconfig and forward that IP through my router but it says the ip is not recognized.

If you’re doing this within the HTB network, then no port forwarding is needed. If you’re doing this over the internet, that’s something I’m not an expert in.

As your title indicates: So you can use revershell.

You don’t need to do any port forwarding as such, just make sure when you run your nc that you enter the IP address of your VM (being HTB IP) since sometimes by default nc will start listening to your local address instead (192.168.x.x) and no revershell will pop up when you execute your exploit.

I’d suggest you use bridged networking for your virtual NIC in your VirtualBox configuration. Assuming you are using DHCP in your router, your virtual NIC will get assigned an IP address the router recognizes. That way, you should be able to do port-forwarding for your reverse shell. Don’t forget to turn off port-forwarding in your router once you are done. :wink:

Hope this helps.

That local IP address that you are seeing with ifconfig is probably an IP address automatically assigned by the virtual NIC on your host machine. VMware creates 2 virtual networks by default. HOST-ONLY which has no routing and NAT which has internet sharing/routing. The NAT is occuring thru your host operating system. NAT is ok when it’s NOT a local-network that you’re testing. As long as the host has internet connection, your VM should be able to establish connectivity to OpenVPN. However, locally… If your VM is in Bridged Mode, it’ll cause conflicts with your host because both systems are talking with the same IP address across the network and it will cause intermittent connectivity problems.