10 - Always Install Elevated
Topics
Introduction to the Windows Shells
Windows Permissions
Reverse Shells in Windows
SeImpersonatePrivilege Exploitation
On Cross Compilation
Windows Services
Weak Service Permissions
Unquoted Service Path
DLL Hijacking
Always Install Elevated
Files with Sensitive Data
Windows Hashes
Stored Credentials and the Windows Vault
Scheduled Task
Critical Registry Paths
Useful Tools
AMSI Bypass
Always Install with Elevated Privileges
The "Always Install with Elevated Privileges" policy in Windows allows users to install software with elevated permissions, even if they are not administrators. This setting applies to both Computer Configuration and User Configuration policies.
Security Risks
Malicious actors can exploit this setting to execute arbitrary code during software installation.
If enabled, it creates a significant security vulnerability, potentially leading to privilege escalation.
Configuration Check
Using Group Policy Editor
You can check this setting in the Group Policy Editor (gpedit.msc
):
Navigate to:
Computer Configuration → Administrative Templates → Windows Components → Windows Installer → "Always install with elevated privileges."
User Configuration → Administrative Templates → Windows Components → Windows Installer → "Always install with elevated privileges."
Ensure the policy is disabled to prevent misuse.
Using PowerShell
To verify the configuration via PowerShell:
If both values are set to 1
, the policy is active.
Set the Policy
To enable or disable the policy via PowerShell:
3. Exploitation
If this policy is enabled, attackers can generate and install a malicious Microsoft Software Installer (.msi
) package to gain elevated privileges.
Generate Malicious MSI with msfvenom
Install the Malicious Package
This executes the payload embedded in the MSI file with elevated privileges.
Creating a Custom MSI
Instead of using msfvenom
, you can create a custom MSI with the WiX Toolset to execute specific commands or scripts during installation.
Steps to Create a Custom MSI
Download WiX Toolset
Download WiX v3.14.1 from WiX Releases.
Install and Update PATH Add WiX binaries to your system path:
Create the WiX Project File Example
sample.wxs
file:Compile the WiX Project Convert the
.wxs
file into a.wixobj
and then into an MSI file:Execute the Custom MSI
Recommendations
Disable the Policy: Ensure the
Always Install with Elevated Privileges
policy is disabled in both HKLM and HKCU.Audit Installer Files: Regularly review MSI packages for malicious content.
Restrict Permissions: Limit access to installer execution to trusted users only.
Other Resources
Disclaimer
❗ Never use tools and techniques on real IP addresses, hosts or networks without proper authorization!❗
Last updated