// HackTheBox  ·  writeup

Heist

HackTheBox Hard PECmdMFTECmdEvtxECmdSrumECmdSQLitetsharkPythonimpacket
DFIRWindowsNetwork

Scenario

In this hard Sherlock, you are tasked with investigating a serious breach at Forela’s YouTube channel. Instead of the regular company content, the live stream has been hijacked to display videos promoting cryptocurrency scams, sparking complaints from viewers. The channel, managed by IT administrator Alonzo Spire, is a significant platform for Forela to engage with its audience through product showcases and educational content.

Once the incident was reported, Alonzo’s system was swiftly triaged and artifacts collected for forensic analysis. Your responsibility is to analyze these artifacts to understand how the YouTube channel was compromised. This scenario calls on your digital forensics expertise and your understanding of a variety of evidence sources to uncover the breach’s origin, ensuring the company’s digital presence remains secure.

Executive Summary

A phishing email sent to the Forela IT administrator linked to a Google Drive download of a zip archive. Inside was an executable dressed up as a PDF with a double extension, which the victim ran. It unpacked a chain of self-extracting stagers into Temp, the last of which was a RedLine stealer that connected to a bare-IP command server over a WCF net.tcp channel. The stealer swept the workstation and uploaded browser logins, a saved payment card, an FTP credential, a desktop note and sensitive Office documents in one stream. The packet capture shows the stolen content and the Windows SRUM database gives the byte count the stealer sent. The leaked browser credentials explain the hijacked YouTube channel.

Artifacts

Timestamp note: Answers are UTC. Prefetch, MFT and Chrome downloads already store UTC. The email carries several Received hops in different zones, so pick the hop with care (Q1).

Initial Access

Q1 — At what time was the suspected phishing email received in the victim's inbox? (UTC)

Read the Received chain in the .eml from the bottom up. The Zoho relay hop is stamped in CEST (10:55:24), the sender-side handoff. The Postfix hop on the receiving server records arrival and is already in UTC.

grep -i '^Received' Email.eml

Gotcha: The Zoho hop converts to 08:55:24 UTC and looks right, but it is the relay hop. Delivery is the Postfix Received line, two seconds earlier.

Click flag to reveal 2023-04-11 08:55:22
Q2 — Please provide the download URL that was utilised to retrieve the file initially downloaded as part of this security event.

The email link leads to Google Drive. Chrome’s History SQLite file stores every redirect hop of a download in downloads_url_chains. The last hop is the direct googleusercontent.com URL that served the bytes, not the Drive share page.

sqlite3 History "select id, chain_index, url from downloads_url_chains order by id, chain_index"

Tip: Take the highest chain_index for the download id. Earlier hops are Drive landing pages.

Click to reveal answer https://doc-0s-5g-docs.googleusercontent.com/docs/securesc/sjpaukai4p255id8irbsaa0d1ds9k29c/o8kmueker1h57tkoe14o1osgi4uhbafl/1681208325000/03105725814018983462/13809461445078444789Z/1KsmFJYLzRefViXzeyWYOoojfewRmJgpp?e=download&uuid=d3c34b3f-c99f-42b3-84b3-dfc4ac4f609a&nonce=iojdml3dsj58i&user=13809461445078444789Z&hash=o5gmgdrljfhdo4hvrt3oparan4sq0hm5
Q3 — What is the name of the file suspected to have been initially downloaded as part of this security event?

The downloads table in the same database names the target file. The $MFT output shows the same archive created in the user’s profile.

sqlite3 History "select target_path, start_time, tab_url from downloads"
Click flag to reveal Forela-Partnership.zip
Q4 — When was this file downloaded onto the system?

downloads.start_time is a WebKit epoch (microseconds since 1601), so convert it. The MFT creation time of the zip lands on the same second.

sqlite3 History "select datetime(start_time/1000000-11644473600,'unixepoch') from downloads"
MFTECmd -f '$MFT' --csv work/mft
Click to reveal answer 2023-04-11 10:19:24

Execution

Q5 — What is the name of the file that initiated malicious activity on the endpoint?

Parse the prefetch folder and look for executed binaries that do not belong. One .pf stands out: a name carrying two extensions that matches the archive from Q3.

PECmd -d prefetch --csv work/pf
Click flag to reveal Partnership.pdf.exe
Q6 — What file type was the malicious payload disguised as to deceive the user into executing it?

The binary from Q5 is named Partnership.pdf.exe. Windows hides known extensions by default, so the victim sees a PDF while the real type is an executable. The answer is the type it pretended to be.

Click to reveal answer pdf
Q7 — From which directory path was the malicious file executed?

The FilesLoaded column of the PARTNERSHIP.PDF.EXE prefetch record lists the volume paths the process touched, which gives the directory it ran from.

python3 -I -c "import csv;[print(r['SourceFilename'],r['FilesLoaded'][:400]) for r in csv.DictReader(open('work/pf/pecmd.csv')) if 'PARTNERSHIP' in r['SourceFilename']]"
Click flag to reveal C:\USERS\ALONZO.SPIRE\DOCUMENTS\
Q9 — At what time was the malicious file was executed?

LastRun in the same prefetch record gives the execution time, about 40 seconds after the download finished in Q4.

python3 -I -c "import csv;[print(r['SourceFilename'],r['RunCount'],r['LastRun']) for r in csv.DictReader(open('work/pf/pecmd.csv')) if 'PARTNERSHIP' in r['SourceFilename']]"
Click flag to reveal 2023-04-11 10:20:06
Q10 — The malicious file dropped 2 files on the system which performed further actions on the endpoint. What's the name of these 2 files? (alphabetical order)

FilesLoaded for Partnership.pdf.exe, cross-checked against the MFT, shows two executables loaded from Temp\IXP000.TMP. That folder naming matches an IExpress self-extractor unpacking its payload, so these are the first-stage droppers.

python3 -I -c "import csv;[print(r['FilesLoaded']) for r in csv.DictReader(open('work/pf/pecmd.csv')) if r['SourceFilename'].startswith('PARTNERSHIP')]"
Click to reveal answer SI168290.EXE, UN598654.EXE
Q11 — One of the files from Question 10 dropped two more files onto the system. What are the names of these files? (in alphabetical order)

Repeat for the prefetch entry of UN598654.EXE, one of the two droppers from Q10. It loads two further binaries from a new IXP001.TMP folder, the next layer of the same extractor chain.

python3 -I -c "import csv;[print(r['FilesLoaded']) for r in csv.DictReader(open('work/pf/pecmd.csv')) if r['SourceFilename'].startswith('UN598654')]"
Click flag to reveal PRO5093.EXE, QU2705.EXE

Command and Control

Q12 — What is the malicious C2 IP Address and port?

Rank the TCP conversations in the capture. One external bare-IP peer on a high port carries almost all of the outbound data, far more than any browsing traffic. Sysmon-style event logs were parsed as a cross-check.

tshark -r Heist.pcapng -q -z conv,tcp
EvtxECmd -d evtx --csv work/evtx --csvf e.csv
Click to reveal answer 176.113.115.145:4125
Q13 — What is the malware family of the malicious file?

Following the streams to the C2 shows net.tcp WCF framing with Entity and Id records and a file-grabber configuration. That structure is characteristic of RedLine. This was identified from the protocol shape and the layout of the stolen data, not from a hash or sandbox verdict.

tshark -r Heist.pcapng -q -z follow,tcp,raw,441
Click flag to reveal Redline

Exfiltration

Q14 — Which malicious file exfiltrated data from the endpoint?

The stealer’s process list is embedded in the exfil stream and names qu2705.exe, the second-layer binary from Q11, which ran from IXP001.TMP. A second RedLine instance (si168290.exe) also reached the same C2, so the SRUM byte count in Q21 is what pins this one down.

grep -i qu2705 work/pf/pecmd.csv | cut -c1-300

Gotcha: Both qu2705.exe and si168290.exe talked to the C2. The Q21 format mask ends in 9, and only qu2705.exe has a SRUM total that fits.

Click to reveal answer C:\USERS\ALONZO.SPIRE\APPDATA\LOCAL\TEMP\IXP001.TMP\QU2705.EXE
Q15 — What's the process ID of the malicious file used to exfiltrate data?

The RedLine stream carries a process list with a line like ID: 3924, Name: qu2705.exe. The Application Error (1000) event for the crashed process has the PID in hex in its parameters, f54, which is 3924 decimal.

strings -n 6 s54013.bin | grep -i 'qu2705'
grep -i qu2705 evtx/e.csv
Click flag to reveal 3924
Q21 — How many bytes of data were sent by the malicious process found in question 14? Please note - the PCAP data does not provide the answer.

SRUM’s NetworkUsage table keeps bytes sent per application. SrumECmd does not run on Linux, so the ESE database was read with impacket’s ese module and the table dumped. QU2705.exe shows the figure that fits the Q14 mask.

SrumECmd -f SRUDB.dat -r SOFTWARE --csv work/srum
python3 -I srum_dump.py SRUDB.dat

Tip: The second RedLine instance, SI168290.EXE, sent 106903 bytes. Close, but not the target.

Click flag to reveal 107059

Collection

Q8 — There was a file on users desktop with a note. What were the contents of the note?

RedLine uploads files from the desktop. Decoding the exfil stream shows reminder.txt and its contents. The WCF chunk boundary splits the last word across two records, so stitch the pieces together.

strings -n 6 s54015.bin | grep -B2 -A6 'reminder.txt'

Gotcha: The sentence is split mid-word in the stream (neede then d.). Reassemble it and leave off the trailing period, which is not part of the accepted text.

Click to reveal answer Contact Pakistan operations team to get updates and assist them if needed
Q19 — A migration plan document containing sensitive internal information was also stolen during the attack. Who sent this document to Alonzo?

The stolen files include a Word document about an AWS migration. Carve it out of the stream by locating the zip signature, then read the signature block for the sender.

python3 -I carve_docx.py s54013.bin

Gotcha: The first PK match can belong to a different embedded file. Cut at the first PK\x05\x06 end-of-central-directory record after the local header so the zip opens cleanly.

Click flag to reveal Abdullah Yasin
Q20 — Forela plans to upgrade its infrastructure as it expands globally. When is the planned date for the infrastructure upgrade?

A second stolen Office file, Infra upgrade.docx, carves the same way. The planned date appears in its title text.

python3 -I carve_docx.py s54013.bin
grep -ri 'upgrade' kape/ | head
Click to reveal answer 2024-01-17

Credential Access

Q16 — After the data exfiltration incident, another alert indicated data was exfiltrated from an FTP server containing critical files. Our TI team suspects an internal credential leak. What is the IP address and password of the FTP server to which Alonzo had access?

RedLine uploads saved FTP credentials as an Id12 record in the stream. It names an FTPS server at 13.45.67.23:21 for the user alonzo.spire, with the saved password beside it.

strings -n 6 s54015.bin | grep -B3 -A6 '13.45.67.23'
Click to reveal answer 13.45.67.23:TheAwesomeGrape
Q17 — What was the password of the YouTube channel which was hacked?

The stolen browser logins sit in the same stream. The entry for https://youtube.com/ under the username Forela-Media holds the channel password, which explains how the live stream was hijacked.

strings -n 6 s54015.bin | grep -B2 -A4 -i 'youtube.com'
Click flag to reveal yoUKnoWnoThiNGJoNSNoW
Q18 — Alonzo reported unauthorized use of his credit card and believes his card details were compromised. What was his credit card number?

The stream also holds a saved payment card record in the name of Alonzo Spire. Scan for 16-digit card patterns and take the one with his name.

python3 -I -c "import re;d=open('s54015.bin','rb').read();print(set(re.findall(rb'\b4\d{15}\b',d)))"
Click to reveal answer 4012873018191881

Attack Summary

PhaseAction
Initial AccessPhishing email delivered with a Google Drive download link
Initial AccessVictim downloads Forela-Partnership.zip through Chrome
ExecutionVictim runs the double-extension executable from his Documents folder
ExecutionFirst-stage droppers unpack into Temp\IXP000.TMP
ExecutionSecond stage unpacks the RedLine binaries into Temp\IXP001.TMP
Command and ControlRedLine connects to a bare-IP C2 over WCF net.tcp
CollectionBrowser logins, FTP credential, payment card, desktop note and Office documents are gathered
ExfiltrationEverything is uploaded to the C2 in one stream
ImpactStolen channel credentials are used to hijack the YouTube live stream

IOCs

TypeValue
C2176.113.115[.]145:4125
Downloadhxxps[://]doc-0s-5g-docs[.]googleusercontent[.]com/docs/securesc/sjpaukai4p255id8irbsaa0d1ds9k29c/... (full URL in Q2)
FileForela-Partnership.zip
FilePartnership.pdf.exe
FileSI168290.exe, UN598654.exe, PRO5093.exe, QU2705.exe
PathTemp\IXP000.TMP, Temp\IXP001.TMP
IP (victim FTP)13.45.67[.]23

MITRE ATT&CK

TechniqueIDDescription
Phishing: Spearphishing LinkT1566.002Email with a Drive download link
User Execution: Malicious FileT1204.002Victim ran the disguised executable
Masquerading: Double File ExtensionT1036.007Partnership.pdf.exe
Ingress Tool TransferT1105Archive pulled from Google Drive
Credentials from Web BrowsersT1555.003Saved browser logins and card stolen
Data from Local SystemT1005Desktop note and Office documents collected
Exfiltration Over C2 ChannelT1041Single RedLine upload stream to the C2

Defender Takeaways

Show file extensions and block double extensions. The whole chain started with a .pdf.exe the victim read as a PDF. Showing known extensions through policy, and blocking execution of files with a document extension before .exe, removes the lure.

Execution from user-writable folders deserves an alert. Prefetch shows a binary running from Documents that then spawned self-extracting stagers in Temp\IXP00x.TMP. An EDR rule on that chain (user-folder exe spawning nested IExpress-style extractors) catches it in seconds.

A bare IP on a high port with a large upload is a clean network signal. One external peer received almost all of the workstation’s outbound bytes. Egress allow-listing or a volume-per-destination baseline would flag it.

Browser-saved credentials are the real loss. The channel password, the FTP password and a payment card all came from the browser store. A password manager with MFA on the channel account would have kept a stolen password from being enough.

Keep SRUM in your collection. It recorded per-process bytes sent when the capture could not attribute traffic to a process, and it is what separated two near-identical RedLine instances.

Conclusion

A single disguised executable gave RedLine everything it needed: one outbound stream carried the admin’s channel login, FTP access, card number and internal documents. The evidence needed to scope the loss was all on the endpoint, and SRUM plus prefetch told the story the network capture alone could not.