Skip to main content

Overview

The AlwaysInstallElevated check identifies a Windows Group Policy misconfiguration that allows standard users to install MSI packages with SYSTEM-level privileges. This setting, when enabled in both HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER, allows any user to execute arbitrary code with elevated privileges by creating a malicious MSI installer.
This is a critical privilege escalation vulnerability when both registry keys are set to 1.

How It Works

SharpUp checks two specific registry locations:
Vulnerability Condition: Both values must be set to 1 for the vulnerability to be exploitable.

Technical Details

The check performs the following operations:
  1. Queries HKLM for the AlwaysInstallElevated value
  2. Queries HKCU for the AlwaysInstallElevated value
  3. Reports if either or both values are set to 1
  4. If both are 1, the system is vulnerable

Example Output

Interpretation:
  • Both registry keys are set to 1
  • Any user can install MSI packages with SYSTEM privileges
  • Immediate privilege escalation opportunity

Exploitation

Method 1: MSI Package with Metasploit

The MSI will execute with SYSTEM privileges regardless of the user’s privileges.

Method 2: MSI Package with Custom Payload

Method 3: PowerShell MSI Creation

Method 4: Using PowerUp (PowerShell)

Remediation

1

Check Current Setting

2

Disable via Registry

3

Disable via Group Policy

If configured via GPO (recommended for domains):
  1. Open Group Policy Management Console
  2. Navigate to: Computer Configuration → Administrative Templates → Windows Components → Windows Installer
  3. Set “Always install with elevated privileges” to Disabled
  4. Run gpupdate /force on affected systems
4

Verify Fix

Should return no vulnerabilities.

Impact of Remediation

After disabling this setting:
  • Standard users will need administrator privileges to install MSI packages requiring elevation
  • Software deployment may require administrator intervention
  • Use proper software deployment methods (SCCM, Intune, GPO) for enterprise environments

Detection

Defensive Monitoring

Monitor for suspicious MSI installations:

Detection Strategies

Monitor changes to AlwaysInstallElevated registry keys:
  • Alert on any value set to 1
  • Monitor both HKLM and HKCU hives
  • Track who made the change

Real-World Scenarios

Context: Organization enabled AlwaysInstallElevated to allow users to install approved software packages.Risk: Any user can now install any MSI, including malicious ones.Solution:
  • Use SCCM, Intune, or other deployment tools
  • Implement AppLocker to whitelist approved MSI packages
  • Disable AlwaysInstallElevated immediately
Context: Developers need to install various tools and packages frequently.Risk: Developers can accidentally or intentionally escalate privileges.Solution:
  • Provide developers with separate admin accounts
  • Use privilege escalation tools like gsudo or RunAs
  • Don’t enable AlwaysInstallElevated even for developers
Context: During a penetration test, standard user access is obtained.Attack Path:
  1. Run SharpUp to identify AlwaysInstallElevated
  2. Generate malicious MSI with reverse shell
  3. Install MSI to get SYSTEM shell
  4. Complete objectives with elevated access

Proof of Concept

Simple Privilege Escalation PoC

Registry Autoruns

Check for modifiable autorun registry entries

Modifiable Services

Identify services with weak permissions

Token Privileges

Enumerate dangerous token privileges

Remediation Guide

Comprehensive remediation guidance

References

Microsoft Docs

Official documentation for AlwaysInstallElevated

MITRE ATT&CK

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control