本帖最后由 BlackHatRCE 于 2022-11-2 23:14 编辑
.NET Reactor is a product of Eziriz - https://www.eziriz.com/reactor_features.htm This software is protected with .NET Reactor 6.x with VM .
I unpacked the Software from all kind of protection setting of .NET Reactor and removed the VM as well. DNR VM is pretty much 1:1 but this software is very complex written so It took a long time to clean the file.
.NET Reactor Unpacking -
1. You can use .NET Reactor Slayer - https://github.com/SychicBoy/NetReactorSlayer
2. Code Virtualization is a relatively new feature of .NET Reactor.
Here is a detailed VM Unpacking over a Sample Unpackme File --> Credits - TobitoFatito -
Analyze to detect the Virtualize Method :
Start Renaming, Renaming is a really important aspect of this. Following the VM Method call we end up on a big method, where fun begins :
We see that this method is only called once, which seems like a good place to start :
Following that method we reach here, where a binary reader is used to read a resource stream :
After making a Good Devirtualization base, this seems to be the First Stage. (In my case i searched for resources with name length of 37 you might wanna do it differently.)
Second stage I'd say is method locating, You simply wanna search for virtualized methods and get their ID and MethodDef. Back to the main method, the first for loop seems to be for method locals, the third seems to be for exception handlers, and the fourth seems to be for VM instruction deserializing :
Scrolling a bit more we finally reach the method that executes the instructions :
ExecuteInstruction method is really important, and its gonna be used for pattern matching stage.
I Simply searched for a method with 3200+ instructions and a switch opcode. You might wanna do it differently :
This is how i pattern matched the opcodes :
And here is an example :
After we finish pattern matching the opcodes, its time for VM Method Dissasembling stage.
I found that a good way to start is to loop the Decrypt2 variable that was initialized earlier. You will need to figure this out, method locals, exception handlers and vm instructions etc. :
After method disassembling stage, its time for vm method recompiling/rebuilding. We convert the .net reactor vm instructions to CIL.
I just looped through every vm method instruction and used a switch . :D Here is an example :
Final Stage is method replacing, where we replace the body of every virtualized method with the translated body :)
That's How you can add a save method :
[C#] 纯文本查看 复制代码 Ctx . Module . Write ( Ctx . Options . OutPath , new ManagedPEImageBuilder ( new DotNetDirectoryFactory ( MetadataBuilderFlags . PreserveAll ))); Ctx . Options . Logger . Success ( $ "Wrote File At {Ctx.Options. OutPath}" );
|