Unquoted Service Paths

If a binary path of a service has a whitespace, no quotes, and the right ACLs, we may be able to escalate our privileges.

For more info:

We can query for it with:

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

If it the binary path has a whitespace and no quotes, we will investigate the folder that holds the name that has the whitespace. For example if it was C:\Program Files\software\soft one , We would check the ACLs for c:\ and C:\Program Files\software\. If we have write permissions to the file, we can elevate our privileges by hijacking the executable in the folder. For example, we would try to move an executable called "soft" to C:\Program Files\software\ so the service would run our executable with elevated privileges.

To check if we have access:

icacls c:\folder

If your group(which is probably Users) have W privileges to the folder, it means it is vulnerable and you can move your executable to the folder. You can do this with this command:

 copy soft.exe C:\Program Files\software\soft.exe

Last updated