Repository navigation
Conversation
DBs built with ASLR offsets (apiscout's Windows 10 1803 x64 DB) were mapped to the file ImageBase of each DLL, where most 64-bit system DLLs collide at 0x180000000. Apply the offset as ApiScout does; DBs without one load as before.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
WinApiResolvernow applies the per-DLLaslr_offsetof an ApiScout DB when it builds its address map, the same way ApiScout does (base_address + export_address - aslr_offset). Until now SMDA ignored the field and mapped every DLL to its file ImageBase.That was harmless for the bundled Win7 and XP DBs, where every offset is 0. It is not harmless for apiscout's new Windows 10 Pro 1803 x64 DB (
dbs/win10_prof_1803_example.json, apiscout668c981), which was built with the ASLR offsets of its boot. In that DB, 174 of the 64-bit system DLLs share the file ImageBase0x180000000, so their exports overwrote each other in the map, and none of them sat where the DLLs were actually loaded.A DB without the key is read with an offset of 0, so DBs built before the field existed load unchanged.
Separately, and not changed here: DLL names come out of the resolver with the DB key's base suffix (
kernel32.dll_0x180000000), because"_".join(dll_entry.split("_")[2:])keeps it. ApiScout has the same behaviour, and downstream reports may depend on it.How it was verified
New test
test_win_api_resolver_applies_aslr_offsets_of_the_database: two rebased DLLs sharing0x180000000plus one without an offset. It fails without the fix and passes with it.Compared the resolver's address map with ApiScout's own computation on apiscout's DBs (
668c981):win10_prof_1803_example.json: before, 5,706 of 86,703 addresses matched ApiScout's. After, all 97,516 match.win7_prof-n_sp1_example.json: 97,310 addresses, identical before and after (all offsets 0).Recovery, escaping and hashing are not touched. With no
API_COLLECTION_FILESconfigured (the default), or with DBs whose offsets are 0, nothing changes.make lintandmake formatmake test-allCHANGELOG.mdentry under## [Unreleased]Golden fixtures unchanged