Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question is a doozey, but is something I am trying to figure out for a simulation penetration test. Maybe I'm going the wrong way about it, and maybe I should post this in another forum, but given what I'm actually asking it felt appropriate here.

I am able to remotely connect to another computer, and access a windows command prompt. The other computer is behind a VPN. Using only the tools I have at my disposal (that is, a reverse connected meterpreter) how can I find out the TRUE external IP address of the remote machine?

I am thinking I will need to hit an external site (like or even just pull down an external webpage (since I have the server logs to that server) via the command line, while forcing it to NOT go through the VPN.

Any help would be appreciated!

share|improve this question
up vote 1 down vote accepted

First, check the local IP address! Make sure a public address is not assigned to the device.

If there is indeed a NAT, you would need to look at your routing table first.

$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 eth0     U         0 0          0 eth0         UG        0 0          0 eth0

Using that you should see what routes exist on that computer. Most likely there will be a route going over a VPN (yours) and then other routes. What you are looking for is the default route, make sure it exists and then send traffic over it; if the default route is your VPN then try to find a more specific route that leads you out of the network.

If you have a default route that is not your VPN go to any server in which you can track IP address that connected to it. This can be your server in which you try to ping, or try and access a webpage on your server.


Adding a route in Windows:

route ADD *prefix* MASK *subnet* *gateway* METRIC *metric* IF *interface number*

Although you can change the route using meterpreter:

route add *prefix* *subnet* *gateway*
route add


route /?

share|improve this answer
what is the command to use a different route on windows? – Tedd Johnson Sep 24 '13 at 23:39
@TeddJohnson, updated. Also, I would look at:… for uploading a file. – prateek61 Sep 24 '13 at 23:46

I generally use ( to identify my external ip, via the command

curl -s

In your case all you have to do is add to the routing table a specific rule bypassing the VPN. So, suppose your local gateway is, all you have to say is

ip route add via dev eth0

Now, when your request "curl -s" leaves your pc, it will be routed thru the local gateway, not the VPN, and the reply will disclose your true external IP.

share|improve this answer
yes, that would work on linux, is there a windows command to do something similar? – Tedd Johnson Sep 24 '13 at 22:08
This one is great! Although, I would add that you should probably use the IP address in the curl as to limit network traffic. @TeddJohnson if you have a meterpreter session why wouldn't you just upload curl to the computer and then modify the routing table? – prateek61 Sep 24 '13 at 23:33
I will give it a shot in meterpreter, this would be a fantastic solution as long as it works! – Tedd Johnson Sep 24 '13 at 23:40
@TeddJohson In windows the same command would be route add mask – MariusMatutiae Sep 25 '13 at 4:19
@prateek good point about using the IP number rather than the full URL. The DNS request would go thru the VPN. I am not used to working in hostile environments. – MariusMatutiae Sep 25 '13 at 6:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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