Locker - Warmup


BelkaCTF №7/media/Locker.png

Task

There is something rogue running on this machine.
What is the malware executable file name?

Tools

Solution

FindEvil

There are infinitely many ways to find out which executable is the malware, but the simplest way to get some leads is to use the MemProcFS function findevil. It checks processes and memory in the dump for common signs of malware. You can read about exactly what it detects and how it does that, as well as how to use it, here: MemProcFS/wiki/FS_FindEvil. So let's see what it dredges up.

First, you need to enable the forensic tools. You can read more about them here: MemProcFS/wiki/FS_Forensic.

echo "4" > forensic/forensic_enable.txt

We have to wait for the analysis to finish, and then we can read FindEvil's output.

cat forensic/findevil/findevil.txt | less

It is small enough that we can look through it manually, and some findings may be false positives. However, epxlorer.exe definitely seems like the most suspicious. The name itself is a common malware trick: naming the binary something close to a legitimate program, in this case explorer.exe. And in a CTF context, that might be enough to solve the task.

PRIVATE_RX/RWX

But that is not all: FindEvil flags 107 distinct private executable memory pages (PRIVATE_RX / PRIVATE_RWX) in epxlorer.exe. These are pages where the process can run code that wasn't necessarily in the epxlorer.exe binary to begin with. FindEvil limits how many pages it reports, so the process may contain more. A simple hypothetical example is:

Remove W, add X

Keep W, add X

Malicious program starts

Download encrypted payload from C2

Decrypt and write code into private RW memory

RX: readable + executable

RWX: readable + writable + executable

Execute the payload

Obviously, legitimate applications use this feature too. A browser's JIT compiler is one example, shown here in simplified form:

Remove W, add X

Keep W, add X

Browser starts

Download JavaScript from a website

JIT-compile and write code into private RW memory

RX: readable + executable

RWX: readable + writable + executable

Execute the code

What stands out about epxlorer.exe in this context is the large number of flagged private executable memory pages.

HIGH_ENTROPY

This is also not a conclusive marker on its own, but it is a corroborating factor. The flag is quite self-explanatory: FindEvil measures the entropy of memory regions and flags the ones where it is high. You can read more about entropy here, but for the purpose of this task, all you need to understand is that byte-frequency entropy is highest when byte values occur equally often and lowest when only one byte value occurs. High measured entropy does not prove randomness or encryption but it is often high in encrypted or compressed data. That makes it a useful malware indicator because encrypting malicious code to evade detection is a common trick. In combination with a lot of private executable memory regions, this is starting to look worth investigating.

PE_PATCHED

This flag "locates malware in image virtual address descriptors which executable pages (in the page tables) differs from kernel prototype memory". For the purposes of this task, it is another lead worth considering. Though, the MemProcFS wiki rates its false-positive risk as HIGH.

That is about all we can get from a surface scan with FindEvil, and it is enough to solve the task. But I want to see if we can find anything else suspicious about this process.

Source

Well, the easiest way to get any information from the .mem file is to use strings and grep. Obviously, looking through the whole output is not feasible, but maybe we can notice something quickly.

> strings BelkaCTF_7_CASE250722_KTSOAERO.mem | grep epxlorer

\Device\HarddiskVolume3\Users\award\Downloads\epxlorer.exe
 Download epxlorer.exe | LimeWire
c:\users\award\downloads\epxlorer.exex_exe_path5r
Download epxlorer.exe | LimeWire
[{"application":"C:\\Users\\award\\Downloads\\epxlorer.exe","platform":"x_exe_path"},{"application":"C:\\Users\\award\\Downloads\\epxlorer.exe","platform":"packageId"},{"application":"","platform":"alternateId"}]qyayQI8PAlcwlF/oP6h8d5tTH36oZegMPAUFzSIFr0s=ECB32AF3-1440-4086-94E3-5311F97F89C4
{"displayText":"epxlorer.exe","activationUri":"ms-shellactivity:","appDisplayName":"epxlorer.exe","backgroundColor":"black"}
x_exe_pathc:\users\award\downloads\epxlorer.exeh
c:\users\award\downloads\epxlorer.exex_exe_path
c:\users\award\downloads\epxlorer.exepackageid
c:\users\award\downloads\epxlorer.exex_exe_path5r
ownloads\epxlorer.exeh
...

And yes, literally in the first few lines, we can see where in the file system the binary probably is: c:\users\award\downloads\epxlorer.exe. We can also see a clue to how it probably got there: Download epxlorer.exe | LimeWire. We could dig even deeper, but I think we have enough heuristics stacked up to consider the process suspicious.

Answer
epxlorer.exe