hasherezade / pe-sieve

Scans a given process. Recognizes and dumps a variety of potentially malicious implants (replaced/injected PEs, shellcodes, hooks, in-memory patches).
https://hshrzd.wordpress.com/pe-sieve/
BSD 2-Clause "Simplified" License
3.01k stars 421 forks source link

Detect a patch partially overlapping Import Address Table #15

Closed hasherezade closed 2 years ago

hasherezade commented 6 years ago

Full area of IAT (as defined in Data Directory) is excluded from the code scan. It is scanned by another type of scan, detecting IAT hooks. This is in general a good behavior, but it creates a blind spot for the patches that are installed in the padding at the end of the IAT.

Example:

Test case:

Below: the patched svchost vs the original one:

androm_err1

So, the patch starts in the last DWORD of the IAT (which was filled with padding).

hasherezade commented 2 years ago

Fixed: after more precise clearing of IAT, entire patch is detected:

iatp_detected