PowerShellMafia / PowerSploit

PowerSploit - A PowerShell Post-Exploitation Framework
Other
11.77k stars 4.59k forks source link

Invoke-DllInjection Managed DLL #278

Open mr-burnse opened 6 years ago

mr-burnse commented 6 years ago

Any thoughts on how this might be adapted to also support injection of a managed DLL? In my case, I have a C# library which exports its functions using the library https://www.nuget.org/packages/UnmanagedExports. Since it's a managed DLL, there's no DllMain that executes when the dll is injected. I suspect the injector itself would need to contain some logic to explicitly execute the exported functions?

leechristensen commented 6 years ago

Managed DLLs having a different loading process that Invoke-RelectivePEInjection doesn't support. Potential alternative approaches include modifying PSInject to use your own assembly or using BlackBone to load a C++/CLI DLL.