SeRestorePrivilege Abuse for Privilege Escalation
SeRestorePrivilege allows writing to any file on the system regardless of ACLs: the counterpart to SeBackupPrivilege. With this privilege you can overwrite service binaries, DLLs in system directories, and registry-backed files. The classic path is overwriting a service binary or a utilman/sethc sticky-key style binary, then triggering execution.
Overwrite a SYSTEM service binary with a payload using
robocopy /BReplace accessibility tools (sethc.exe, utilman.exe) for pre-login SYSTEM shells
Restore modified registry hives to change service ImagePath values
SeRestorePrivilege Windows Escalation Check
SeRestorePrivilege must show Enabled. If disabled, enable it:
Step 1: Identify a Target File to Overwrite
Service binary (most reliable):
Find a service that runs as SYSTEM and whose binary you can overwrite using restore semantics:
System utility overwrite (for RDP/console access):
When you have RDP or physical console access, overwrite accessibility tools that launch before login:
C:\Windows\System32\sethc.exe (Sticky Keys: Shift x5)
C:\Windows\System32\utilman.exe (Accessibility: Win+U)
C:\Windows\System32\osk.exe (On-Screen Keyboard)
C:\Windows\System32\narrator.exe (Narrator)
Step 2: Overwrite the Target File
Use robocopy /B (backup mode): it respects SeRestorePrivilege and ignores file ACLs:
Using the reg restore API via PowerShell for registry-backed files:
Step 3: Trigger Execution
If you overwrote a service binary:
If you overwrote sethc.exe with cmd.exe (RDP/console):
Connect to RDP or sit at the console login screen
Press Shift five times rapidly
A SYSTEM cmd.exe opens without authentication
If you overwrote utilman.exe with cmd.exe:
At the Windows login screen, press
Win+USYSTEM cmd.exe opens
Step 4: Restore Original Files
After escalating, restore the original files to avoid breaking the system:
If you did not back up the original, restore from the Windows installation:
SeRestorePrivilege via Registry
With SeRestorePrivilege you can also restore registry hives, which allows modifying service ImagePath values:
References
-
Windows Privilege ConstantsDOCS: Windows Privilege Constants, docs.microsoft.com/en-us/windows/win32/secauthz/privilege-constants (opens in new tab)
Microsoft Docs SeRestorePrivilege definition and file access rights granted.
-
SeBackupPrivilege CmdLetsREPO: SeBackupPrivilege CmdLets, github.com/giuliano108/SeBackupPrivilege (opens in new tab)
PowerShell module supporting both backup and restore semantics file operations.