dnSpyEx/dnSpy

Inject managed DLL

Symbai opened this issue · 3 comments

Problem Description

I need to inject a managed DLL into a managed (.NET core) process and execute the entry method. Maybe dnSpyEx already supports this? I couldn't find it

Proposal

When debugging a target allow us to select a managed DLL to inject and perhaps select a method to execute

Alternatives

I couldn't find any simple injector that works with .NET (core) targets
Target has detection for DOTNET_STARTUP_HOOKS so I cannot use this either.

Additional Context

No response

Maybe you should try to write a loader that will run the target program and your DLL using Assembly.Load?

Thank you for your valuable(?) response. I still think this would be a useful feature for dnSpyEx/a debugger.

Hello. Shameless plug here...
Could you please try to do something we did in our publication regarding .NET Hooking: https://research.checkpoint.com/2024/net-hooking-harmonizing-managed-territory/

Check the last section "Harmony Hooking from the DnSpyEx Debugging Context" - where we used the "Watch" window to load our managed hooking dll and invoke some functions etc.
Hopefully, it could be useful in your case too.