Table Of ContentMaster’s Thesis
TTAnalyze: A Tool for Analyzing
Malware
carried out at the
Information Systems Institute and
at the Institute of Computer Aided Automation
Technical University of Vienna
under the guidance of
Univ.Ass. Dipl.-Ing. Dr.techn. Engin Kirda
Univ.Ass. Dipl.-Ing. Dr.techn. Christopher Kru¨gel
by
Ulrich Bayer
Kirchberggasse 37/6
1070 Wien
Vienna, December 12, 2005
Kurzfassung
Diese Diplomarbeit beschreibt TTAnalyze - ein Tool, um das Verhalten von ausfu¨hrbaren
WindowsDateien(PE-Dateien)undimSpeziellenvonMalwarezuanalysieren. DasErgeb-
nis eines Programmaufrufs von TTAnalyze besteht in einer Report-Datei, die es einem
menschlichenBenutzererm¨oglicht, denZweckeinerausfu¨hrbarenDateieinzusch¨atzen. Der
generierteReportwirdwahlweisealsHTML-DateioderalseinfacheText-Dateiausgegeben.
Er enth¨alt detaillierte Information u¨ber die vom Testsubjekt gemachten Ver¨anderungen an
der Windows Registry oder am Dateisystem, sowie u¨ber Interaktionen mit dem Windows
Service Manager oder anderen Prozessen. Der gesamte Netzwerkverkehr wird ebenfalls
mitgeloggt.
Das Herzstu¨ck der Analyse besteht aus einem PC-Emulator, in dem das Testsub-
jekt gefahrlos und vollst¨andig u¨berwacht ablaufen kann. Die Analyse der Programm-
Ausfu¨hrungbeschr¨anktsichdabeiausschließlichaufsicherheits-relevanteAspekte,wodurch
der Analyse-Prozess vereinfacht und die Ergebnisse genauer werden. TTAnalyze ist das
ideale Hilfsmittel fu¨r Personen, die Viren und Malware untersuchen, um m¨oglichst schnell
m¨oglicht viel u¨ber eine unbekannte ausfu¨hrbare Datei herauszufinden.
Abstract
This thesis describes TTAnalyze: a tool for analyzing the behavior of Windows PE-
executables with special focus on the analysis of malware. Execution of TTAnalyze results
in the generation of a report file that contains enough information to give a human user
a very good impression about the purpose and the actions of the analyzed binary. The
generated report includes detailed data about modifications made to the Windows registry
or the file system, about interactions with the Windows Service Manager or other processes
and of course it logs all generated network traffic.
The analysis is based on running the binary in an emulated environment and watching
i.e. analyzing its execution. The analysis focuses on the security-relevant aspects of a
program’s actions, which makes the analysis process easier and because the domain is
more fine-grained it allows for more precise results. It is the ideal tool for the malware and
virus interested person to get a quick understanding of the purpose of an unknown binary.
Acknowledgments
This master’s thesis was carried out in cooperation with Ikarus-Software GmbH. I want
to thank them for the possibility to work on a very interesting subject that is also of
practical relevance.
Moreover, I want to thank my advisors Engin Kirda, and Christopher Kru¨gel for their
patience and their support during the whole work.
Special thanks go to my colleagues at Ikarus, Martin St¨ofler and Ju¨rgen Wohlmuth.
Ju¨rgen has helped implement parts of the analysis-framework. I am grateful to Martin for
keeping me focused on the important things in life.
I would also like to thank Helmut Petritsch (who created the build-system for TTAna-
lyze) for the world’s best and coolest build-system.
Contents
1 Introduction 1
1.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Challenges of the Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.1 Creating High Level Information . . . . . . . . . . . . . . . . . . . 2
1.2.2 Static Analysis vs. Dynamic Analysis . . . . . . . . . . . . . . . . . 3
1.3 Our Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Structure of This Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Emulation 7
2.1 Classification of Emulators . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Virtualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.1 Classification of Virtualizers . . . . . . . . . . . . . . . . . . . . . . 10
2.2.2 VMM Advantages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.3 Hardware Virtualization Support . . . . . . . . . . . . . . . . . . . 11
2.2.4 Relationship between VMMs and Emulators . . . . . . . . . . . . . 12
2.3 CPU Emulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.1 Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3.2 Dynamic Translation . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4 QEMU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3 Related Work 19
3.1 Sysinternals Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2 Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.3 Disassembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4 Design and Implementation of TTAnalyze 23
4.1 System Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1.1 Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1.2 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.1.3 Sample Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2 InsideTM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.1 InsideTM Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
i
4.2.2 InsideTM Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3 Analysis-Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.3.1 Mode of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.3.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3.3 Analyzers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.4 The Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.4.1 Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.4.2 Callback-Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.4.3 Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.4.4 Factory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.4.5 Function Call Insertion . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.5 QEMU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.5.1 Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.5.2 Integration into TTAnalyze . . . . . . . . . . . . . . . . . . . . . . 52
5 TTAnalyze Case Studies 61
5.1 TTAnalyze’s Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.2 TTAnalyze Test Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
5.2.1 Test Results - Overview . . . . . . . . . . . . . . . . . . . . . . . . 69
5.2.2 Email-Worm.Win32.Sober Y . . . . . . . . . . . . . . . . . . . . . . 69
6 Conclusion and Future Work 75
A External Dependencies 81
A.1 Runtime Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
A.2 Compiletime Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
B Command Line Parameters of TTAnalyze 85
ii
Description:Apr 12, 2005 Virtualizers such as VMWare [44], PearPC [29] and. VirtualPC [23] are popular as
they are fast. Virtualizers are said to “virtualize” the hard-.