In my attempt at learning more about how backdoors like meterpreter work, I have written a reverse shell in C++ for linux.

To achieve persistence, I tried looking into meterpreter's source code which was not so helpful as the code is a bit scattered and I wasn't able to locate the feature in it.

This is my trial to have persistent back connection. I think there might be a better way than using multiple processes.

while (true):
    if (socket = try_connect_back()) :
        child_pid = fork();
        if (is_parent_process) :
        elseif (is_child_process) :
            duplicate(socket, stdin);
            duplicate(socket, stdout);
            duplicate(socket, stderr);

So I am looking for material, like articles or simplified source codes, to better learn how some of these features work.

  • 1
    You looked at the meterpreter persistence module? Do you understand the basic principles of persistence and what the various methods are? – schroeder Mar 23 at 12:14
  • Here is the relevant script: persistence.rb – Joe Mar 23 at 12:20
  • @schroeder Thank you , I am looking at the module. I don't know much about persistence methods, a nod towards the right direction could be helpful. – protoneight Mar 23 at 14:26
  • 1
    This is a very easy thing to look up. google.com/search?q=backdoor+persistence+methods what exactly to do depends on the target OS – schroeder Mar 23 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.