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

Overeager imports reconstruction #97

Closed
hasherezade opened this issue Dec 22, 2021 · 1 comment
Closed

Overeager imports reconstruction #97

hasherezade opened this issue Dec 22, 2021 · 1 comment
Assignees

Comments

@hasherezade
Copy link
Owner

hasherezade commented Dec 22, 2021

Sample:

Problem:

During the full import table reconstruction, PE-sieve finds imported functions by pattern search. By default it is done very aggressively, and every chunk that matches the address of exported function, is treated as Import. This is very prone to false-positives. It may happen coincidentally, that the code contains a DWORD that look exactly like the Import's address.

For example:

790000.exe.imports.txt

---
IAT at: 31cd, size: 4, thunks: 1, is_terminated: 0
---
31cd,74f685f0,shcore.SHCreateStreamOnFileW #45
---

This chunk (0x74f685f0):

chunk

Coincidentally matched the address of exported function:

31cd,74f685f0,shcore.SHCreateStreamOnFileW #45

and as the result, has been (mistakenly) included in the import table.

code_interpreted_as_import_ida

PE-sieve should allow to regulate the mode of reconstructing Import Table, and by default, skip single thunks.

@hasherezade hasherezade self-assigned this Dec 22, 2021
@hasherezade hasherezade changed the title Overeager import reconstruction Overeager imports reconstruction Dec 22, 2021
@hasherezade
Copy link
Owner Author

After the changes, it is possible to specify how much aggressive the Import detection should be. In the lowest (restrictive) mode, only the terminated blocks will be included.

Results for aforementioned sample (restrictive mode):
recreated_mode0

In the second (middle) mode, unterminated blocks can be included too, if the contain more than 1 thunk.

Results for aforementioned sample (middle mode):
recreated_mode1

The most aggressive mode works just like the previous default mode - all the thunks are included.

Results for aforementioned sample (aggressive mode):
recreated_mode2

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

No branches or pull requests

1 participant