Skip to content

feature: randomize compressor feedback + library-seed constants (#69) - #100

Open
mcpolo99 wants to merge 2 commits into
developfrom
feature/compressor-constant-randomization
Open

feature: randomize compressor feedback + library-seed constants (#69)#100
mcpolo99 wants to merge 2 commits into
developfrom
feature/compressor-constant-randomization

Conversation

@mcpolo99

@mcpolo99 mcpolo99 commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Level 2 constant randomization — Compressor (#69)

Removes two fixed magic constants from the compressor packer that de4dot/AV pattern-match to fingerprint packed output. Each becomes a per-pack random value, kept in sync between the obfuscator's encryption side and the injected runtime's decryption side.

Constant Role Obfuscator ↔ Runtime Constraint
Feedback 0x3ddb2819 additive feedback in the block cipher loop CompressorContext.EncryptDecrypt IL any value
LCG 0x6fff61 / 0x5e3f1f rolling hash deriving each library's seed from its name PackModulesResolve IL init: any; multiplier: odd

How sync is preserved

  • Feedback: generated once per pack, used in Encrypt for the main module and every embedded library, and rewritten into the runtime Decrypt method's ldc.i4 literal.
  • LCG: random init + random odd multiplier, used in PackModules to derive per-library seeds, and rewritten into the runtime Resolve method's literals.

Both runtime variants (Compressor and CompressorCompat) are handled — the rewrite operates on whichever type was injected.

Validation

CompressorWithResx.Test12/12 pass (compat true/false × deriver normal/dynamic × resource modes). The test app loads a de satellite assembly at runtime, which is embedded, resolved, and decrypted through the exact ResolveDecrypt path these constants drive (asserts both "Test (fallback)" and "Test (deutsch)"). A broken constant-sync fails the run immediately.

Scoped out (follow-up)

  • Prime moduli 0x143fc089 / 0x444d56fb / 0x8a5cb7 — need a curated valid-prime set (grouped with the xorshift/rotation curated sets in the other protections).

Part of #69.

RandomCrocodile added 2 commits July 4, 2026 20:39
The compressor packer baked the fixed feedback 0x3ddb2819 into both the
encryption loop (CompressorContext.Encrypt) and the injected runtime
Decrypt method, giving de4dot a stable signature for packed output.

Generate a random feedback per pack, use it in Encrypt for both the main
module and every embedded library, and rewrite the literal in the runtime
Decrypt IL so encrypt/decrypt stay in sync. Validated end-to-end by
CompressorWithResx.Test (12 cases: compat x deriver x resource modes,
covering both Compressor and CompressorCompat runtimes).
The rolling hash that derives each embedded library's decryption seed
from its name used fixed constants 0x6fff61 (init) and 0x5e3f1f
(multiplier) in both PackModules and the injected runtime Resolve method
— another de4dot signature.

Generate a random init and a random odd multiplier per pack, use them in
PackModules, and rewrite the literals in the runtime Resolve IL so the
seed derivation stays in sync. Validated by CompressorWithResx.Test,
whose 'de' satellite assembly is resolved+decrypted through this exact
path at runtime (asserts 'Test (deutsch)' across all 12 cases).
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