Commit 1cc9bcb
committed
fix: use memory-mapped image for API module decoy PEs
The ApiModuleLoader was writing raw PE file bytes into emulated memory,
but PE sections have different file offsets vs virtual addresses. Shellcode
that walks the PEB InInitializationOrderModuleList to find kernel32 and
then parses its export directory would read garbage because the .edata
section data was at its file offset rather than its virtual address.
Use pefile's get_memory_mapped_image() so sections are placed at their
correct virtual addresses, matching how Windows loads DLLs.
Also fixes Process.ldr_entries being a shared class-level mutable default
instead of a per-instance list, and corrects the test config module order
to list ntdll before kernel32 (matching the default config).
Closes #45
remove unnecessary test file1 parent b67754b commit 1cc9bcb
2 files changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | 299 | | |
305 | 300 | | |
306 | 301 | | |
307 | 302 | | |
308 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| |||
0 commit comments