# 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.&#x20;

For more info:

{% embed url="<https://medium.com/@SumitVerma101/windows-privilege-escalation-part-1-unquoted-service-path-c7a011a8d8ae>" %}

We can query for it with:&#x20;

```
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:&#x20;

```
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
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kwcsec.gitbook.io/the-red-team-handbook/techniques/privilege-escalation/insecure-permissions/unquoted-service-paths.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
