EoP - AlwaysInstallElevated
Exploiting AlwaysInstallElevated Policy: A Guide
Key Concept: AlwaysInstallElevated Policy
The AlwaysInstallElevated policy allows standard users to install MSI packages with elevated privileges if both user and system registry keys are configured. This can be exploited to perform actions under elevated privileges, such as creating users or executing malicious payloads.
Step 1: Checking Registry Values
1.1 User Registry Key
Check if the user-level AlwaysInstallElevated setting is enabled:
Command Prompt/PowerShell:
Expected Output:
1.2 Machine Registry Key
Check if the machine-wide AlwaysInstallElevated setting is enabled:
PowerShell Alternative:
Note: Both keys must be set to 1
for exploitation.
Step 2: Creating the MSI Package
Using msfvenom
to Create a Malicious MSI
msfvenom
to Create a Malicious MSIGenerate an MSI package that adds a user with elevated privileges:
Command:
Suppressing UAC Prompts:
Custom Payloads
You can replace the payload with any desired functionality, such as reverse shells.
Step 3: Installing the MSI Package
Once the MSI package is created, install it quietly without user interaction:
Command:
Step 4: Automating with Metasploit or PowerUp
4.1 Metasploit
Metasploit provides an exploit module for this technique:
Command:
4.2 PowerUp Script
PowerUp, a PowerShell tool, can automate checking and exploiting this vulnerability.
Check AlwaysInstallElevated Settings:
Generate and Install MSI Package via PowerUp:
Security Implications
Impact of Exploitation
Privilege Escalation: Allows attackers to run arbitrary MSI packages with SYSTEM privileges.
Persistence: Attackers can create privileged accounts or install backdoors.
Mitigation Strategies
1. Disable AlwaysInstallElevated
Ensure both registry keys are set to 0
:
2. Least Privilege
Restrict user permissions to prevent unauthorized installation of software.
3. Audit and Monitor
Regularly audit registry settings and monitor MSI installation activity.
References
Metasploit Framework
PowerUp Tool on GitHub
This guide outlines steps to exploit and mitigate the AlwaysInstallElevated vulnerability. Always adhere to legal and ethical guidelines.
Last updated