I am using metasploit to create a payload for Android phone (for educational purposes).

If my target and my computer are on the same network it works fine. But when my target is outside connected to different network, and using a payload with LHOST = "my public IP", how do I forward the port if the router is not accessible to me (college router). Is there any way?


You can't.

I suspect you're behind a NAT, and hence you'll need to port-forward from the NAT to your LAN IP.

The other option is hosting something on AWS/DigitalOcean and get an actual Public IP for your server that you can use as your LHOST.

| improve this answer | |

You should be able to have a port listening for the reverse shell and that port must be exposed to internet. If you can't manage the router, you should hire a server on some cloud to do this.

| improve this answer | |

You cant go directly to your PC, however if you have a VPS with a public IP you can setup a reverse port forward from your computer to the VPS with SSH.

I personally do this all the time for using rmate with vscode via my ~/.ssh/config

Host ex example example.moo.com
  HostName example.moo.com
  User username
  IdentityFile ~/.ssh/id_rsa
  RemoteForward 52696

though it can also be done directly via command line

ssh -R 52696: username@example.moo.com

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.