Now notice the three highlighted keys above and their values.
EnableLUA tells us whether UAC is enabled. If 0 we don’t need to bypass it at all can just PsExec to SYSTEM. If it’s 1 however, then check the other 2 keys
PromptOnSecureDesktop is binary, either 0 or 1.
Now I’ll use an exploit to bypass UAC but note that it works only when the slider is set to default value or lower (in which case we don’t need to bypass it). At ‘Always notify’, in which case ConsentPromptBehaviorAdmin = 2 and PromptOnSecureDesktop = 1, not even this works. Take note of these limitations.
In Metasploit the exploit is
Name: Windows Escalate UAC Protection Bypass (Via Eventvwr Registry Key)
Module: exploit/windows/local/bypassuac_eventvwr
Platform: Windows
Arch:
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2016-08-15
Provided by:
Matt Nelson
Matt Graeber
OJ Reeves
Available targets:
Id Name
-- ----
0 Windows x86
1 Windows x64
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Payload information:
Description:
This module will bypass Windows UAC by hijacking a special key in
the Registry under the current user hive, and inserting a custom
command that will get invoked when the Windows Event Viewer is
launched. It will spawn a second shell that has the UAC flag turned
off. This module modifies a registry key, but cleans up the key once
the payload has been invoked. The module does not require the
architecture of the payload to match the OS. If specifying
EXE::Custom your DLL should call ExitProcess() after starting your
payload in a separate process.
ConsentPromptBehaviorAdmin can theoretically take on (readable explanation ), but from configuring the UAC slider in Windows settings it takes on either 0, 2 or 5.