Книга: Practical Malware Analysis: The Hands-On Guide to Dissecting Malicious Software
Назад: Manual Symbol Resolution
Дальше: Shellcode Encodings

shows a full implementation of the findSymbolByHash function that can be used to find exported symbols in loaded DLLs.

shows a complete Hello World shellcode example that uses the previously defined findKernel32Base and findSymbolByHash functions, instead of relying on hard-coded API locations.

The code begins by using a call/pop at to obtain a pointer to the data starting at . It then calls findKernel32Base at to find kernel32.dll and calls findSymbolByHash at to find the export in kernel32.dll with the hash 0xEC0E4E8E. This is the ror-13-additive hash of the string LoadLibraryA. When this function returns EAX, it will point to the actual memory location for LoadLibraryA.

The code loads a pointer to the "user32" string at and calls the LoadLibraryA function. It then finds the exported function MessageBoxA at and calls it to display the “Hello World!!!!” message. Finally, it calls ExitProcess to cleanly exit.

sss
sss

© RuTLib.com 2015-2018