Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: EnC Metadata stream loading precedence #352

Merged
merged 5 commits into from
Sep 8, 2022

Conversation

Washi1337
Copy link
Owner

@Washi1337 Washi1337 commented Sep 4, 2022

There is a slight difference in the loading process of metadata streams between normal and EnC metadata. EnC always selects the first heap with a provided name, while normal metadata prefers the last instead. While a normal .NET compiler only emits one stream per stream type, post-processed binaries (e.g., obfuscated binaries) may include duplicated streams to throw off disassemblers. Currently, the metadata loader always assumes the first stream to be the selected stream, meaning some binaries were not loaded properly by AsmResolver. This PR ensures that this difference is taken into account in Metadata.GetStream, Metadata.TryGetStream, and throughout the entirety of AsmResolver.DotNet, fixing this issue.

References:

@Washi1337 Washi1337 added bug enhancement pe Issues related to AsmResolver.PE dotnet Issues related to AsmResolver.DotNet labels Sep 4, 2022
@Washi1337 Washi1337 added this to the 5.0.0 milestone Sep 4, 2022
@Washi1337 Washi1337 merged commit c537bfb into development Sep 8, 2022
@Washi1337 Washi1337 deleted the feature/enc-metadata-loader branch September 8, 2022 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dotnet Issues related to AsmResolver.DotNet enhancement pe Issues related to AsmResolver.PE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant