Skip to content

fix(labels): apply the aslr_offset of ApiScout DBs in WinApiResolver - #434

Open
r0ny123 wants to merge 1 commit into
danielplohmann:masterfrom
r0ny123:fix/apiscout-aslr-offset
Open

r0ny123 wants to merge 1 commit into
danielplohmann:masterfrom
r0ny123:fix/apiscout-aslr-offset

Conversation

@r0ny123

@r0ny123 r0ny123 commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

What this changes

WinApiResolver now applies the per-DLL aslr_offset of 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, apiscout 668c981), which was built with the ASLR offsets of its boot. In that DB, 174 of the 64-bit system DLLs share the file ImageBase 0x180000000, 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 sharing 0x180000000 plus 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).
    • Both DBs are not bundled.
  • Recovery, escaping and hashing are not touched. With no API_COLLECTION_FILES configured (the default), or with DBs whose offsets are 0, nothing changes.

  • make lint and make format

  • make test-all

  • CHANGELOG.md entry under ## [Unreleased]

  • Golden fixtures unchanged

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

No deployments
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