// HackTheBox  ·  writeup

CrownJewel-1

HackTheBox Very Easy EvtxECmdMFTECmdPython
DFIR

Scenario

In this very easy sherlock, you will learn how to detect NTDS.dit dumping which is one of the most critical Active directory attacks. You will get your hands on event logs and MFT to respond to an attack where the attacker utilized vssadmin utility to dump the NTDS.dit database.

Executive Summary

An attacker on a domain controller used vssadmin to create a volume shadow copy, which started the Volume Shadow Copy service and made it enumerate the privileged local groups under the machine account. The snapshot was mounted as a shadow volume, and the locked Active Directory database was copied out of it. About two minutes after the service started, a copy of the database and a copy of the SYSTEM hive were sitting in a folder under the Administrator profile. Together those two files are everything needed to extract every domain credential offline.

Artifacts

Timestamp note: Questions want YYYY-MM-DD HH:MM:SS. The MFT CSV carries 7 decimal places, so cut the fraction rather than rounding.

Credential Access

Q1 — Attackers can abuse the vssadmin utility to create volume shadow snapshots and then extract sensitive files like NTDS.dit to bypass security mechanisms. Identify the time when the Volume Shadow Copy service entered a running state.

Parse the event logs to CSV first, then grep the System log output for shadow. The Service Control Manager event 7036 records the Volume Shadow Copy service moving to the running state, and that line is the start of the snapshot activity.

EvtxECmd -d evidence --csv work/evtx
grep -i shadow work/evtx/system.csv
Click flag to reveal 2024-05-14 03:42:16
Q2 — When a volume shadow snapshot is created, the Volume shadow copy service validates the privileges using the Machine account and enumerates User groups. Find the two user groups the volume shadow copy process queries and the machine account that did it.

Pivot to the Security log around the Q1 time and look at event 4799, a security-enabled local group membership enumeration. The calling process is VSSVC.exe, it enumerates two groups, and the subject is the domain controller’s machine account, which fits the service validating privileges as the machine rather than as a user. The answer wants the account name without the domain prefix.

grep 4799 work/evtx/security.csv
Click to reveal answer Administrators, Backup Operators, DC01$
Q3 — Identify the Process ID (in Decimal) of the volume shadow copy service process.

The same 4799 events carry the caller process ID for VSSVC.exe as hex, so convert it to decimal for the answer.

grep 4799 work/evtx/security.csv

Gotcha: The log shows the PID in hex (0x1190) but the question wants decimal.

Click flag to reveal 4496
Q4 — Find the assigned Volume ID/GUID value to the Shadow copy snapshot when it was mounted.

The NTFS log records the snapshot mount as an event 4 for HarddiskVolumeShadowCopy1. Find that row in the CSV and read its payload. The VolumeId field in the payload is empty, so the GUID that identifies the snapshot is in VolumeCorrelationId.

grep -i shadowcopy work/evtx/ntfs.csv

Gotcha: The question says “Volume ID”, but the VolumeId field is empty on this event. The value to submit is the VolumeCorrelationId.

Click to reveal answer {06c4a997-cca8-11ed-a90f-000c295644f9}

Collection

Q5 — Identify the full path of the dumped NTDS database on disk.

The event logs show the snapshot but not where the copy landed, so switch to the MFT. Search the parsed $MFT for ntds; the copy sits in a backup_sync_dc folder under the Administrator profile, well away from the legitimate NTDS folder.

MFTECmd -f '$MFT' --csv work/mft --csvf mft.csv
grep -i ntds work/mft/mft.csv
Click flag to reveal C:\Users\Administrator\Documents\backup_sync_dc\ntds.dit
Q6 — When was newly dumped ntds.dit created on disk?

Take the Q5 entry and read its $STANDARD_INFORMATION creation time (Created0x10). It lands about two minutes after the service started in Q1, which fits a dump run straight after the snapshot.

python3 -I filter_mft.py work/mft/mft.csv   # rows for ntds.dit / SYSTEM created 2024-05-14 03:4x
Click to reveal answer 2024-05-14 03:44:22
Q7 — A registry hive was also dumped alongside the NTDS database. Which registry hive was dumped and what is its file size in bytes?

Look at the other files created in the same folder in the same minutes. A SYSTEM hive appears about twenty seconds after the database. It matters because the boot key inside it is needed to decrypt the secrets in ntds.dit. Read the size from the file size column of the MFT row.

python3 -I filter_mft.py work/mft/mft.csv   # same filter, SYSTEM row
Click flag to reveal SYSTEM, 17563648

Attack Summary

PhaseAction
Credential AccessVolume Shadow Copy service starts on the domain controller after a vssadmin snapshot request
Credential AccessVSSVC.exe enumerates Administrators and Backup Operators as the machine account
Credential AccessSnapshot mounted as a shadow volume
Collectionntds.dit copied to a folder under the Administrator profile
CollectionSYSTEM hive copied into the same folder

IOCs

TypeValue
FileC:\Users\Administrator\Documents\backup_sync_dc\ntds.dit
FileC:\Users\Administrator\Documents\backup_sync_dc\SYSTEM (17563648 bytes)
Shadow copy correlation ID{06c4a997-cca8-11ed-a90f-000c295644f9}
ProcessVSSVC.exe, PID 4496

MITRE ATT&CK

TechniqueIDDescription
OS Credential Dumping: NTDST1003.003vssadmin shadow copy used to copy ntds.dit off the domain controller
Data from Local SystemT1005Database and SYSTEM hive staged in a folder under the Administrator profile

Defender Takeaways

Shadow copy creation on a domain controller should alert. SYSTEM event 7036 for the VSS service and the NTFS shadow volume mount are easy to correlate with a vssadmin process, and on a DC outside backup windows they are rare.

ntds.dit and a SYSTEM hive together outside the NTDS folder is a dump signal. The pair in a user’s Documents folder has no legitimate reason to exist. A file-creation rule on ntds.dit outside its default path catches this directly.

Event 4799 is a useful corroborating event. VSSVC.exe enumerating Administrators and Backup Operators as the machine account fits snapshot creation, but it is only logged if the audit policy for security group management is on.

Treat any exposed ntds.dit as a full domain credential compromise. Restrict who holds Backup Operators and administrative rights on domain controllers, and plan to reset every credential, including krbtgt, if a copy leaves the DC.

Conclusion

The attacker took the domain’s whole credential store using only a built-in utility, and left no malware behind. The signal was the shadow copy sequence and two files in the wrong folder.