.NET Injection Cecil
3 minute read Published:
Getting into .NET injection with Mono
This 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 (https://github.com/guitmz/msil-cecil-injection).
using System;
namespace Dummy
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("DUMMY APP HERE YO!");
Console.ReadLine();
}
}
}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.