CyberDefenders Phobos lab writeup
Overview#
| Platform | CyberDefenders |
| Category | Malware Analysis |
| Difficulty | Insane |
| Focus | AES config, CRC32 self-check, persistence, process killing |
| Lab Link | Phobos |
Phobos has been around since late 2018 and gets sold to lots of affiliates, so samples show up everywhere. The interesting part of this one is the config: every string the malware cares about (version, kill list, shell commands) sits in one AES-encrypted blob and gets decrypted by index when it’s needed. Find that function, break on it, and a lot of the questions below are just reading EAX.
Tools: IDA Pro, x32dbg, DIE.
Q1: hashing algorithm#
What is the hashing algorithm used by the malware?
sub_4085D9:
int __usercall sub_4085D9@<eax>(int a1@<eax>, _BYTE *a2@<ecx>, int a3)
{
unsigned int v3; // eax
v3 = ~a1;
while ( a3 )
{
--a3;
v3 = lookup_table[(unsigned __int8)(v3 ^ *a2++)] ^ (v3 >> 8);
}
return ~v3;
}
Invert the seed, index a 256-entry table (at 0x40B000) with the low byte XOR the input, shift right by 8, invert at the end. That’s table-driven CRC32. To be sure, compare the table with the standard one for polynomial 0xEDB88320, which starts 00000000 77073096 EE0E612C.

Answer: CRC32
Q2: .cdata checksum#
Could you provide the hard-coded value of the .cdata checksum?
Xrefs to the CRC function lead to this early in startup:
if ( CRC32_hash(0, v0, dword_40B40C) != dword_40B430 )
return;
It hashes its own .cdata section, where the encrypted config lives, and quits if the result doesn’t match the stored value. Patch anything in there and it just exits.
.data:0040B430 dword_40B430 dd 0D55F8833h ; DATA XREF: real_Start+62↑r
Answer: 0xD55F8833
Q3: version#
What is the malware’s version?
Two functions handle the config:
| Function | Address | Does |
|---|---|---|
sub_4062A6 | 0x004062A6 | sets up the config struct |
sub_406347 | 0x00406347 | decrypts one entry by index |
No need to reverse the AES setup. Break on sub_406347 and read the index at [esp+4], break on its return at 0x00406431 and read EAX. Every config string goes through there.


Index 0x33 comes back as the version string:

[<<ID>>-2822] v2.9.1
<<ID>> gets replaced with the victim ID at runtime, and 2822 is most likely the affiliate/build number. The version is the last part.
Answer: v2.9.1
Q4: masqueraded DLL#
The malware masquerades as a legitimate Windows DLL. Which DLL does it impersonate?
DIE, version info resource:

The version info says it’s ole32.dll. It’s a plain EXE, so the name is just there so it looks harmless to someone skimming file properties or a process list.
Answer: ole32.dll
Q5: first API call#
Could you provide the first API function that is called by the malware?
From the entry point sub_402FA7 into the main routine sub_4029F5. The first thing it does is check whether it’s running elevated. If not, it calls sub_40489E, which relaunches itself:
BOOL sub_40489E()
{
// ...
StartupInfo.cb = 68;
v5 = CreateProcessW(0, v0, 0, 0, 0, 0, 0, 0, &StartupInfo, &ProcessInformation);
// ...
}


sub_402FA7 (entry)
-> sub_4029F5 (main)
-> elevated? no
-> sub_40489E (relaunch)
-> CreateProcessW
Answer: CreateProcessW
Q6: process list decryption call#
Could you provide the address at which the process list decryption function is called?
Ransomware kills database, mail and Office processes first so their files aren’t locked when it encrypts. That happens in sub_4022EE, which runs as its own thread:
int __stdcall sub_4022EE(LPVOID lpThreadParameter)
{
v5 = (__int16 *)sub_406347(10, 0); // config index 10: kill list
// ...
while ( !sub_405962() )
{
sub_404DEE(lpMem); // kill whatever matches
Sleep(0x1F4u);
}
}
It asks the config function for index 10:
.text:004022F9 push 0Ah
.text:004022FB call sub_406347
The return value is the kill list:

| Group | Processes |
|---|---|
| SQL | msftesql, sqlagent, sqlservr, mysql |
| Oracle | oracle, ocssd, dbsnmp |
| Office | excel, outlook, powerpnt, onenote |
| thunderbird, thebat | |
| Backup | sqbcoreservice |
It re-checks every 500 ms, so restarting the database doesn’t help.
Answer: 0x004022FB
Q7: first security command#
What’s the first command the malware uses to turn off a critical security measure?
Same breakpoint on the config function, keep running and watch EAX. One entry comes back as a little batch script:

netsh advfirewall set currentprofile state off
netsh firewall set opmode mode=disable
exit
The first line is the Vista+ syntax, the second is the old XP one, so it covers both.
Answer: netsh advfirewall set currentprofile state off
Q8: persistence function#
Could you provide the address of the function used by the malware for persistence?
Xrefs to RegSetValueExW:

That’s sub_403A93, a registry write wrapper. Its caller is sub_401236:


sub_401236 copies the binary somewhere new, marks the copy hidden (attribute 0x2), and points both Run keys at it:
| Key | Needs admin |
|---|---|
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run | yes |
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run | no |
If it isn’t elevated the HKLM write fails and HKCU still works.
Answer: 0x00401236
Q9: C2 protocol#
What protocol is used by the malware for C2 communication?
The imports answer this:

WinHttpOpen, WinHttpConnect, WinHttpOpenRequest, WinHttpSendRequest, WinHttpReceiveResponse. WinHTTP, so HTTP.
Answer: HTTP
Q10: drive watcher thread#
Could you provide the address of the thread used to check continuously for new disk connections?
Main spawns several threads:

sub_401CC5 is the one polling drives:

while ( !sub_405962() )
{
v3 = GetLogicalDrives();
if ( v3 != LogicalDrives )
{
v4 = v3 & ~LogicalDrives; // bits that just appeared
// ... encrypt the new drives
}
Sleep(0x3E8u); // 1000 ms
}
GetLogicalDrives returns a bitmask, bit 0 is A:, bit 2 is C:. new & ~old leaves only the drives that just showed up. Plug in a USB stick or map a share while it’s running and it gets hit within a second.
Answer: 0x00401CC5
Q11: file size threshold#
The file size is compared to a specific value. Could you provide this value?
Xrefs to GetFileSizeEx lead to sub_408EBE:


v7 = (a5 & 1) != 0 || v10.QuadPart < 0x180000uLL
? sub_408782(...) // whole file
: sub_408C42(...); // partial
0x180000 = 1572864 bytes = 1.5 MB. Smaller files get encrypted whole. Bigger ones only get parts encrypted, which is much faster, and a database with chunks of it encrypted is just as broken.
Answer: 1572864
Answers#
| Q | Answer |
|---|---|
| 1 | CRC32 |
| 2 | 0xD55F8833 |
| 3 | v2.9.1 |
| 4 | ole32.dll |
| 5 | CreateProcessW |
| 6 | 0x004022FB |
| 7 | netsh advfirewall set currentprofile state off |
| 8 | 0x00401236 |
| 9 | HTTP |
| 10 | 0x00401CC5 |
| 11 | 1572864 |