feat: Refactored code for Ryujin console arguments, fixed typos, and resolved instruction-padding logic issues. Fixed temporary variable bug in MBA equivalence generation and more
- Fixed bugs reported by third parties (instruction-override issues, padding-space logic, and more) - Corrected typos (translated comments/examples to English) - Fully refactored the Ryujin console (arguments now handled via the argparser library) - MBA pass: fixed equivalence-logic issues when generating MBA instructions for original operations - Updated DemoObfuscation usage examples
This commit is contained in:
@@ -38,6 +38,7 @@ public:
|
||||
bool m_isAntiDump; // Enable Anti Dump technic for Ryujin protected binary
|
||||
bool m_isMemoryProtection; // Memory CRC32 protection
|
||||
bool m_isHVPass; // Run some features of ryujin using Microsoft Hypervisor Framework API
|
||||
bool m_isMutateMiniVM; // Perform the mutation and add full junk code to the Ryujin MiniVM stub, regardless of whether it<69>s the normal version or the HV pass.
|
||||
RyujinObfuscatorProcs m_strProceduresToObfuscate; // Names of the procedures to obfuscate
|
||||
RyujinCallbacks m_callbacks; // Ryujin Custom Pass Callbacks
|
||||
|
||||
|
||||
@@ -2280,25 +2280,29 @@ bool Ryujin::run(const RyujinObfuscatorConfig& config, const std::shared_ptr<Ryu
|
||||
|
||||
}
|
||||
|
||||
// Obfuscating MiniVMMStub/MiniVM normal to difficult RE
|
||||
RyujinProcedure proc;
|
||||
proc.name = "MiniVMStub";
|
||||
proc.address = 0x00;
|
||||
proc.size = miniVmEnter.size();
|
||||
// Create MiniVM basic blocks
|
||||
RyujinBasicBlockerBuilder MiniVMbb(ZYDIS_MACHINE_MODE_LONG_64, ZydisStackWidth_::ZYDIS_STACK_WIDTH_64);
|
||||
proc.basic_blocks = MiniVMbb.createBasicBlocks(miniVmEnter.data(), proc.size, proc.address);
|
||||
// Configure the MiniVM to obfuscate
|
||||
RyujinObfuscatorConfig minivmmCfg{ 0 };
|
||||
minivmmCfg.m_isJunkCode = true;
|
||||
// Setup Obfuscation Core & Run Pass
|
||||
RyujinObfuscationCore obfc(minivmmCfg, proc, 0x00);
|
||||
// Running ryujinminivmobfuscation to protect RyujinMiniVm
|
||||
auto procProcessed = obfc.RunMiniVmObfuscation();
|
||||
// Assign MiniVm obfuscated into MiniVmEnter
|
||||
miniVmEnter.assign(procProcessed.begin(), procProcessed.end());
|
||||
// Deleting ryujin obfuscation core instance
|
||||
obfc.~RyujinObfuscationCore();
|
||||
if (config.m_isMutateMiniVM) {
|
||||
|
||||
// Obfuscating MiniVMMStub/MiniVM normal to difficult RE
|
||||
RyujinProcedure proc;
|
||||
proc.name = "MiniVMStub";
|
||||
proc.address = 0x00;
|
||||
proc.size = miniVmEnter.size();
|
||||
// Create MiniVM basic blocks
|
||||
RyujinBasicBlockerBuilder MiniVMbb(ZYDIS_MACHINE_MODE_LONG_64, ZydisStackWidth_::ZYDIS_STACK_WIDTH_64);
|
||||
proc.basic_blocks = MiniVMbb.createBasicBlocks(miniVmEnter.data(), proc.size, proc.address);
|
||||
// Configure the MiniVM to obfuscate
|
||||
RyujinObfuscatorConfig minivmmCfg{ 0 };
|
||||
minivmmCfg.m_isJunkCode = true;
|
||||
// Setup Obfuscation Core & Run Pass
|
||||
RyujinObfuscationCore obfc(minivmmCfg, proc, 0x00);
|
||||
// Running ryujinminivmobfuscation to protect RyujinMiniVm
|
||||
auto procProcessed = obfc.RunMiniVmObfuscation();
|
||||
// Assign MiniVm obfuscated into MiniVmEnter
|
||||
miniVmEnter.assign(procProcessed.begin(), procProcessed.end());
|
||||
// Deleting ryujin obfuscation core instance
|
||||
obfc.~RyujinObfuscationCore();
|
||||
|
||||
}
|
||||
|
||||
// Inserting the Ryujin MiniVm stub at the beginning of Ryujin section
|
||||
opcodesWithRelocsFixed.insert(opcodesWithRelocsFixed.end(), miniVmEnter.begin(), miniVmEnter.end());
|
||||
|
||||
@@ -2505,7 +2505,7 @@ BOOL RyujinObfuscationCore::Run(bool& RyujinRunOncePass) {
|
||||
//Update basic blocks view based on the new obfuscated
|
||||
this->updateBasicBlocksContext();
|
||||
|
||||
if (m_config.m_isAntiDebug) {
|
||||
if (m_config.m_isAntiDebug && !m_config.m_isJunkCode) {
|
||||
|
||||
/*
|
||||
There is no need to obfuscate the anti-debug stub code. the junk code/mutation itself will handle that during processing.
|
||||
|
||||
Reference in New Issue
Block a user