14 Haziran 2017 Çarşamba

NET DLL Injector

Hello folks.
Heres one way to inject a fully managed dll into a managed process without using another clr or unmanaged library inbetween.

his is not a fully working code, the winapi calls are missing (I pass delegates of these as constructor parameters)

Your C# Dll needs one nuget dependency:
https://www.nuget.org/packages/UnmanagedExports

Then somewhere create a static function
Code:
[DllExport("run", CallingConvention.Cdecl)]
public static void RunExport()
{  
    GetInstance().Run();
}

Source code for the injector is on pastebin
https://pastebin.com/mY3Did9u
https://pastebin.com/FHU9hLxS
https://pastebin.com/wDLU1sR7

Screenshot/PoC
https://image.prntscr.com/image/dcb186da0ad94c6da861ba5d095b96ae.png

Good luck!