Weak Registry Permissions for Windows Privilege Escalation
Windows services store their configuration in the registry under HKLM\System\CurrentControlSet\Services\. If your user has write access to a service's registry key, you can change the ImagePath value to point to any binary — effectively the same as service binary hijacking but without needing to touch the filesystem ACL of the binary itself. Changing ServiceDLL in service parameters achieves the same via DLL injection.
Prerequisites Check
Step 1 — Find Services with Writable Registry Keys
Using accesschk:
Look for KEY_SET_VALUE, KEY_ALL_ACCESS, or WRITE_DAC.
Using PowerShell:
# Check registry permissions on all services
$services = Get-ChildItem "HKLM:\System\CurrentControlSet\Services"
foreach ($service in $services) {
$acl = Get-Acl $service.PSPath
foreach ($access in $acl.Access) {
if ($access.IdentityReference -match "Users|Everyone|Authenticated" -and
$access.RegistryRights -match "SetValue|FullControl|WriteKey") {
Write-Host "WRITABLE: $($service.Name) | $($access.IdentityReference) | $($access.RegistryRights)"
}
}
}
Step 2 — Confirm the Service Runs as SYSTEM
ObjectName of LocalSystem or StartName of LocalSystem confirms SYSTEM execution.
Step 3a — Modify ImagePath
Change the service's binary path to your payload
Step 3b — Modify ServiceDLL
Some services load a DLL specified in Parameters\ServiceDll rather than a standalone binary. If this key is writable:
Your DLL must export ServiceMain for services that use this pattern. Use a proxy DLL as described in https://hackindex.io/platforms/windows/privilege-escalation/dll-hijacking.
Step 4 — Create and Transfer Payload
Step 5 — Restore Original Configuration
References
-
Service Configurationdocs.microsoft.com/en-us/windows/win32/services/service-configuration-programs (opens in new tab)
Microsoft Docs Registry key structure for Windows services including ImagePath and ServiceDll.
-
Sysinternals Registry key permission enumeration with KEY_SET_VALUE detection.
Was this helpful?
Your feedback helps improve this page.