HTB Sherlock: Easy Money
On this page

Easy Money

Description

Easy Money on HackTheBox.

John is an employee at a mid-sized tech company. He works as a senior IT support specialist, but his true passion is finding ways to make extra money. John is always on the lookout for giveaways, discounts, and any opportunity to earn a quick buck. He is not particularly cybersecurity-savvy, but he is resourceful and knows how to follow online tutorials.

Recently, John came across an enticing giveaway that promised exciting rewards. However, when he opened it, he did not find or win anything. This made him suspicious that something might have gone wrong with his machine. Concerned about the unusual behavior, John reached out to you, the investigator, to uncover what happened and determine whether his system had been compromised.

Walkthrough

Initial triage

Given a C: drive acquisition, I loaded it into Autopsy and started the usual triage process. At first, I was a bit lost and did not know where to start, so I looked around for anything interesting. I found only a few giveaway-related shortcuts, and all of them had empty targets.

alt text

Instead of looking for something specific, I decided to read the task list and use those questions to guide the investigation.

Task 1

At what exact time did the user execute the malicious shortcut file?

I started by looking for a malicious shortcut file. However, the desktop contained only three shortcuts, and all of them had empty targets with no malicious code. According to the description, John had opened a shortcut, so it should have appeared in the recent files, which I had already checked without finding anything. I then used JLECmd to parse the jump list and Timeline Explorer to review the results for more information about the malicious shortcut file.

alt text

I found a shortcut named 2025-GiveAways.lnk in the Downloads folder, along with an access timestamp of 2025-01-26 16:17:16. At first, I concluded that the user executed the malicious shortcut file at 2025-01-26 16:17:16.

alt text

However, that answer did not pass the task, which confused me. I then checked the Prefetch files with PECmd and Timeline Explorer to see whether they contained information about files executed around that time.

alt text

The time matched the jump list result but was offset by one second. Both conhost.exe and powershell.exe were executed at 2025-01-26 16:17:15, so I concluded that the user executed the malicious shortcut file at 2025-01-26 16:17:15. A malicious executable named svch0st.exe was executed shortly afterward, masquerading as the legitimate Windows process svchost.exe. After gaining access to the machine, the attacker also ran whoami and systeminfo.

The answer is 2025-01-26 16:17:15.

Task 2

The previous malicious file executed an initial payload. What is the full path of this payload?

I had already identified the malware in the previous task as svch0st.exe.

The answer is C:\Temp\svch0st.exe.

Task 3

At what timestamp did the payload execute and grant the attacker shell access?

Based on the Prefetch files and the previous task, svch0st.exe was executed at 2025-01-26 16:17:54.

The answer is 2025-01-26 16:17:54.

Task 4

What is the command line the attacker used to enumerate installed packages on the system?

The task asks for the command line used by the attacker to enumerate installed packages on the system. The C: drive acquisition contains Windows event logs (winevt), so I used EvtCmd to parse the PowerShell logs and Timeline Explorer to analyze them.

alt text

The answer is C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command Get-Package.

Task 5

Which application did the attacker identify as vulnerable?

After enumerating the installed packages, the attacker identified an application as vulnerable. In the Prefetch artifacts, after the malware ran and the installed packages were enumerated, Yandex Browser was launched. Right after that, more command execution occurred, including NET.exe and NET1.exe, indicating that the attacker tried to add a new user to the system.

alt text

The answer is YandexBrowser.

Task 6

What version of that vulnerable application did the attacker identify?

The version number could be found from the Prefetch files used in the previous task.

The answer is 24.4.5.498.

Task 7

What is the CVE associated with this vulnerability?

The identified vulnerable application was YandexBrowser version 24.4.5.498. I searched for the CVE associated with this command execution vulnerability.

alt text

The answer is CVE-2024-6473.

Task 8

What is the name of the legitimate binary that the attacker used to deliver the malicious payload and establish persistence on the compromised system?
Explanation — DLL hijacking

After identifying the CVE exploited by the attacker, I researched how the exploit worked. From this PoC and this article, I found that YandexBrowser has a DLL hijacking vulnerability because it uses an untrusted search path to load a DLL file. An attacker can place a malicious DLL in the same directory as the vulnerable application. When the application tries to load the DLL, it loads the malicious copy with the application’s privileges and inherited firewall rules, allowing arbitrary code execution on the system.

DLL hijacking flow:

alt text

Search-order core:

alt text

At this point, I knew the attacker had exploited the DLL hijacking vulnerability in YandexBrowser to deliver the malicious payload and establish persistence on the compromised system. Using the $MFT, I found suspicious DLL files in the same directory as YandexBrowser: %APPDATA%\Local\Yandex\YandexBrowser\Application\24.4.5.498.

alt text

I found several DLL files in the same directory as YandexBrowser. One of them was wldp.dll, which is a legitimate Windows DLL, but it should not be in that directory.

Explanation — Windows Lockdown Policy DLL

wldp.dll (Windows Lockdown Policy) is a legitimate Windows system file located in C:\Windows\System32. It handles policy checks that determine whether scripts, packaged apps, or software components are permitted to run based on security settings.

Therefore, wldp.dll was likely the malicious DLL file dropped by the attacker. From there, I used the Prefetch files again to determine which program loaded or downloaded this malicious DLL file.

alt text

The legitimate Windows binaries I saw were certutil.exe, conhost.exe, msedge.exe, and taskmgr.exe. The most suspicious one was certutil.exe because attackers commonly use it to download files from the internet. Checking the Files loaded section of the certutil.exe entries confirmed my suspicion.

alt text

The answer is certutil.exe.

Task 9

What is the name of the malicious Portable Executable (PE) file that enabled him to accomplish his objective?

From the previous task, I knew that the attacker used certutil.exe to download the malicious DLL file, which was wldp.dll.

The answer is wldp.dll.

Task 10

What is the SHA-256 hash of that malicious file?

The attacker used certutil.exe to download the malicious DLL file, wldp.dll. If you read my Silly Eli writeup, you know that certutil.exe stores metadata about downloaded files, as well as temporary files, in C:\Users\<User>\AppData\LocalLow\Microsoft\CryptnetUrlCache.

Metadata of the downloaded file:

alt text

The temporary file in C:\Users\<User>\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content has the same name as the metadata file. Therefore, the SHA-256 hash of the malicious file could be calculated using Get-FileHash or any other hashing tool.

PS C:\Users\quannd28\Downloads\HTb\e\C\Users\Administrator\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content> Get-FileHash .\A16B2E6DE64B13EDF2C00F32C4559930 -Algorithm SHA256
 
Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          A1A17EBD90610D808E761811D17DA3143F3DE0D4CC5EE92BD66000DCA87D9270       C:\Users\quannd28\Downloads\HTb\e\C\Users\Administrator\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content\A16B2E6DE6...

The answer is A1A17EBD90610D808E761811D17DA3143F3DE0D4CC5EE92BD66000DCA87D9270.

Task 11

How many milliseconds of cumulative coded sleep delays occurred before the C2 binary provided a shell after the vulnerable application was launched?

The provided artifacts did not help much with this task because it revolved around reversing the wldp.dll file. I loaded the binary in IDA Pro.

alt text

While analyzing the binary, I found this function.

__int64 sub_1800748E0()
{
  char *v0; // rdi
  __int64 i; // rcx
  HWND WindowW; // rax
  HANDLE CurrentProcess; // rax
  _BYTE v5[32]; // [rsp+0h] [rbp-50h] BYREF
  char v6; // [rsp+50h] [rbp+0h] BYREF
  HANDLE hObject; // [rsp+58h] [rbp+8h]
  struct _STARTUPINFOW StartupInfo; // [rsp+80h] [rbp+30h] BYREF
  struct _PROCESS_INFORMATION ProcessInformation; // [rsp+108h] [rbp+B8h] BYREF
  struct _STARTUPINFOW lpStartupInfo; // [rsp+140h] [rbp+F0h] BYREF
  struct _PROCESS_INFORMATION lpProcessInformation; // [rsp+1C8h] [rbp+178h] BYREF
  HWND v12; // [rsp+1F8h] [rbp+1A8h]
  char v13; // [rsp+2D4h] [rbp+284h]
 
  v0 = &v6;
  for ( i = 130; i; --i )
  {
    *(_DWORD *)v0 = -858993460;
    v0 += 4;
  }
  v13 = 0;
  sub_180070FA3(&unk_18019909F);
  hObject = CreateMutexW(nullptr, 1, L"Global\\YandaExeMutex");
  if ( !hObject
    || GetLastError() == 183
    || (StartupInfo.cb = 104,
        memset(&StartupInfo.lpReserved, 0, 0x60u),
        lpStartupInfo.cb = 104,
        memset(&lpStartupInfo.lpReserved, 0, 0x60u),
        (v12 = FindWindowW(nullptr, L"Yandex Browser")) != nullptr) )
  {
    CloseHandle(hObject);
  }
  else
  {
    CreateProcessW(
      L"C:\\Users\\Administrator\\AppData\\Local\\Yandex\\YandexBrowser\\Application\\browser.exe",
      nullptr,
      nullptr,
      nullptr,
      1,
      0,
      nullptr,
      nullptr,
      &StartupInfo,
      &ProcessInformation);
    Sleep(0x2710u);
    WindowW = FindWindowW(nullptr, L"yanda.tmp");
    v12 = WindowW;
    if ( !WindowW )
    {
      v13 = 1;
      CreateProcessW(
        L"C:\\Users\\Administrator\\AppData\\Local\\Temp\\yanda.tmp",
        nullptr,
        nullptr,
        nullptr,
        1,
        0,
        nullptr,
        nullptr,
        &lpStartupInfo,
        &lpProcessInformation);
      Sleep(0x3E8u);
    }
    CloseHandle(ProcessInformation.hProcess);
    CloseHandle(ProcessInformation.hThread);
    if ( !v13 )
      sub_18006E7BC("proc_info2");
    CloseHandle(lpProcessInformation.hProcess);
    CloseHandle(lpProcessInformation.hThread);
    CloseHandle(hObject);
    CurrentProcess = GetCurrentProcess();
    TerminateProcess(CurrentProcess, 0);
  }
  return sub_180070742(v5, &unk_180155D10);
}

The function shows that wldp.dll creates a mutex to ensure that only one instance of the malware runs. If the Yandex Browser window is not already open, it launches the vulnerable application and waits for 10,000 milliseconds (0x2710u). It then checks for a yanda.tmp window. If that window is not found, it launches the C2 binary, yanda.tmp, and waits another 1,000 milliseconds (0x3E8u).

The answer is 11000.

Task 12

What is the mutex name used to ensure only one instance of the C2 binary runs at a time?

From the previous task, I could see that the mutex name used to ensure only one instance of the C2 binary runs at a time was Global\\YandaExeMutex.

The answer is Global\\YandaExeMutex.

Task 13

What is the full path of the Command and Control (C2) Binary?

From the previous task, I could see that the full path of the command-and-control (C2) binary was C:\Users\Administrator\AppData\Local\Temp\yanda.tmp.

The answer is C:\Users\Administrator\AppData\Local\Temp\yanda.tmp.

Task 14

What is the name of the C2 framework used by the attacker?

Although I knew the C2 binary was named yanda.tmp, I could not find any trace of this file in the provided artifacts. However, in the previous certutil.exe cached files, there was a metadata file containing the URL used to download yanda.tmp.

alt text

This suggested that yanda.tmp was also downloaded using certutil.exe, just like the malicious DLL file. I could now recover the executable from the Content folder and analyze it.

I used Detect It Easy to identify which programming language was used to create this binary.

alt text

It was created using the Go programming language. One of the most common Go-based C2 frameworks is Sliver, but this was only a guess. To confirm it, I uploaded the binary to VirusTotal to see whether it had any detections or labels.

alt text

The VirusTotal report showed that this binary was indeed a Sliver C2 binary.

The answer is Sliver.

Task 15

What is the IP address and port number of the malicious C2 server used by the attacker?

Reversing a Go binary is not easy, and I do not have much experience with Go binary reverse engineering. Instead of static analysis, I decided to perform dynamic analysis on this binary.

I used Process Monitor, executed the yanda.tmp binary, and monitored its network activity.

alt text

The binary tried to connect to ec2-18-192-12-126.eu-central-1.compute.amazonaws.com on port 8888.

Various services can resolve this domain, but I prefer to use nslookup.

PS C:\Users\quannd28\Downloads\HTb\e\C\Users\Administrator\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content> nslookup ec2-18-192-12-126.eu-central-1.compute.amazonaws.com
Non-authoritative answer:
Name:    ec2-18-192-12-126.eu-central-1.compute.amazonaws.com
Address:  18.192.12.126

The answer is 18.192.12.126:8888.

Question and Answer

#QuestionAnswer
1At what exact time did the user execute the malicious shortcut file?2025-01-26 16:17:15
2What is the full path of the initial payload?C:\Temp\svch0st.exe
3At what timestamp did the payload execute and grant the attacker shell access?2025-01-26 16:17:54
4What command line did the attacker use to enumerate installed packages?C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command Get-Package
5Which application did the attacker identify as vulnerable?YandexBrowser
6What version of that vulnerable application did the attacker identify?24.4.5.498
7What CVE is associated with this vulnerability?CVE-2024-6473
8What legitimate binary did the attacker use to deliver the payload and establish persistence?certutil.exe
9What malicious PE file enabled the attacker to accomplish his objective?wldp.dll
10What is the SHA-256 hash of that malicious file?A1A17EBD90610D808E761811D17DA3143F3DE0D4CC5EE92BD66000DCA87D9270
11How many milliseconds of cumulative coded sleep delays occurred before shell access?11000
12What mutex name ensures only one instance of the C2 binary runs at a time?Global\\YandaExeMutex
13What is the full path of the C2 binary?C:\Users\Administrator\AppData\Local\Temp\yanda.tmp
14What is the name of the C2 framework used by the attacker?Sliver
15What is the IP address and port number of the malicious C2 server?18.192.12.126:8888

MITRE ATT&CK

TacticTechniqueIDEvidence
Initial AccessUser Execution: Malicious FileT1204.002User executed the malicious 2025-GiveAways.lnk shortcut.
ExecutionCommand and Scripting Interpreter: PowerShellT1059.001powershell.exe -Command Get-Package was executed.
ExecutionExploitation for Client ExecutionT1203Attacker exploited CVE-2024-6473 in YandexBrowser.
DiscoverySystem Owner/User DiscoveryT1033Attacker ran whoami after gaining access.
DiscoverySystem Information DiscoveryT1082Attacker ran systeminfo after gaining access.
DiscoverySoftware DiscoveryT1518Attacker enumerated installed packages with Get-Package.
Defense EvasionMasqueradingT1036Payload svch0st.exe masqueraded as legitimate svchost.exe.
Defense Evasion / Persistence / Privilege EscalationHijack Execution Flow: DLL Search Order HijackingT1574.001Malicious wldp.dll was placed in the Yandex Browser application directory.
Command and ControlIngress Tool TransferT1105certutil.exe downloaded wldp.dll and yanda.tmp.
PersistenceCreate Account: Local AccountT1136.001NET.exe and NET1.exe activity indicated an attempt to add a local user.
Command and ControlApplication Layer ProtocolT1071Sliver C2 binary connected to 18.192.12.126:8888.

Attack Flow

alt text