Add impscan plugin#2000
Open
thunderstornX wants to merge 1 commit into
Open
Conversation
Ports the Volatility 2 impscan plugin (by Michael Ligh) to Volatility 3. It disassembles a process's executable region, finds CALL/JMP instructions that reference the import address table, and resolves each IAT entry to the exported function it points at, reconstructing imports even when the PE headers are damaged or the code was injected. Export enumeration reuses the existing pe_symbols machinery, disassembly uses capstone, and a linear sweep with resynchronisation handles the non-code bytes in a mapped module image. Adds unit tests for the IAT-detection, resynchronisation and vicinity-scan logic. Closes volatilityfoundation#748
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.
Summary
Closes #748.
This ports the Volatility 2
impscanplugin (originally by Michael Ligh) to Volatility 3, the last of the malware plugins still missing from the Vol2 feature-parity effort.impscandisassembles a process's executable region, findsCALL/JMPinstructions that reference the import address table (IAT), and resolves each IAT entry to the exported function it points at. This reconstructs a process's imports even when the PE headers are damaged or the code was injected, which is why it is useful for malware analysis.Implementation
volatility3/framework/plugins/windows/malware/impscan.py:pslist.PsList.list_processes(with an optional--pidfilter) and reads the main module (or a--base/--sizeregion).{export_address: (module, function)}map for every loaded module by reusing the existingpe_symbols.PESymbols.get_pefile_obj/pefileexport machinery.CALL DWORD [0x...]) and x64 RIP-relative (CALL QWORD [RIP+0x...]) IAT references. Because capstone stops at the first byte it cannot decode, the module image (headers and data included) is swept linearly with a one-byte resynchronisation.Rtl*imports to theirkernel32names.Testing
test/test_impscan.py: 10 unit tests covering the IAT-target decoding (real capstone-disassembled x86 absolute and x64 RIP-relativeCALL/JMP, register-call and non-branch rejection), the capstone resynchronisation, the vicinity scan, the forwarded-import remap and the pointer read. No image required.services.exereconstructed 414 imports, e.g.ruff formatandruff checkare clean.I have only been able to test against an x64 image; I would appreciate validation against the project's x86/WoW64 sample images as part of review.