Forum Thread: How to Reverse Connection from a Particular Payload in Metasploit?

How to Reverse Connection from a Particular Payload in Metasploit?

I created a payload and installed it on two different devices with different ips. So if want to reverse the connection using metasploit from a specific payload, how would I do that? As far as I know it connects to only the recent one. Is there any way in msfconsole?

Also, the payload is installed on 3 different devices but when I run "sessions -l" it shows no active sessions. Is anything blocking the reverse connection?

8 Responses

To connect to multiple devices at the same time, you need to type set exitonsession false before you type exploit when setting up your listener.

Now to figure out your problem. Was your listener set up before you ran your payload? Are the devices on the same network as your listener? If not, did you set your listener to your private IP and your payload to your public IP? Also, did you port forward your port in your router?

The payload is made with public ip only and that too with no-ip ddns. So the network doesn't matter. The listener wasn't set before running the payload. The port is already forwarded. Infact the payload connects only when I install after exploiting it. It doesn't connect to an already installed payload. How to connect to already installed? And which one?

Some (most) payloads do not keep sending signals after they were initially opened, this means that if the listener was not open when the payload was opened then you screwed up.

So how to make a payload which connects even if the listener was set after the installation?

I suggest you use Veil-Evasion and the base 64 substitution payload. In Veil-Evasion the payload will be converted to .exe. So if you for example exit your session and you then set up your listener again it will automatically start a new session. However I never explicitly tried running the payload beforehand and open my listener afterwards I do think it is possible this way.

But .exe doesn't work on android. Any idea on how to do it on android? When I run sessions-l it shows no active sessions but I have it installed on multiple devices. Why is it so?

Ok, first this is the first mention of you trying it on Android. I had a suspicion that you were talking about that but wasn't sure. If you want the best help, it's best to give as much information relating to the problem as possible.

Now, as I stated, you must have the listener running before you install the app. Once you have a session, you can set persistence. I have not worked on hacking Androids but it's possible that you don't have to reinstall the app on the phone, just open the app again while the listener is running.

If you cannot do that, I am going to assume that you are trying to infect other people and that is illegal. I can offer no more help if that is the case.

I too know thats illegal and thats not the case. I said its installed on multiple devices means I am the one who has installed them and those are my properties.

Coming to the topic, my problem is that when I set exitonsession false it starts multiple sessions but I cant gain access to them. And also, the payload runs as a background activity and there's no option to restart it anyway. If then exploit runs as a background job, whats the way to listen to desired payload.

Share Your Thoughts

  • Hot
  • Active