What is a Backdoor for...

After exploiting and gaining access to a system, the next step would be to install a backdoor on the target machine. A backdoor is typically a covert method of bypassing normal authentication or encryption in a computer, product, embedded device, or its embodiment. Backdoors are most often used for remote access to a computer. The reason for installing a persistent backdoor is important since attackers want to maintain access to the compromised machines even after the users reboot. Instead of having to constantly deliver payloads to the user to establish C2, attackers install backdoors after the initial infiltration so that the whole process does not have to be repeated again and again. Next, we shall explore ways to install persistent backdoors on our test machines.

Reference

https://en.wikipedia.org/wiki/Backdoor_(computing)

1. Persistent Backdoor using Metasploit

Pre-Requisites

For creating a persistence backdoor, you should have a compromised machine of the victim with a Meterpreter session.

Install Backdoor

Attempt 1: metsvc (FAILED to install a service)

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/aa578ea6-fac5-455e-abe8-f540ec66a282/Untitled.png

Reason that it failed is because metsvc required admin privileges to open service manager according to https://stackoverflow.com/questions/32464177/error-metsvc-cannot-open-the-service-manager0x00000005

Reference:

https://www.offensive-security.com/metasploit-unleashed/meterpreter-backdoor/

https://pentestlab.blog/2012/03/28/metasploit-metsvc-backdoor/

Attempt 2: persistence.rb (FAILED)

A number of alerts stating "Process Terminated" notifications from OpenEDR on the target Windows VM. When the Meterpreter script was executed on the Kali Linux, we can see a series of executions of VEsNPiEZshYrECm.exe. Since DetectOnly was disabled, it prevented the execution of this foreign (by foreign we mean the file was NON-existent before the execution) EXE file. Since this foreign EXE was repeatedly written & launched by Cscript.exe, it is why there were a lot of notifications from OpenEDR.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/e9ccd6a2-2068-40c9-8e8f-924013db6f2a/Untitled.png

The following shows the relationships between these events.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/79c8e7b2-aeb8-4ff6-8c36-1234700133bc/Screenshot_2021-06-09_at_12.37.01_PM.png

The out-of-the-box OrientDB web-UI unfortunately is not that "intelligent" to show relevant edges. So what we do is click on a vertex to show a menu, there is an arrow menu INTO the node, and an arrow OUT of the vertex. The lower screenshot shows what goes into the payload.