Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[-]
Tags
with injection mono cecil

Injection with Mono.Cecil
#1
4
Better response on post Injection with Mono.CecilThis may not be news for everyone but I find it interesting. Mono.Cecil is a impressive work and can provide a lot of cool features such as runtime .NET assembly manipulation. We can inject opcodes (IL instructions) into a target assembly, transforming it as we wish. Here’s the test scenario:

A dummy C# application like the one below, compile it to get it’s executable file, that’s what we need:

Register or login to see this content

We also have this other application which will be our injector. You’ll need to download the Mono.Cecil DLL file and add it as reference in the injector project:

Register or login to see this content

Ok, that’s a nice start, we can print a message and execute a file from an injected assembly! Here’s the IL code from before and after the injection.

Before
Register or login to see this content

After

Register or login to see this content

If you now execute the newly generated “12345.exe” file, you will get something like the image below:

Register or login to see this content

That’s pretty much the basics, we can easily add a method to execute any application we want inside another .NET assembly. You could also import the a WebClient and create a downloader, a file dropper or whatever.

Full source
Register or login to see this content
"There is no spoon."
Reply
#2
1
Nice contribution bro!! Tnaks!
--
Less ego, more code..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)