// HackTheBox  ·  writeup

Jinkies

HackTheBox Medium EvtxECmdMFTECmdsecretsdumphashcatSQLitePython
DFIR

Scenario

Jinkies is a medium difficulty Sherlock where you’ll investigate the theft of intellectual property from an organisation called Cloud-guru. Find the source of the leak and answer the questions for senior management!

Executive Summary

An attacker reached a workstation belonging to the user Velma through an exposed file share. A database backup in her Documents folder held her cleartext password along with a few hundred other credentials, and the same password was in use for her Windows account. The attacker logged on over the network and interactively with it, ran basic recon from a command prompt, opened a Python project in VSCode, then browsed to a public paste site, which is the likely exfiltration point. A note dropped in her Pictures folder afterwards signed off with the attacker’s handle. Everything was reconstructed from the Security and Sysmon event logs, Chrome history, the registry dump and the raw $MFT.

Artifacts

Timestamp note: Questions use YYYY-MM-DD hh:mm:ss. All times in the collection are UTC and the events fall on 2023-10-06.

Initial Access

Q1 — Which folders were shared on the host? (Please give your answer comma separated, like this: c:\program files\share1, D:\folder\share2)

Share creation events (5140, 5142) were not logged, so the event logs cannot answer this. The shares live in the registry under LanmanServer\Shares, and the SYSTEM hive in the collection did not expose that key through regipy. The CrowdResponse registry dump does carry it. Each value holds a Path= entry, and two shares are defined: one for the whole Users tree and one for Velma’s Documents folder.

grep -a 'LanmanServer.Shares.*Path=' CrowdResponse_regdump.csv

Gotcha: The dump lists the Users share first, but the platform expects the narrower Documents share first. Order matters in the comma-separated answer.

Click flag to reveal C:\Users\Velma\Documents, C:\Users
Q2 — What was the file that gave the attacker access to the user's account?

The share from Q1 exposes Velma’s Documents. Under a logon website\bk\ folder sits an InnoDB backup (.ibd) of a login database. strings shows cleartext rows, including one for the velma user. On the event side, Security 4624 shows a network logon for Velma from 192.168.157.151 at 17:15:56, before any hands-on activity. The file is the only artifact containing her password in cleartext, so it is the access source. This was reasoned from those two facts rather than read from a single artifact that links them.

strings -a bk_db.ibd | grep -i velma
Click to reveal answer bk_db.ibd

Credential Access

Q3 — How many user credentials were found in the file?

The backup stores one row per user, with the email address as the username. Pull every unique Gmail address out of the file with a regex and count them.

python3 -I -c "import re,sys; d=open(sys.argv[1],'rb').read(); print(len(set(re.findall(rb'[\w.+-]+@gmail\.[a-z.]+', d))))" bk_db.ibd
Click flag to reveal 216
Q4 — What is the NT hash of the user's password?

Extract config.7z for clean SAM and SYSTEM hives and dump the local hashes offline. Velma is RID 1002.

secretsdump.py -sam work/cfg/SAM -system work/cfg/SYSTEM LOCAL
Click to reveal answer 967452709ae89eaeef4e2c951c3882ce
Q5 — Is the user's computer password the same as the password found in the ibd file? (Yes or No)

Take the password from Velma’s row in the Q2 backup and test it against the Q4 hash with hashcat mode 1000. The candidate matches, so her Windows password and her application password are identical.

hashcat -m 1000 -a 0 work/nt.txt /usr/share/dict/rockyou.txt

Tip: Rockyou alone is not needed if you feed hashcat the password from the ibd row as a one-line wordlist.

Click flag to reveal Yes

Execution

Q6 — What was the time the attacker first interactively logged on to our user's host?

Parse the Security log with EvtxECmd and filter 4624 for Velma from 192.168.157.151. Two records land in consecutive seconds: a type 3 logon from the authentication package and a type 10 (RemoteInteractive) logon one second later. The first of the two is the logon the platform accepts.

EvtxECmd -d evidence/ --csv work/evtx

Gotcha: The type 10 record is the textbook “interactive” logon, but the accepted time is the second before it, on the preceding type 3 record.

Click to reveal answer 2023-10-06 17:17:23
Q7 — What's the first command the attacker issues into the Command Line?

Sysmon Event ID 1 after the logon shows cmd.exe starting at 17:17:43. Its first child process, two seconds later, is the one-word answer, followed by net group and net users enumeration.

python3 -I list_sysmon_eid1.py work/evtx/*.csv --after "2023-10-06 17:17" --parent cmd.exe
Click flag to reveal whoami

Collection

Q8 — What is the name of the file that the attacker opens in VSCode shortly before launching the web browser?

Same Sysmon Event ID 1 listing: Code.exe starts at 17:18:26 with a Python script from Velma’s profile on its command line, and chrome.exe follows at 17:18:41.

python3 -I list_sysmon_eid1.py work/evtx/*.csv --after "2023-10-06 17:18" --image Code.exe,chrome.exe
Click to reveal answer Version-1.0.1 - TERMINAL LOGIN.py

Exfiltration

Q9 — What's the domain name of the location the attacker likely exfiltrated the file to?

Copy the Chrome History database and read the urls table. The attacker searched Google for a paste service and then visited its site at 17:19:38, right after the VSCode session. No upload artifact survived, so this is the likely destination rather than a proven transfer.

sqlite3 work/ch/History "select datetime(last_visit_time/1000000-11644473600,'unixepoch'), url from urls order by last_visit_time"
Click flag to reveal pastes.io

Attribution

Q10 — What is the handle of the attacker?

A learn.txt file was created in Velma’s Pictures folder at 17:23:46. The file itself was not collected, but it is small enough to be stored resident in its $MFT record. Locate the entry with MFTECmd, then read the resident data straight out of the raw record. It is a taunt signed with the attacker’s handle.

MFTECmd -f '$MFT' --csv work/mft
python3 -I parse_mft_resident.py '$MFT' 'Users\Velma\Pictures\learn.txt'
Click to reveal answer pwnmaster12

Attack Summary

PhaseAction
Initial AccessAttacker reaches Velma’s exposed Documents share
Credential AccessReads her cleartext password from the InnoDB backup
Initial AccessNetwork logon as Velma from 192.168.157.151
ExecutionInteractive logon, then cmd.exe
Discoverywhoami, net group, net users
CollectionOpens a Python project in VSCode
ExfiltrationBrowses to a paste site in Chrome
ImpactDrops a signed taunt note in Pictures

Forensic Timeline

Timestamp (UTC)Event
2023-10-06 17:15:56Velma network logon from 192.168.157.151
2023-10-06 17:17:23First logon of the interactive session (type 3)
2023-10-06 17:17:24RemoteInteractive logon (type 10)
2023-10-06 17:17:43cmd.exe starts
2023-10-06 17:17:45First command runs from cmd.exe
2023-10-06 17:18:26Code.exe opens the Python file
2023-10-06 17:18:41chrome.exe starts
2023-10-06 17:19:38Visit to the paste site
2023-10-06 17:23:46learn.txt created in Pictures

IOCs

TypeValue
IP192.168.157[.]151
Domainpastes[.]io
AccountVelma (RID 1002)
FileC:\Users\Velma\Documents\...\logon website\bk\bk_db.ibd
FileC:\Users\Velma\Pictures\learn.txt
Handlepwnmaster12

MITRE ATT&CK

TechniqueIDDescription
Valid Accounts: Local AccountsT1078.003Logon as Velma with her real password
Unsecured Credentials: Credentials in FilesT1552.001Cleartext password in the database backup
Brute Force: Password CrackingT1110.002NT hash matched against the backup password
Remote Services: Remote Desktop ProtocolT1021.001RemoteInteractive (type 10) logon
System Owner/User DiscoveryT1033whoami as the first command
Account Discovery: Local AccountT1087.001net users and net group
Command and Scripting Interpreter: Windows Command ShellT1059.003Hands-on cmd.exe session
Data from Local SystemT1005Project files opened in VSCode
Exfiltration Over Web ServiceT1567Paste site visited right after

Defender Takeaways

Never share a whole profile tree. A share on C:\Users and another on a user’s Documents folder let anyone who could reach SMB read a backup that was never meant to leave the machine. Restrict shares to named groups and review them regularly, since the share definitions here were only visible in the registry.

Keep credential backups out of user folders. An InnoDB file held cleartext passwords for hundreds of accounts. Hash application passwords, and treat database backups as sensitive data with controlled storage.

Password reuse turned an application leak into a host compromise. The password in the backup was also Velma’s Windows password, so the attacker needed no exploit at all. Unique passwords and MFA on remote logons break this step.

Log share activity. Events 5140 and 5142 were absent, so share access had to be inferred. Enabling file share auditing would have shown the original read of the backup.

Alert on a new logon followed within seconds by cmd.exe and recon. whoami and net users seconds after a remote logon from a new address is a cheap and reliable detection.

Conclusion

The attacker needed no exploit: a world-readable backup gave up a password that was reused on the Windows account, and the rest was a hands-on session ending at a paste site. The case turns on one reused credential and a share that should never have existed.