I recently came across a technique that potentially allows the adversary to both execute and evade detection that is simple to execute, however, to my surprise, not entirely captured by detection tools (at least not by those that I have tested).
In this quick post, I will share my findings & analysis and I am interested in any feedback around options for detection.
Technique Description: The adversary executes a custom-developed, chain-of-commands that they execute together as a single command-line using Windows CMD.EXE. This execution could be achieved through malware or the adversary could manually perform it on a system under their control.
One of the key advantages of this technique for the adversary is that, as of this writing, SYSMON (10.0.4.2), and maybe even some commercial EDR solutions, do not capture such chain-of-commands as a single execution. Instead, these tools typically log this activity separately. I found nothing in the SYSMON logs or Windows native event logs that indicate that multiple commands were executed together as part of a chain.
If what I have observed in true, then I think this lack of total context makes it difficult for incident responders, threat hunters, or security monitoring professionals to identify such activity as anomalous among a large number of events. On the other hand, it allows the adversary to hide in plain sight.
Technique Use in Real Malware: One particular malware where I found this technique being used was in the RobbinHood Ransomware. In my analysis of these two samples (1, 2), this chain-of-command technique can be observed in a couple different ways. However, in one specific instance, RobbinHood uses this technique to check for network connectivity, terminates its previously-launched malicious process and subsequently deletes that same process executable quietly from the system permanently. The command itself was as follows:
ping 126.96.36.199 -n 1 -w 3000 > & taskkill /f /im steel.exe & Del /f /q ‘C:\Users\user\Desktop\steel.exe’
Atomic Test: To simulate the above technique, I developed this benign chain-of-commands, which essentially, first checks network connectivity by making a single ICMP ping request to a Google’s public DNS address, and then it terminates a running Chrome web browser process.
ping 188.8.131.52 -n 1 -w 3000 > Nul & taskkill /f /im chrome.exe
Here is what I observed in SYSMON on the atomic test above:
First, you see an entry for PING.EXE portion of the chain-of-command:
Second, you see separate entry for the latter portion of the chain where the CHROME.EXE process is terminated:
It is evident in the SYSMON events above that both processes share the same Parent Process ID. However, while both events share the same ParentProcessID of 12120, there isn’t any explicit indication that these commands were executed together as part of a chain-of-commands. Which I believe is an important context that is missing as it would not only stick-out during Incident Response/Hunt/Monitoring; especially if the system under investigation and has no business purpose to running such chain-of-commands.
I do want to highlight that I think SYSMON is capturing what it is supposed to capture – a process creation. It captured as each process was created on the system; which was separately one at a time. The limitation appears to be at the operating system level where this data is not captured.
I look forward to feedback and how are you detecting this technique in your environments!
- In addition to Robbinhood Ransomware, the following table lists other malware known to have used this technique:
|Trojan; possibly Big Bang APT||1. https://bit.ly/2xaAVNr|
|GreenKit Bitcoin Mining Rootkit||https://bit.ly/3aDRI9i|