Chapter 3 : Basic Dynamic Analysis

Sandbox Drawbacks

Analyzing the DLLs

How to launch DLLs exported functions in Windows

C:\\\\rundll32.exe DLLname, Export arguments.

Changing DLL file to EXE file

DllMain entry point (Process.h) - Win32 apps

BOOL WINAPI DllMain(
    HINSTANCE hinstDLL,  // handle to DLL module
    DWORD fdwReason,     // reason for calling function
    LPVOID lpReserved )  // reserved
{
    // Perform actions based on the reason for calling.
    switch( fdwReason ) 
    { 
        case DLL_PROCESS_ATTACH:
         // Initialize once for each new process.
         // Return FALSE to fail DLL load.
            break;

        case DLL_THREAD_ATTACH:
         // Do thread-specific initialization.
            break;

        case DLL_THREAD_DETACH:
         // Do thread-specific cleanup.
            break;

        case DLL_PROCESS_DETACH:
         // Perform any necessary cleanup.
            break;
    }
    return TRUE;  // Successful DLL_PROCESS_ATTACH.
}

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/eef700e6-6e62-4384-b826-a978ff1f306b/Untitled.png

Install ServiceMain manually