Nax Posted December 4, 2011 Share Posted December 4, 2011 This is the hidden content, please Sign In or Sign Up This is the hidden content, please Sign In or Sign Up Pass: level-23.biz Analysing Malicious Code: Dynamic Techniques Lars Haukli ([email protected]) Department of Telematics, Norwegian University of Science and Technology (NTNU) [spoiler= Contents]Contents 1 Introduction: Dynamic, Static or both? 6 1.1 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.2 Writing this document . . . . . . . . . . . . . . . . . . . . . . . . 9 1.3 The plan (and working methods) . . . . . . . . . . . . . . . . . . 9 1.3.1 Mind Mapping . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4 Discussing sources of information . . . . . . . . . . . . . . . . . . 12 1.5 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2 API hooking 15 2.1 How to Hook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.1.1 Madshi’s MadCollection . . . . . . . . . . . . . . . . . . . 17 2.1.2 MadCodeHook: Important Functions . . . . . . . . . . . . 17 2.2 DLL Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.3 Inter-Process and DLL communication . . . . . . . . . . . . . . . 21 2.4 Tool functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.5 Callback functions/function variables . . . . . . . . . . . . . . . . 23 2.6 DLLs for system wide support . . . . . . . . . . . . . . . . . . . . 24 2.7 Process Wide Hooking . . . . . . . . . . . . . . . . . . . . . . . . 25 2.8 System Wide Hooking . . . . . . . . . . . . . . . . . . . . . . . . 26 2.9 Summing Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3 Networking and Virtualization 30 3.1 Virtual Networking in VMWare . . . . . . . . . . . . . . . . . . . 30 3.2 The VMWare Backdoor (i/o port) . . . . . . . . . . . . . . . . . 33 3.3 Attacks on Virtual Machines . . . . . . . . . . . . . . . . . . . . 34 3.4 Hardware-bound vs pure software emulators . . . . . . . . . . . . 38 3.5 Detecting VMware . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.6 Red Pill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.7 Controlling the guest through Eclipse - Debugging . . . . . . . . 41 4 Memory Scanning and API Monitoring 42 4.0.1 Determining Entry Points . . . . . . . . . . . . . . . . . . 42 4.1 Usermode and Kernelmode Scanning . . . . . . . . . . . . . . . . 43 4.2 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 4.3 Similar Applications . . . . . . . . . . . . . . . . . . . . . . . . . 45 5 Packers 46 5.1 In general terms . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 5.2 HyperUnpackMe2 . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5.3 Storm (aka Peacomm, Tibs) – a modern bot . . . . . . . . . . . . 47 5.4 EXECryptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 5.5 PolyUnpack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 6 Structural Analysis 63 6.1 Hashing apps and bin diffs . . . . . . . . . . . . . . . . . . . . . . 63 6.2 PE and PE+ file formats . . . . . . . . . . . . . . . . . . . . . . 63 6.2.1 pefile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 6.2.2 pydasm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 6.2.3 madDisAsm . . . . . . . . . . . . . . . . . . . . . . . . . . 65 6.3 IDA Pro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 6.4 OllyDbg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 7 Automating analysis 67 7.1 Twisted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 7.2 VMware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 7.2.1 VIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 7.2.2 VI SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 7.3 XYNTService . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 7.4 Wrapping the vmrun command . . . . . . . . . . . . . . . . . . . 73 7.5 pyVIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 7.6 PaiMei . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 7.6.1 PyDbg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 7.6.2 Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 196.. páginas + Link to comment Share on other sites More sharing options...
Recommended Posts