Skip to content

Fix (Babel_NET): fix Decrypter4 AES key initialization and update MethodsDecrypter heuristics - #48

Merged
meck-gd merged 3 commits into
GDATAAdvancedAnalytics:masterfrom
Deltafox79:master
Oct 13, 2026
Merged

meck-gd merged 3 commits into
GDATAAdvancedAnalytics:masterfrom
Deltafox79:master

Conversation

@Deltafox79

Copy link
Copy Markdown

Summary of Changes

This pull request addresses two issues in the Babel .NET deobfuscator module:

  1. Fix AES key buffer initialization in Decrypter4 (ResourceDecrypter.cs):

    • Corrected the key array initialization logic before reading or copying bytes based on pubKeyOffset.
    • Prevents an ArgumentException (Specified key is not a valid size for this algorithm) when processing encrypted resources where the AES key is derived from the assembly strong-name public key or stream boundary.
  2. Relax decrypter type heuristic in MethodsDecrypter.cs:

    • Removed the mandatory System.Collections.Hashtable requirement from requiredFields.
    • Allows proper detection of Babel helper classes in assemblies where caching structures are relocated to nested or internal helper types.

Affected Components

  • de4dot.code/deobfuscators/Babel_NET/ResourceDecrypter.cs
  • de4dot.code/deobfuscators/Babel_NET/MethodsDecrypter.cs

Testing

  • Verified successful deobfuscation without ArgumentException or EndOfStreamException on Babel .NET protected targets.

Initialize and populate the key array prior to handling public key offsets in Decrypter4. This prevents passing an invalid key length to the AES transform when processing resources that derive keys from the assembly public key or end-of-stream header boundaries.
Remove the mandatory 'System.Collections.Hashtable' field requirement from the decrypter detection heuristic. This allows Babel helper types to be detected when caching tables are relocated into nested or internal classes.

@meck-gd meck-gd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the PR. Your commits introduce a bunch of surplus whitespaces. Please remove them and amend the commits.

Comment thread de4dot.code/deobfuscators/Babel_NET/ResourceDecrypter.cs Outdated
@meck-gd
meck-gd merged commit bb9d989 into GDATAAdvancedAnalytics:master Oct 13, 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.

2 participants