Comment on page
Unquoted Service Paths
Sometimes it is possible to escalate privileges by abusing misconfigured services. Specifically, this is possible if path to the service binary is not wrapped in quotes and there are spaces in the path.. This stems from the way Windows handles
If you are using a long file name that contains a space, use quoted strings to indicate where the file name ends and the arguments begin; otherwise, the file name is ambiguous. For example, consider the string "c:\program files\sub dir\program name". This string can be interpreted in a number of ways. The system tries to interpret the possibilities in the following order:c:\program.exe c:\program files\sub.exe c:\program files\sub dir\program.exec:\program files\sub dir\program name.exe...
Let's scan the system
ws01for any potentially misconfigured services - those services that do not have their binary paths wrapped in quotes:
cmd /c wmic service get name,displayname,pathname,startmode |findstr /i "auto" |findstr /i /v "c:\windows\\" |findstr /i /v """
One service is returned:
The above suggests that if we can drop our binary to
c:\program.exe, we may be able to stop/start the
VulnerableSvcand get our binary at
c:\program.exeto run with NT\System privileges:
Let's try exploiting the weakness in by droping a meterpreter binary to c:\program.exe and starting the vulnerable service
VulnerableSvc. Doing so gives us a meterpreter session with