From e1dc3b06d076b8251dea0e0be547eb772b229e62 Mon Sep 17 00:00:00 2001 From: Melissa Eckardt Date: Thu, 5 Mar 2026 18:29:30 +0100 Subject: [PATCH 1/2] Fix --no-cflow-deob regression introduced in 5c58a06 --- de4dot.code/ObfuscatedFile.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/de4dot.code/ObfuscatedFile.cs b/de4dot.code/ObfuscatedFile.cs index 62f247c7..7ae348da 100644 --- a/de4dot.code/ObfuscatedFile.cs +++ b/de4dot.code/ObfuscatedFile.cs @@ -557,8 +557,10 @@ static void SplitMethodDesc(string methodDesc, out string type, out string name, } public void DeobfuscateEnd() { - foreach (var m in inlineCandidate) { - m.Value.DeclaringType?.Remove(m.Value); + if (options.ControlFlowDeobfuscation) { + foreach (var m in inlineCandidate) { + m.Value.DeclaringType?.Remove(m.Value); + } } DeobfuscateCleanUp(); From 37c7a1dfb6dc31d2bfce9ecc3b307a8fb2b90412 Mon Sep 17 00:00:00 2001 From: Melissa Eckardt Date: Thu, 5 Mar 2026 18:59:27 +0100 Subject: [PATCH 2/2] Fix critical bug in generic proxy inlining The opcode was not copied, causing invalid IL. --- de4dot.code/ObfuscatedFile.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/de4dot.code/ObfuscatedFile.cs b/de4dot.code/ObfuscatedFile.cs index 7ae348da..230251d7 100644 --- a/de4dot.code/ObfuscatedFile.cs +++ b/de4dot.code/ObfuscatedFile.cs @@ -645,13 +645,14 @@ void Deobfuscate(MethodDef method, BlocksCflowDeobfuscator cflowDeobfuscator, Me return; var rewritten = false; - for (var i = 0; i < method.Body.Instructions.Count; i++) { - var instr = method.Body.Instructions[i]; + foreach (var instr in method.Body.Instructions) { if (instr.OpCode == OpCodes.Call) { var targetMethod = (IMethod?)instr.Operand; if (targetMethod is null) continue; if (inlineCandidate.TryGetValue(targetMethod.ResolveMethodDef()?.FullName ?? targetMethod.FullName, out var methodToInline)) { - instr.Operand = methodToInline.Body.Instructions[methodToInline.Parameters.Count].Operand; + var realCall = methodToInline.Body.Instructions[methodToInline.Parameters.Count]; + instr.OpCode = realCall.OpCode; + instr.Operand = realCall.Operand; rewritten = true; } }