Hex-Virtualization icon indicating copy to clipboard operation
Hex-Virtualization copied to clipboard

:guardsman: .NET Virtualization made in C#

Hex Virtualization MIT license

Developed by Hexk

:guardsman: Why do you need Hex Virtualization ?

Hex-Virtualization was built so that people can learn from it, for real-world use, other obfuscation techniques such as anti-tampering, mutations, controlflow, and renamer would bring this vm to its full potential.

Eazfuscator describes perfectly what a vm does:
"Many of us consider particular pieces of code especially important. May it be a license code check algorithm implementation, an innovative optimization method, or anything else equally important so we would want to protect it by any means possible. As we know, the traditional obfuscation techniques basically do renaming of symbols and encryption, thus leaving the actual algorithms — cycles, conditional branches and arithmetics potentially naked to eye of the skilled intruder.

Here a radical approach may be useful: to remove all the .NET bytecode instructions from an assembly, and replace it with something completely different and unknown to an external observer, but functionally equivalent to the original algorithm during runtime — this is what the code virtualization actually is."


:star: How does it work ?

  • MSIL to VMIL
  • Methods are stored as resources
  • Bytes are encrypted with xor cipher

:fire: What does it do ?

  • [x] Virtualizes code into instructions which only Hex.VM can understand
  • [x] Has support for a decent amount of opcodes, as said, this is made for educational purposes and as such I believe these opcodes are enough for people to learn and build on
  • [x] Easy to use, understand, and build on

:bookmark_tabs: Examples

Before:

    public int Add()
    {
        return this._x + this._y;
    }

After:

    [Hex.VM.Runtime.Util.Id("CJdAcuNrqHcIpi4GQsLjMMbSrvQr4MIXohvn2c3m92mrahj6M", 5204)]
    public int Add()
    {
        return (int)Hex.VM.Runtime.VirtualMachine.RunVM(new object[]
        {
            this
        });
    }

Resources

https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-334.pdf

https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes?view=netframework-4.8

If you got any questions feel free to contact me via discord Hexk#0001