// HackTheBox  ·  writeup

OpTinselTrace24-5: Tale of Maple Syrup

HackTheBox Hard sqlite3bkcrackkeepass2johnhashcatpykeepassgrep
DFIR

Scenario

In this scenario we’re asked to analyze collection from an Android mobile device to detect malicious activity and insider threat.

Executive Summary

An insider at Santa’s workshop negotiated a paid leak with an outside buyer over the MEGA chat app on his Android phone. He kept a short to-do note in Google Keep about what the buyer wanted, then moved files from his workstation to the phone through a browser-based transfer service and forwarded them to the buyer as a password-protected ZIP. The ZIP held a KeePass vault and a text file of emails. The archive password was recovered with a known-plaintext attack against the ZIP’s legacy encryption, and the vault master password fell to a wordlist attack. The vault exposed the credentials for Santa’s workstation, and the chat shows the insider was paid in a cryptocurrency wallet address.

Artifacts

Timestamp note: Android stores times as epoch milliseconds. Convert to UTC before submitting in YYYY-MM-DD HH:MM:SS.

Command and Control

Q1 — Identifying IOCs, accounts, or infrastructure is crucial for detecting breaches by attackers. Determine the email address used by the threat actor so it can be added to Santa's threat intel feed.

Start with the chat app, since an insider needs a channel to the buyer. The MEGA karere database keeps a contacts table, and the one external contact carries the buyer’s email address.

sqlite3 -readonly karere-*.db ".tables" "select * from contacts"
Click flag to reveal [email protected]
Q2 — Which application was used by the insider threat to communicate with the threat actor? Please provide the application's Android package name.

The karere database belongs to MEGA, and its history table holds the full conversation between the insider and the contact from Q1. The directory name of the app data gives the package name.

sqlite3 -readonly karere-*.db "select hex(data) from history"

Tip: The message bodies are plain hex, not encrypted. Piping hex(data) through a hex decoder is all it takes to read the chat.

Click to reveal answer mega.privacy.android.app
Q3 — When was this application installed on the device?

The Play Store keeps its own install bookkeeping in localappstate.db. The appstate table has a first_download_ms value for each package; convert the MEGA row from epoch milliseconds to UTC. This was reasoned rather than read from a dedicated install-time field: several timestamps for the app exist, and first_download_ms is the earliest and the one that matches a first install.

sqlite3 -readonly com.android.vending/databases/localappstate.db "select package_name, first_download_ms from appstate where package_name like '%mega%'"
Click flag to reveal 2024-11-04 11:24:28
Q4 — What is the agreed amount of money to be sent to the insider threat in exchange of him leaking Santa workshop's secrets?

Decode the history table from Q2 and read the negotiation. The price is agreed in the eighth message of the conversation.

sqlite3 -readonly karere-*.db "select hex(data) from history" | xxd -r -p
Click to reveal answer $69000
Q13 — Twinkle got his money in cryptocurrency so it can't be traced. Which cryptocurrency did he receive money in, and what was its address?

The payment details are later in the same MEGA conversation (message 50). The currency name and wallet address are given together, which matches the currencyname:address format.

sqlite3 -readonly karere-*.db "select hex(data) from history" | xxd -r -p | grep -ai elfereum
Click flag to reveal Elfereum:LVg2kJoFNg45Nbpy53h7Fe1wKyeNJHeXV2

Collection

Q5 — Twinkle created a note on his phone using a note-keeping app. What were the contents of the note?

The phone has Google Keep installed. Its keep.db stores the note body in the list_item table, with the note metadata in tree_entity.

sqlite3 -readonly keep.db "select * from list_item"

Gotcha: The format mask has two sentences separated by . and ends in !!. Copy the text exactly, including the double exclamation marks.

Click to reveal answer I will need to find any ssh or rdp access that is open to internet. Will need to find their email address as well, maybe krampus will need those as well!!
Q6 — What is the title of this note?

The title is on the matching row in tree_entity, joined to the note from Q5.

sqlite3 -readonly keep.db "select * from tree_entity"
Click to reveal answer Collect Information
Q7 — When was the note created in the note-keeping app?

The time_created column in tree_entity holds epoch milliseconds (1730722495549). Converted to UTC it gives the creation time.

sqlite3 -readonly keep.db "select title, datetime(time_created/1000,'unixepoch') from tree_entity"
Click flag to reveal 2024-11-04 12:14:55

Exfiltration

Q8 — Twinkle Snowberry transferred a few files from his workstation to his mobile phone using an online file transfer service. What is the URL used to download the zip file on the mobile phone?

Check Firefox history and cache for the transfer service. JustBeamIt links carry a one-time token parameter, so grep the whole Firefox directory for the URL pattern and match the token to the info-send ZIP.

sqlite3 -readonly places.sqlite "select url, datetime(visit_date/1000000,'unixepoch') from moz_places p join moz_historyvisits v on v.place_id=p.id"
grep -rhao 'https://[a-z]*.justbeamit.com:8443/download?token=[a-z0-9]*' firefox/
Click to reveal answer https://eu.justbeamit.com:8443/download?token=um9w7
Q9 — When was this file shared with the threat actor by the insider, Twinkle Snowberry?

The ZIP was handed to the buyer through the MEGA chat from Q2. The message carrying info-send(1).zip is message 38, and its timestamp is the share time. This was reasoned from the chat record: the other timestamps (download on the phone, local file times) belong to earlier steps, and the message time is the moment the buyer received it.

sqlite3 -readonly karere-*.db "select ts, hex(data) from history"
Click flag to reveal 2024-11-05 12:04:24

Credential Access

Q10 — Twinkle forgot the password of the archive file he sent to Krampus containing secrets. What was the password for the file?

List the archive first: it holds Emails.txt and a SANTA-CONFIDENTIAL-PROD-ITR.kdbx vault, encrypted with legacy ZipCrypto. A dictionary attack on the 11-character password with rockyou got nowhere, so use a known-plaintext attack instead. A KDBX3 file starts with fixed signature bytes (03d9a29a67fb4bb5) followed by version bytes 01000300, which gives enough known plaintext for bkcrack to recover the internal keys. With the keys, brute-force the password with a mask search at length 11.

bkcrack -C a.zip -c SANTA-CONFIDENTIAL-PROD-ITR.kdbx -p p3.bin
bkcrack -k cec26f80 cc8751a0 fdf67470 -r 11 '?p'

Gotcha: The known-plaintext header must use the KDBX3 version bytes (01 00 03 00). Guessing KDBX4 headers fails, and each failed run costs several minutes.

Click to reveal answer passdrow69#
Q11 — What is the master password of the KeePass database that was leaked by the insider threat and handed over to the evil Krampus?

Use the recovered keys from Q10 to decrypt the vault straight out of the archive with bkcrack, so the ZIP password is not even needed. Then extract a hash with keepass2john and run it through hashcat mode 13400 against rockyou.

bkcrack -C a.zip -k cec26f80 cc8751a0 fdf67470 -c SANTA-CONFIDENTIAL-PROD-ITR.kdbx -d s.kdbx
keepass2john s.kdbx > s.hash && hashcat -m 13400 s.hash /usr/share/dict/rockyou.txt
Click flag to reveal weed420
Q12 — What is the password for Santa's account on his North Pole workstation?

Open the vault with the master password from Q11 and read the entry named for Santa’s workstation.

from pykeepass import PyKeePass
kp = PyKeePass('s.kdbx', password='weed420')
for e in kp.entries: print(e.title, e.username, e.password)
Click to reveal answer IHaveToSaveChristmas!$

Attack Summary

PhaseAction
Command and ControlInsider installs MEGA and opens a chat with the buyer
CollectionKeep note records what the buyer wants: internet-facing SSH/RDP and email addresses
ExfiltrationFiles pulled from the workstation to the phone through a JustBeamIt link
Exfiltrationinfo-send(1).zip (KeePass vault and email list, ZipCrypto) sent to the buyer over MEGA
Command and ControlPrice of $69000 agreed in chat; payment requested in a crypto wallet address
Credential AccessArchive password and vault master password later recovered by the investigator

IOCs

TypeValue
Email (buyer)krampusevilson@yahoo[.]com
App packagemega.privacy.android.app
URLhxxps[://]eu[.]justbeamit[.]com:8443/download?token=um9w7
Fileinfo-send(1).zip
FileSANTA-CONFIDENTIAL-PROD-ITR.kdbx
WalletElfereum:LVg2kJoFNg45Nbpy53h7Fe1wKyeNJHeXV2

MITRE ATT&CK

TechniqueIDDescription
Data from Local SystemT1005Workstation files gathered and moved to the phone
Data from Information RepositoriesT1213Credentials and emails stored in a KeePass vault and email list
Exfiltration Over Web ServiceT1567JustBeamIt transfer and MEGA chat used to move the data
Archive Collected Data: Archive via UtilityT1560.001Secrets packed in a password-protected ZIP
Brute Force: Password CrackingT1110.002bkcrack and hashcat against the ZIP and the vault
Credentials from Password Stores: Password ManagersT1555.005KeePass vault carried Santa’s workstation credentials
Valid AccountsT1078Leaked workstation credentials would give direct access
Web Service: Bidirectional CommunicationT1102.002MEGA chat used as the insider-to-buyer channel

Defender Takeaways

Personal phones are an unmanaged exfiltration path. The insider moved data from the workstation to his phone with a browser-based transfer service and passed it on through a consumer chat app. Block or alert on file-transfer services such as JustBeamIt and MEGA from corporate endpoints, and put mobile device management in front of work data.

A password manager vault is only as strong as its master password. weed420 fell to rockyou in moments. Enforce long, random master passphrases and a key file for high-value vaults, and never keep the vault with a copy of the credentials it protects.

ZipCrypto is not encryption you can lean on. Known plaintext at the start of a file (the KDBX header here) was enough to recover the keys and skip the password entirely. Use AES-256 archives, or encrypt the vault itself and not just the wrapper.

Insider risk shows in the small signals. A note titled with a collection plan and a new chat app installed the same day were sitting on the device. Combine HR context with DLP and endpoint telemetry so that unusual transfers and privileged-credential access trigger review before the data leaves.

Conclusion

The insider sold Santa’s secrets, including workstation credentials in a KeePass vault, for $69000 paid in cryptocurrency, and every step left traces in ordinary Android app databases. The attacker’s real edge was weak crypto hygiene: a legacy ZIP cipher and a wordlist-grade master password protected the secrets in name only.