👾 Overview
The SeBackupPrivilege
allows a user to read any files on a system, regardless of the security settings. This can be exploited to exfiltrate credentials through the SAM
, SYSTEM
, and NTDS.dit
files.
🔍 Discovery
This requires a user with the SeBackupPrivilege
enabled on a windows system.
📌 Exploitation
This privilege can be used to extract the SAM
/SYSTEM
files easily from any machine to get access to local usernames and passwords stored as NTLM hashes.
If the machine you’re attacking is a domain controller, some extra steps can be performed to extract NTDS.dit
. This is AD’s primary database file which can be used to extract domain logons.
SAM/SYSTEM
Reg.exe
This is the most straightforward way to save the files, takes 2 commands and you can grab them right from the registry.
NTDS.dit
Diskshadow + Robocopy
This should work on Windows Server 2008+
Create the following script on the victim machine to be used with diskshadow, it creates a shadow copy of the disk and exposes it for us to copy from:
Execute the following:
If you're having trouble with diskshadow running, check the line endings on the file you created and ensure they're in windows format. Additionally ensure that the E: drive label isn't taken, change that if need be.
✨ Post-Exploitation
After exfiltrating your files, you’ll want to use a tool to extract the actual secrets from them.
Impacket-Secretsdump
📝 Resources
🔗 Hyperlink | ℹ️ Info |
---|---|
MS Docs | Microsoft’s information on filesystem privileges |
Hacking Articles | Exploiting SeBackupPrivilege |
Red Team Notes | Various ways to dump NTDS.dit |