Skip to content

feature: randomize anti-tamper feedback + CFG multiplier constants (#69 level 2) - #98

Merged
mcpolo99 merged 2 commits into
developfrom
69-level2-constant-randomization
Jul 4, 2026
Merged

feature: randomize anti-tamper feedback + CFG multiplier constants (#69 level 2)#98
mcpolo99 merged 2 commits into
developfrom
69-level2-constant-randomization

Conversation

@mcpolo99

@mcpolo99 mcpolo99 commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Level 2 constant randomization (#69)

Removes fixed magic constants that de4dot and AV engines pattern-match to fingerprint ConfuserEx output. Each is replaced with a per-run random value, kept in sync between the obfuscator's encryption side and the injected runtime's decryption side via the existing mutation/injection mechanism.

Included in this PR

Constant Files Constraint Validation
Anti-tamper feedback 0x3dbb2819 AntiTamper/NormalMode.cs, AntiMode.csRuntime/AntiTamper.Normal.cs, AntiTamper.Anti.cs any value (additive) AntiTamper.Test (normal + anti modes)
CFG state multiplier 0x21412321 Constants/ReferenceReplacer.csRuntime/Constant.cs (CFGCtx) odd (invertible mod 2^32) 270_EnumArrayConstantProtection.Test, 193_ConstantsInlining.Test

Both changes round-trip through obfuscate → run → assert output, so a broken constant sync fails the test immediately.

How sync is preserved

  • Anti-tamper: the mode generates feedback = random.NextUInt32(), uses it in the encrypt loop, and injects the same value into the runtime placeholder via MutationHelper.InjectKeys (slot 5).
  • CFG multiplier: on runtime CFGCtx injection, a random odd multiplier is generated, the 0x21412321 literal is rewritten in the injected ctor IL, and the same value is threaded through the obfuscator-side CFGState constructor.

Intentionally scoped out (follow-up)

  • JIT anti-tamper mode (its runtime test is skipped/broken — can't validate).
  • Compressor feedback 0x3ddb2819, LCG constants, prime moduli, xorshift/rotation triples — require signature changes and/or curated valid-value sets; tracked in .temp/issue-69-analysis.md.

Part of #69.

RandomCrocodile added 2 commits July 4, 2026 17:11
Phase 2 of #69 (Level 2 identity). The anti-tamper method-body cipher used a
hardcoded feedback constant 0x3dbb2819 in both the obfuscator (encrypt) and the
injected runtime (decrypt) — a value de4dot signature-matches to identify
ConfuserEx.

Normal and Anti modes now generate a random per-run feedback value, use it in the
encryption loop, and inject it into the runtime via a new Mutation key (KeyI5),
exactly like the existing z/x/c/v hash constants (KeyI1-4). Obfuscator and runtime
stay in sync automatically because the same generated value is both used and
injected.

JIT mode is intentionally left unchanged — its runtime component is already broken
and its test is skipped, so a crypto change there cannot be validated.

Validated by AntiTamper.Test: the obfuscated app decrypts its own method bodies at
runtime and produces correct output (exit 42) for both Normal and Anti modes.
The Constants protection's control-flow encoding baked the fixed
multiplier 0x21412321 into both the obfuscator-side CFGState and the
injected runtime CFGCtx constructor, giving de4dot a stable signature.

Generate a random odd (invertible mod 2^32) multiplier per module when
the CFG state type is injected, rewrite the literal in the runtime ctor
IL, and thread the same value through the obfuscator CFGState so both
sides stay in sync. Validated end-to-end by the constants protection
tests (obfuscate -> run -> assert output).
@mcpolo99 mcpolo99 changed the title feature: randomize anti-tamper feedback constant (#69 phase 2a) feature: randomize anti-tamper feedback + CFG multiplier constants (#69 level 2) Jul 4, 2026
@mcpolo99
mcpolo99 merged commit b2a44ff into develop Jul 4, 2026
3 checks passed
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