SeBackupPrivilege
If we are members of the Backup Operators group, we will be given the SeBackup and SeRestore privileges. The SeBackupPrivilege allows us to traverse any folder and list the folder contents.
Abuse SeBackupPrivilege to Read files
In order to exploit SeBackupPrivilege you have to:
- Enable the privilege.
This alone lets you traverse (cdinto) any1 directory, local or remote, and list (dir,Get-ChildItem) its contents. - If you want to read/copy data out of a "normally forbidden" folder, you have to act as a backup software. The shell
copycommand won't work; you'll need to open the source file manually usingCreateFilemaking sure to specify theFILE_FLAG_BACKUP_SEMANTICSflag.
We will use this PoC: https://github.com/giuliano108/SeBackupPrivilege . Also available here: Mytools: SeBackupPrivilege
1. Open Powershell in the target machine, copy the library binaries and import the required libraries:
2. Check privs and group memberships:
3. If SeBackupPrivilege is present, double check if it is enabled:
4. If disabled, enable it (and check it back):
5. Now the privilege is enabled and it can be now leveraged to copy any protected file (not to read it).
Abuse SeBackupPrivilege to back up SAM and SYSTEM Registry Hives
The SeBackupPrivilege also lets us back up the SAM and SYSTEM registry hives:
With this, we can extract local account credentials offline using a tool such as Impacket's secretsdump.py.
See more techniques at the Attacking sam and Attacking ntds pages, both for extracting the hives and then also for cracking the credentials, for instance:
- Alternative #1: vssadmin (locally)
- Alternative #2: crackmapexec (remotely)
- Alternative #3:
DSInternalsmodule (locally) - Alternative #4: Robocopy (locally)