IMAGE_OPTIONAL_HEADER
and look at the value of Image Base, as shown at ❶ in the figure. We repeat this process with DLL2.dll and DLL3.dll, and see that they all request a base address of 0x10000000.DLL1Print
, which is an export of DLL1.dll. We disassemble DLL1.dll with IDA Pro and see that the function prints “DLL 1 mystery data,” followed by the contents of a global variable, dword_10008030
. If we examine the cross-references to dword_10008030
, we see that it is accessed in DllMain
when the return value from the call , we see calls to two exports from DLL2.dll: DLL2Print
and DLL2ReturnJ
. We can disassemble DLL2.dll with IDA Pro and examine DLL2Print
to see that it prints “DLL 2 mystery data,” followed by the contents of a global variable, dword_1000B078
. If we examine the cross-references to dword_1000B078
, we see that it is accessed in DllMain
when the handle to CreateFileA
is moved into it. The CreateFileA
function opens a file handle to temp.txt, which the function creates if it doesn’t already exist. DLL2Print
apparently prints the value of the handle for temp.txt. We can look at the DLL2ReturnJ
export and find that it returns the same handle that DLL2Print
prints. Further in , at ❶, the handle is moved into hObject
, which is passed to WriteFile
at ❷ defining where malwareanalysisbook.com
is written.After the WriteFile
in Lab09-03.exe, DLL3.dll is loaded with a call to LoadLibrary
, followed by the dynamic resolution of DLL3Print
and DLL3GetStructure
using GetProcAddress
. First, it calls DLL3Print
, which prints “DLL 3 mystery data,” followed by the contents of a global variable found at 0x1000B0C0. When we check the cross-references for the global variable, we see that it is initialized in DllMain
to the string ping www.malwareanalysisbook.com
, so the memory location of the string will again be printed. DLL3GetStructure
appears to return a pointer to the global dword_1000B0A0
, but it is unclear what data is in that location. DllMain
appears to initialize some sort of structure at this location using data and the string. Since DLL3GetStructure
sets a pointer to this structure, we will need to see how Lab09-03.exe uses the data to figure out the contents of the structure. shows the call to DLL3GetStructure
at ❶.
We can load DLL2.dll into IDA Pro in a different location by checking the Manual Load box when loading the DLL. In the field that says Please specify the new image base, we type 320000
. IDA Pro will do the rest to adjust all of the offsets, just as OllyDbg did when loading the DLL.
This lab demonstrated how to determine where three DLLs are loaded into Lab09-03.exe using OllyDbg. We loaded these DLLs into IDA Pro to perform full analysis, and then figured out the mystery data printed by the malware: mystery data 1 is the current process identifier, mystery data 2 is the handle to the open temp.txt, and mystery data 3 is the location in memory of the string ping www.malwareanalysisbook.com
. Finally, we applied the Windows AT_INFO
structure within IDA Pro to aid our analysis of DLL3.dll.