Weak Service Permissions

MITRE ATT&CK™ Hijack Execution Flow - Technique T1574

Theory

It is very often in Windows environments to discover services that run with SYSTEM privileges. If you have permissions over the service you can use it to escalate you privileges.

Practice

If we have enough permissions over a service, we can edit the binPath parameters and replace it with our own binary or command.

If you have SERVICE_CHANGE_CONFIG or SERVICE_ALL_ACCESS permissions, you can replace the binary.

AccessChk

We can use AccessChk from sysinternals tools to enumerate permissions over services.

#list all the services that a specific user can modify.
accesschk64.exe -uwcqv "pwned" * -accepteula
accesschk64.exe -uwcqv "Authenticated Users" * -accepteula
accesschk64.exe -uwcqv "BUILTIN\Users" * -accepteula
accesschk.exe -uwcqv %USERNAME% * -accepteula

#list permissions for "VulnSvc" service.
accesschk64.exe -uwcqv VulnSvc -accepteula

PowerUp

This cmdlet from PowerUp can also be used.

. .\PowerUp.ps1
Get-ModifiableService

winPEAS

Or, we may use the servicesinfo module of WinPeas.

winPEASx64.exe servicesinfo

Resources

Last updated