Exploiting AlwaysInstallElevated

Understanding AlwaysInstallElevated

What Is AlwaysInstallElevated?

AlwaysInstallElevated is like giving a valet key that automatically starts any car to anyone who wants to "install software." Normally, installing software requires administrative privileges and triggers UAC prompts. However, when AlwaysInstallElevated is enabled, any user can install MSI packages with SYSTEM privileges without any prompts.

This Windows Group Policy setting was designed for environments where standard users need to install approved software without administrator intervention. However, it creates a significant security risk because any MSI package will be installed with the highest system privileges.

How AlwaysInstallElevated Works

Normal MSI Installation Process:

  1. User attempts to install MSI package

  2. Windows checks user privileges

  3. If not administrator, UAC prompt appears

  4. User must provide admin credentials

  5. Installation proceeds with elevated privileges

With AlwaysInstallElevated Enabled:

  1. User attempts to install MSI package

  2. Windows automatically elevates to SYSTEM privileges

  3. No UAC prompt or credential check

  4. Installation proceeds with SYSTEM privileges immediately

circle-check

The Security Risk

When AlwaysInstallElevated is enabled, any user can:

  • Install malicious MSI packages with SYSTEM privileges

  • Bypass UAC completely for MSI installations

  • Gain immediate administrative access to the system

  • Execute any code during the installation process as SYSTEM

Registry Configuration

AlwaysInstallElevated requires specific registry settings to be enabled:

Required Registry Keys:

Why Both Keys Are Required:

  • HKLM key - Enables the policy machine-wide

  • HKCU key - Enables the policy for the current user

  • Both must be set to 1 for the policy to take effect

This dual-key requirement was designed as a security measure, but in practice, both keys are often set when the policy is enabled via Group Policy.

Real-World Scenarios

Where AlwaysInstallElevated Is Commonly Found:

  • Educational institutions - Allow students to install approved software

  • Corporate environments - Let employees install business applications

  • Kiosk systems - Enable automated software deployment

  • Development environments - Allow developers to install tools

Why It's Dangerous: Even in controlled environments, this setting can be abused because:

  • Any MSI file can be executed, not just approved ones

  • Users can create malicious MSI packages

  • Remote attackers can leverage this for privilege escalation

  • No validation of MSI package contents occurs


Detection and Enumeration

Manual Registry Checks

Basic Registry Enumeration

Check if AlwaysInstallElevated is enabled:

Understanding the output:

  • Value 0x1 (1) - AlwaysInstallElevated is enabled

  • Value 0x0 (0) - AlwaysInstallElevated is disabled

  • Key not found - Policy is not configured (disabled by default)

PowerShell registry check:

Group Policy Verification

Check Group Policy settings:

PowerShell Group Policy check:

Automated Detection Tools

PowerUp Detection

Using PowerUp framework:

WinPEAS Detection

Using WinPEAS for detection:

Metasploit Detection

Metasploit post-exploitation module:


Exploitation Techniques

Creating Malicious MSI Packages

Once AlwaysInstallElevated is confirmed, the next step is creating a malicious MSI package that will execute with SYSTEM privileges.

Method 1: Using MSFVenom

MSFVenom can generate malicious MSI packages directly:

Basic MSI payload generation:

Advanced MSI payload with evasion:

Method 2: PowerShell MSI Creation

Creating MSI with PowerShell:

Method 3: WiX Toolset MSI Creation

Using WiX Toolset for custom MSI:

Compile WiX MSI:

MSI Installation and Execution

Manual Installation

Install MSI package:

PowerShell MSI installation:

Remote MSI Installation

Install MSI from remote location:

PowerShell remote MSI:

Metasploit Integration

Metasploit AlwaysInstallElevated Module

Using Metasploit's built-in module:

Manual Metasploit MSI Deployment

Generate and deploy MSI via Meterpreter:

Advanced Exploitation Techniques

Persistence via MSI

Create MSI for persistence:

PowerShell persistence MSI:

Credential Harvesting MSI

MSI for credential collection:

Last updated

Was this helpful?