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.