Skip to main content

Service Binary Hijacking

Hijacking the service binarys of the windows machines to escalate our privileges.


How to get the service binaries

Get-CimInstance -ClassName win32_service | Select Name,State,PathName | Where-Object {$_.State -like 'Running'}

Check Permissions on the suspected Binary

icacls "C:\program\location\in\machine\program.exe"

Look for the permissions as given in the table below

MaskPermissions
RRead-only access
WWrite-only access
RXRead and execute access
FFull access
MModify access

If user has permission BUILTIN\Users:(F) then this program.exe can be levereged into replacing with a malicious binary to add/remove user , to change password etc...


Checking further

Having BUILTIN\Users:(F) will not be enough to exploit a binary , You have to find out how to trigger this binary which is to check if you have permission to restart the binary or if triggred automatically do you have permission to restart the system.

you can use this command to check how the binary is started : Get-CimInstance -ClassName win32*service | Select Name, StartMode | Where-Object {$*.Name -like 'BinaryName'}