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.How It Works
SharpUp checks two specific registry locations:1 for the vulnerability to be exploitable.
Technical Details
The check performs the following operations:- Queries
HKLMfor the AlwaysInstallElevated value - Queries
HKCUfor the AlwaysInstallElevated value - Reports if either or both values are set to
1 - If both are
1, the system is vulnerable
Example Output
- 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
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):
- Open Group Policy Management Console
- Navigate to: Computer Configuration → Administrative Templates → Windows Components → Windows Installer
- Set “Always install with elevated privileges” to Disabled
- Run
gpupdate /forceon affected systems
4
Verify Fix
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
- Registry Monitoring
- MSI Installation Monitoring
- Process Monitoring
- File System Monitoring
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
Scenario 1: Legacy Software Deployment
Scenario 1: Legacy Software Deployment
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
Scenario 2: Developer Workstations
Scenario 2: Developer Workstations
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
Scenario 3: Penetration Testing
Scenario 3: Penetration Testing
Context: During a penetration test, standard user access is obtained.Attack Path:
- Run SharpUp to identify AlwaysInstallElevated
- Generate malicious MSI with reverse shell
- Install MSI to get SYSTEM shell
- Complete objectives with elevated access
Proof of Concept
Simple Privilege Escalation PoC
Related Checks
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