I have a target process I'm injecting meterpreter shellcode (windows/meterpreter/reverse_tcp) into, I manage to get a shell but when I exit it, the process exits as well. Is there any easy way to make the process survive the meterpreter exit besides debugging the process and changing to shellcode manually?

I've added registers saving instructions (pushad, pushfd) at the beginning of the shellcode and registers restoring instructions followed by a trampoline at the end of the shellcode where the opcodes are instructing the process to jump back to some address, but the execution flow never reaches the end of the meterpreter shellcode and the process exits when I exit the meterpreter session.

  • Have you tried changing the meterpreter option EXITFUNC to thread when generating the meterpreter payload?
    – Khalid
    May 18, 2020 at 16:24
  • yes, unfortunately, my target application is single-threaded.
    – jony
    May 20, 2020 at 13:05

1 Answer 1


The way I got around this personally, was just creating another session, moving to that session, and then exiting that session. Keeping my main session alive.

  • 1
    Oh wait, there is a background command you can use to push your session into the background.
    – RandomUser
    May 21, 2021 at 13:24

You must log in to answer this question.

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