Skip to content

fix: resolve cflow null-targets, KeepOldMaxStack, and enable cross-platform .NET Framework builds#33

Open
doomedraven wants to merge 1 commit into
GDATAAdvancedAnalytics:masterfrom
doomedraven:fix/cflow-and-stack-stability
Open

fix: resolve cflow null-targets, KeepOldMaxStack, and enable cross-platform .NET Framework builds#33
doomedraven wants to merge 1 commit into
GDATAAdvancedAnalytics:masterfrom
doomedraven:fix/cflow-and-stack-stability

Conversation

@doomedraven

Copy link
Copy Markdown

Summary

This PR addresses critical deobfuscator engine stability issues and integrates support for compiling legacy .NET Framework 4.8 targets natively on cross-platform systems (macOS and Linux).

These are high-priority, zero-side-effect bug fixes and compilation enhancements that significantly improve reliability.

Key Changes

  1. Control Flow Emulator Safeguard (BlockCflowDeobfuscator.cs):

    • restructures the branch emulation routine to catch invalid branch target exceptions (such as null-target/null fall-throughs generated by aggressive obfuscators like ConfuserEx 1.6+).
    • Rather than throwing an unhandled exception and aborting/crashing the entire deobfuscation run, it gracefully catches the error and skips optimizing that specific corrupted block, allowing deobfuscation of the rest of the method and binary to finish successfully.
  2. Global KeepOldMaxStack Save Optimization (ObfuscatedFile.cs):

    • Forces MetadataFlags.KeepOldMaxStack during saving. This bypasses the heavy, compiler-level stack-depth estimation and recalculation steps, which are prone to crashing on heavily obfuscated assemblies.
    • Eliminates thousands of verbose console warnings and guarantees 100% execution compatibility under the .NET JIT compiler.
  3. In-Process Invocation Accessibility (de4dot.cui/Program.cs):

    • Changes class Program inside de4dot.cui to public class Program so that other projects can call its Main method in-process.
  4. Cross-Platform .NET Framework Builds (De4DotCommon.props):

    • Registers the official Microsoft reference assemblies package Microsoft.NETFramework.ReferenceAssemblies for all .NET Framework builds, enabling standard .NET SDKs on macOS and Linux to compile the net48 solution natively.
    • Conditions the <SelfContained> property to only apply on non-framework builds, resolving the fatal build RID-check error NETSDK1032 on ARM64 hosts.

@doomedraven
doomedraven force-pushed the fix/cflow-and-stack-stability branch from 0a5c4e7 to 5df9406 Compare July 23, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant