1 00:00:00,000 --> 00:00:06,500 Okay, hello guys, welcome to the last talk of the day, also the last talk of DEF CON 2018. 2 00:00:07,040 --> 00:00:09,780 Well, I'm Benson and this is Jeremy. 3 00:00:10,880 --> 00:00:13,740 We actually are very surprised that you guys are still here. 4 00:00:14,820 --> 00:00:20,640 You guys didn't, you know, get passed out from last night's crazy Saturday night. 5 00:00:23,020 --> 00:00:25,940 Actually, the talk is about malware analysis. 6 00:00:25,940 --> 00:00:32,240 We first will introduce some very famous malware instances that we have collected. 7 00:00:32,660 --> 00:00:41,800 And then we will explain how these malware try to fight against anti-malware solutions. 8 00:00:42,500 --> 00:00:47,280 And then we propose a method that we call malware runtime forensics, 9 00:00:47,320 --> 00:00:52,820 that we try to analyze these forensic data on these malwares. 10 00:00:52,980 --> 00:00:55,020 And then we try to do automatic clustering. 11 00:00:55,240 --> 00:00:55,920 That's what we do. 12 00:00:55,940 --> 00:00:58,520 And that helps us to identify who is who after all. 13 00:01:00,900 --> 00:01:04,460 So as I have introduced, I'm Benson and this is Jeremy. 14 00:01:04,680 --> 00:01:10,360 And then another speaker, Wayne, actually went back to Santa Clara with one of our colleagues. 15 00:01:10,840 --> 00:01:13,060 He actually got so sick on the last day. 16 00:01:14,000 --> 00:01:15,640 So Wayne was not here. 17 00:01:15,640 --> 00:01:23,300 So he's here. 18 00:01:24,250 --> 00:01:30,020 First of all, we actually would like to introduce some Chinese characters. 19 00:01:30,440 --> 00:01:39,840 Actually, the character on the upper left corner exactly represents the term malicious in Chinese. 20 00:01:45,640 --> 00:01:55,140 And then the first malware sample that we're going to introduce here is actually one of the malicious malware that is very famous called Shopstealer. 21 00:01:55,700 --> 00:02:04,980 It actually helps you generate programs that you can steal username and password from these famous common well-known applications, 22 00:02:05,320 --> 00:02:11,980 such as Internet Explorer, MSN Messengers, or your Firefox. 23 00:02:11,980 --> 00:02:14,460 So it's more like a malware generator. 24 00:02:16,540 --> 00:02:18,600 The next one is called BFrost. 25 00:02:18,900 --> 00:02:20,780 This one is also very famous. 26 00:02:21,020 --> 00:02:24,120 It's a very famous bot malware. 27 00:02:24,620 --> 00:02:32,340 As you can see, on this CNC console, it actually has 28 users connected back to this CNC console. 28 00:02:32,620 --> 00:02:34,480 So there are 28 victims. 29 00:02:36,860 --> 00:02:41,400 And then the one you see up here is a Chinese version. 30 00:02:42,640 --> 00:02:45,700 It actually derived from the BFrost. 31 00:02:46,180 --> 00:02:51,940 And it originally derived from BFrost by Chinese hackers. 32 00:02:52,340 --> 00:02:58,580 And then these characters, if you notice, it's in traditional Chinese rather than simplified Chinese. 33 00:02:58,860 --> 00:03:01,720 So it got localized by Taiwanese hackers. 34 00:03:02,520 --> 00:03:08,920 And then the block you see here, you can specify where is your CNC console. 35 00:03:09,280 --> 00:03:11,220 And then whether you want to pack. 36 00:03:11,400 --> 00:03:14,460 The resulting malware or not. 37 00:03:14,660 --> 00:03:20,620 You can also specify if you want to add more plug-ins, such as keyloggers, so on and so forth. 38 00:03:20,960 --> 00:03:24,360 So it makes generating the malware that help you steal, 39 00:03:25,440 --> 00:03:30,560 that make you infect victims to be a bot very easily. 40 00:03:34,140 --> 00:03:39,120 And then the second phrase we're going to introduce in the talk is called Louji. 41 00:03:39,680 --> 00:03:40,240 Louji. 42 00:03:40,240 --> 00:03:42,200 This one represents chicken. 43 00:03:42,960 --> 00:03:46,000 While in DEVCOM, you see that the wall of sheep. 44 00:03:46,220 --> 00:03:49,180 Well, in Chinese hacker community, they don't call it sheep. 45 00:03:49,340 --> 00:03:50,040 They call it chicken. 46 00:03:50,980 --> 00:03:54,520 So you actually see a farm of chicken instead of wall of sheep. 47 00:03:58,640 --> 00:04:01,420 And this is the wall, the farm of chicken. 48 00:04:07,020 --> 00:04:07,500 Yeah. 49 00:04:07,500 --> 00:04:10,600 So obviously, you know where it came from, right? 50 00:04:10,740 --> 00:04:15,280 In the wall of sheep, we only show username and password in DEVCOM. 51 00:04:15,600 --> 00:04:19,500 But in the farm of chicken, you get to see victim's face through the webcam. 52 00:04:24,780 --> 00:04:25,320 Okay. 53 00:04:25,560 --> 00:04:32,900 And then the modern advanced malware are so powerful that they have so many advanced features. 54 00:04:33,200 --> 00:04:37,120 These features including anti-blah-blah-blah features. 55 00:04:37,120 --> 00:04:47,400 Such as antivirus, going against antivirus, going against your firewall, and then going against your hips. 56 00:04:50,780 --> 00:04:54,860 And then it has more features if you are willing to pay more. 57 00:04:55,120 --> 00:05:02,980 So if you pay more, you get to enjoy more features that you can put into your malware that you generated. 58 00:05:03,280 --> 00:05:06,400 So it's more like a malware as a service in this community. 59 00:05:09,360 --> 00:05:12,840 So you can see some features such as... 60 00:05:12,840 --> 00:05:19,760 So in addition to antivirus, fighting against antivirus, fighting against firewall, fighting against the hips, 61 00:05:19,960 --> 00:05:26,000 you also have anti-VMware, anti-debugger, anti-API hookings. 62 00:05:26,220 --> 00:05:30,280 So these are the features that once you pay more, you can enjoy. 63 00:05:35,320 --> 00:05:41,640 So now we will also talk about how they fight against the sandboxing environment. 64 00:05:42,100 --> 00:05:45,520 How they can detect whether they are in the sandboxing environment or not. 65 00:05:46,020 --> 00:05:48,780 These are the approaches that they use. 66 00:05:49,540 --> 00:05:54,580 The first one is how they can detect whether they are inside a VM or emulator environment. 67 00:05:56,400 --> 00:06:00,260 Usually one approach is that they would try to change the environment. 68 00:06:00,280 --> 00:06:03,960 So they can check the base address for this IDT and LDT. 69 00:06:04,180 --> 00:06:09,700 Because in a normal machine, the IDT and LDT address starts with A something. 70 00:06:10,300 --> 00:06:14,440 If it's not starting with this address, then it's probably in the VM environment. 71 00:06:15,260 --> 00:06:17,340 And they can also check for the devices. 72 00:06:17,720 --> 00:06:20,720 Because these devices in the VM environment or emulators, 73 00:06:21,060 --> 00:06:24,140 for example, the CPU ID tends to be very unique. 74 00:06:24,340 --> 00:06:26,280 The model name tends to be very unique. 75 00:06:26,620 --> 00:06:29,460 They also have a very specific PCI device. 76 00:06:30,280 --> 00:06:33,520 So if they check against these special hardware specifications, 77 00:06:34,160 --> 00:06:38,140 they can recognize whether they are in the VM environment or emulator. 78 00:06:39,120 --> 00:06:44,000 And after all, they can also try to launch these backdoor commands. 79 00:06:44,400 --> 00:06:50,660 Because these undocumented backdoor commands are only available when you are inside an emulator environment. 80 00:06:51,340 --> 00:07:00,200 So it's very easy for malware to recognize whether they are in a VM environment or emulator. 81 00:07:01,300 --> 00:07:05,420 And then, in addition to VM emulator detection, 82 00:07:05,860 --> 00:07:11,220 they can also check whether they are in a sandboxing Windows environment or not. 83 00:07:11,700 --> 00:07:14,360 Because in a sandboxing Windows environment, 84 00:07:14,720 --> 00:07:19,420 you tend to have specific service, you tend to have a specific process name. 85 00:07:19,640 --> 00:07:25,960 So they can try to check whether these specific process or specific service names are there or not. 86 00:07:26,560 --> 00:07:28,860 Also, they can also try to detect 87 00:07:28,860 --> 00:07:34,780 whether this kernel mode SSDT or the user mode API hook-in is present or not. 88 00:07:35,420 --> 00:07:41,780 And then, after all, the last one is a very trivial one but works very effectively. 89 00:07:42,180 --> 00:07:47,400 They actually have a list of legitimate Windows production IDs. 90 00:07:47,900 --> 00:07:52,920 Because these vendors, they have to have legal license of their Windows. 91 00:07:53,220 --> 00:07:55,020 So they have a limited set. 92 00:07:55,260 --> 00:07:58,800 And this limited set is being collected by hackers' companies. 93 00:07:58,800 --> 00:08:01,820 So they know whether they are inside the sandbox or not 94 00:08:01,820 --> 00:08:05,080 simply by checking against this legitimate license. 95 00:08:08,800 --> 00:08:12,460 So we have introduced how modern malware 96 00:08:12,460 --> 00:08:18,560 try to detect whether they are in a sandbox VM emulating environment or not. 97 00:08:18,800 --> 00:08:23,540 And then what's even more is that they can also try to defeat you 98 00:08:23,540 --> 00:08:26,700 even when you try to have monitors, 99 00:08:26,700 --> 00:08:30,480 even when you try to hook and then try to detect them. 100 00:08:30,960 --> 00:08:35,920 So what they can do is that they can restore the SSDT hook. 101 00:08:36,260 --> 00:08:42,220 They can also unload the notified routine or process of thread or image or registry. 102 00:08:42,980 --> 00:08:47,660 They can also unload this file system filter, restore the SSD hook, 103 00:08:48,460 --> 00:08:51,820 unload the TDI filter which is for networking. 104 00:08:51,820 --> 00:08:56,680 And they can also remove these NTFS attached device. 105 00:08:57,440 --> 00:09:00,280 So you can see there are a lot of things they can do. 106 00:09:00,420 --> 00:09:04,840 Try to unhook you and then try to neutralize your monitors. 107 00:09:05,800 --> 00:09:09,080 And then after all, there are also some heaps. 108 00:09:09,200 --> 00:09:13,760 They try to implement their protection layer on the file system level. 109 00:09:14,580 --> 00:09:20,260 However, these modern malware, they can also try to launch direct road DIGS access 110 00:09:20,260 --> 00:09:22,400 through the DIGS.SYS. 111 00:09:22,680 --> 00:09:25,560 Then they can bypass your file system protection. 112 00:09:28,400 --> 00:09:33,900 So what we try to propose in our talk is actually a behavior analysis. 113 00:09:34,340 --> 00:09:36,300 And then we try to do forensics. 114 00:09:36,940 --> 00:09:39,660 There are two approaches for behavior analysis. 115 00:09:40,200 --> 00:09:44,200 The one is called a network-based approach, 116 00:09:44,460 --> 00:09:46,280 which we will not address in our talk 117 00:09:46,280 --> 00:09:49,560 because the approach that we take is actually a host-based. 118 00:09:50,580 --> 00:09:53,600 So for host-based approach, we already mentioned, 119 00:09:53,860 --> 00:09:56,520 you either use a VM, you use a sandbox. 120 00:09:56,980 --> 00:10:01,540 But as you already know, malware can defeat this very easily. 121 00:10:01,840 --> 00:10:06,560 So what we do is actually use a host-based runtime forensics. 122 00:10:09,300 --> 00:10:16,180 So in our runtime forensics, what we did is that we let the malware execute it. 123 00:10:16,480 --> 00:10:20,240 And then we try to do forensics after it's already executed. 124 00:10:20,260 --> 00:10:23,360 So we collect the snapshot of the environment. 125 00:10:23,700 --> 00:10:30,200 And then we try to identify the special features in that environment. 126 00:10:30,880 --> 00:10:33,200 And because we already let the malware execute, 127 00:10:33,520 --> 00:10:38,480 we don't have to have monitors to see what happened to the malware during its executions. 128 00:10:38,820 --> 00:10:42,820 We also don't have to do hookings either through the API or not. 129 00:10:44,040 --> 00:10:47,580 So we have nothing for the malware to defeat us. 130 00:10:52,920 --> 00:10:54,560 So you might be wondering, 131 00:10:54,740 --> 00:10:56,940 so what kind of features do we try to get 132 00:10:57,620 --> 00:11:00,300 when we study this snapshot of an environment? 133 00:11:01,340 --> 00:11:04,480 There are three aspects of features that we try to collect. 134 00:11:04,720 --> 00:11:05,600 We try to analyze. 135 00:11:06,040 --> 00:11:08,600 The first one would be the installation remnants. 136 00:11:09,580 --> 00:11:15,400 These are the installation files after the malware tries to execute on the system. 137 00:11:15,820 --> 00:11:17,580 They either could be startup files. 138 00:11:17,580 --> 00:11:20,440 They either could be additional registered keys. 139 00:11:21,440 --> 00:11:23,740 We also study the memory layout. 140 00:11:24,020 --> 00:11:28,420 Try to find some memory block or suspicious DLLs. 141 00:11:29,120 --> 00:11:34,720 And then we also try to find if there are suspicious malicious behavior inside the systems. 142 00:11:34,920 --> 00:11:37,720 For example, a hidden process, hidden files. 143 00:11:38,140 --> 00:11:40,760 So these are all the symptoms for malicious behavior 144 00:11:40,760 --> 00:11:47,340 where a legitimate software would not exhibit on your system. 145 00:11:47,340 --> 00:11:48,040 Normally. 146 00:11:51,160 --> 00:11:53,320 And then among the three aspects, 147 00:11:53,580 --> 00:11:58,240 we would further explain the one how we study memory layout 148 00:11:58,240 --> 00:12:02,220 because this one is the most hardest one to work with. 149 00:12:02,780 --> 00:12:04,580 So how we study the memory layout? 150 00:12:04,880 --> 00:12:09,920 First, we have to identify which process is suspicious. 151 00:12:10,480 --> 00:12:12,600 So the way we identify this one is 152 00:12:12,600 --> 00:12:15,900 we first will fetch the process and service list. 153 00:12:15,900 --> 00:12:22,380 And then we compare against the process list that is already inside the system. 154 00:12:22,660 --> 00:12:25,360 And we find the difference between these two lists. 155 00:12:26,420 --> 00:12:31,100 And then how we fetch the process including we scan all the following tables 156 00:12:31,100 --> 00:12:33,300 as you can see up here on the slides. 157 00:12:34,280 --> 00:12:39,100 And then by doing this, we already identify the hidden process. 158 00:12:39,380 --> 00:12:42,220 We already identify the process that is very suspicious. 159 00:12:42,680 --> 00:12:44,760 Then we have to further dig into. 160 00:12:44,760 --> 00:12:51,040 We have to find which part of this process has the suspicious DLLs. 161 00:12:51,900 --> 00:12:55,040 So we will fetch the DLLs from the LDR. 162 00:12:55,420 --> 00:12:57,620 And then we analyze the memory layout. 163 00:12:58,490 --> 00:12:59,520 Also its structures. 164 00:12:59,840 --> 00:13:01,080 Scan the code block. 165 00:13:02,020 --> 00:13:05,680 Try to find the code blocks that is 166 00:13:06,620 --> 00:13:08,460 which we will explain later. 167 00:13:08,620 --> 00:13:12,100 How we do this part to find the suspicious DLL. 168 00:13:15,700 --> 00:13:18,080 So what you see on the graph, 169 00:13:18,340 --> 00:13:22,400 normally a process will involve a lot of DLLs 170 00:13:22,400 --> 00:13:24,660 where they are implicitly linked. 171 00:13:25,120 --> 00:13:28,440 But if there is a DLL that is explicitly linked, 172 00:13:28,740 --> 00:13:31,440 it's very likely that it's a suspicious DLL. 173 00:13:32,320 --> 00:13:35,040 And that is how we identify a suspicious DLL. 174 00:13:35,540 --> 00:13:38,860 So that's what we call, we check the LDR. 175 00:13:39,240 --> 00:13:41,400 And then we scan the import table. 176 00:13:41,580 --> 00:13:43,680 Try to find the suspicious DLL. 177 00:13:44,760 --> 00:13:45,760 On the other hand, 178 00:13:45,820 --> 00:13:51,100 if the process actually does not load a DLL at wrong time, 179 00:13:51,300 --> 00:13:53,860 it actually does some code injection instead. 180 00:13:54,200 --> 00:13:57,460 Then our approach is that we will search the memory. 181 00:13:57,700 --> 00:14:00,320 Try to find the suspicious P image. 182 00:14:04,980 --> 00:14:07,660 So in this flow chart you can see that. 183 00:14:08,120 --> 00:14:09,120 So let's review. 184 00:14:09,460 --> 00:14:11,660 We try to identify suspicious process. 185 00:14:12,100 --> 00:14:14,680 And then we try to identify suspicious DLL. 186 00:14:14,760 --> 00:14:17,240 And then inside this suspicious DLL, 187 00:14:17,340 --> 00:14:19,480 we do our runtime forensics. 188 00:14:19,920 --> 00:14:22,520 Which includes LDR scan, 189 00:14:22,900 --> 00:14:24,400 PE Packer signature checking, 190 00:14:24,780 --> 00:14:26,020 code disassembly, 191 00:14:26,180 --> 00:14:27,140 string extraction, 192 00:14:27,720 --> 00:14:30,300 and then file inspection for hidden files. 193 00:14:30,820 --> 00:14:35,620 So these are the action items that we do for runtime forensics. 194 00:14:35,760 --> 00:14:39,820 Once we already identify the suspicious memory layout. 195 00:14:43,080 --> 00:14:44,180 And then, 196 00:14:44,180 --> 00:14:45,940 in the following slides, 197 00:14:46,220 --> 00:14:48,100 we will introduce some examples 198 00:14:48,100 --> 00:14:50,320 that we have collected in the world 199 00:14:50,320 --> 00:14:57,500 that use all these kind of anti-malware techniques. 200 00:14:57,980 --> 00:14:59,960 The first one will be the BFrost. 201 00:15:00,240 --> 00:15:02,120 You already seen in the previous slides. 202 00:15:02,440 --> 00:15:04,920 This one is a very famous bot 203 00:15:04,920 --> 00:15:07,240 that being used in Chinese hacker community. 204 00:15:08,460 --> 00:15:12,480 And its Chinese name is called Rainbow Bridge. 205 00:15:12,480 --> 00:15:17,340 And the phrase is actually from its icon being used. 206 00:15:17,600 --> 00:15:19,800 So you can see the icon is a Rainbow Bridge. 207 00:15:20,080 --> 00:15:21,940 So that's its Chinese name. 208 00:15:22,840 --> 00:15:24,200 And this BFrost, 209 00:15:25,860 --> 00:15:27,800 it uses code injection. 210 00:15:28,180 --> 00:15:29,400 So it's not DLL injection. 211 00:15:29,500 --> 00:15:30,420 It uses code injection. 212 00:15:30,800 --> 00:15:35,760 So the only way you can find this suspicious code injection, 213 00:15:35,940 --> 00:15:37,200 you have to scan the memory. 214 00:15:37,400 --> 00:15:39,240 And then try to find the PE image. 215 00:15:40,200 --> 00:15:41,740 And then you will notice that 216 00:15:41,740 --> 00:15:44,600 it try to do code injection into the IE browser. 217 00:15:44,920 --> 00:15:46,140 Into IE browser. 218 00:15:46,400 --> 00:15:50,140 And then you will access a series of URLs. 219 00:15:50,880 --> 00:15:51,980 And the first one, 220 00:15:52,040 --> 00:15:52,940 if you notice that, 221 00:15:53,000 --> 00:15:55,720 the first one it try to access is Microsoft.com. 222 00:15:56,040 --> 00:15:58,520 It actually try to check if the network connectivity 223 00:15:58,520 --> 00:16:00,060 is available or not. 224 00:16:00,520 --> 00:16:04,260 And then it try to access some CNC servers. 225 00:16:06,140 --> 00:16:07,980 These CNC servers are actually 226 00:16:07,980 --> 00:16:10,700 named after Chinese vocabularies. 227 00:16:10,700 --> 00:16:14,100 For example, the one that we highlighted 228 00:16:14,100 --> 00:16:17,180 is actually called may I know. 229 00:16:17,560 --> 00:16:19,540 You ask a question, may I know, 230 00:16:19,540 --> 00:16:21,620 the phrase is called qing wen, may I know. 231 00:16:24,740 --> 00:16:27,460 Case number two is also a very famous one 232 00:16:28,400 --> 00:16:30,160 in Chinese hacker community. 233 00:16:30,240 --> 00:16:31,060 It's called GhostNet. 234 00:16:31,600 --> 00:16:35,120 The original official report is actually released 235 00:16:35,120 --> 00:16:36,900 by Canadian researchers. 236 00:16:37,880 --> 00:16:39,060 Shadows in the Cloud. 237 00:16:40,700 --> 00:16:43,180 And then from the sample, 238 00:16:43,380 --> 00:16:47,420 you can see that it try to do, 239 00:16:47,620 --> 00:16:52,400 it try to install itself as a system deal file 240 00:16:52,400 --> 00:16:53,680 into the system. 241 00:16:54,400 --> 00:16:58,240 And then it will connect to a CNC server. 242 00:16:58,540 --> 00:17:01,140 When we try to reverse these binary, 243 00:17:01,480 --> 00:17:03,900 we also identify the bottleneck commands 244 00:17:04,420 --> 00:17:05,340 that it can use. 245 00:17:05,620 --> 00:17:08,160 So you see all these bottleneck commands 246 00:17:08,160 --> 00:17:11,060 that this GhostNet can use. 247 00:17:12,420 --> 00:17:15,060 Notice that this GhostNet has nothing to do 248 00:17:15,060 --> 00:17:18,040 with the GhostRat malware. 249 00:17:19,400 --> 00:17:21,540 And then the string at the bottom, 250 00:17:21,740 --> 00:17:27,160 it's how we find out its original project name 251 00:17:27,160 --> 00:17:31,440 on that malware author's computer. 252 00:17:31,760 --> 00:17:33,660 It's actually called CXP. 253 00:17:33,760 --> 00:17:35,440 So it's the original project name 254 00:17:35,440 --> 00:17:38,740 before this malware being compiled. 255 00:17:44,120 --> 00:17:46,960 And the URL that we mark 256 00:17:46,960 --> 00:17:49,820 is actually one of the CNC servers 257 00:17:50,440 --> 00:17:53,160 that these malware samples try to connect to. 258 00:17:53,340 --> 00:17:56,980 And this CNC server is also being mentioned 259 00:17:56,980 --> 00:17:59,080 in the shadow in the Cloud report. 260 00:18:06,440 --> 00:18:13,260 The case number three is dfn666.net samples 261 00:18:13,260 --> 00:18:16,400 that we collected a few months ago 262 00:18:16,400 --> 00:18:18,660 through the mass SQL injection attack 263 00:18:19,020 --> 00:18:20,560 that have been launched recently, 264 00:18:20,800 --> 00:18:21,660 starting March. 265 00:18:22,780 --> 00:18:26,660 And these massive SQL injection attack, 266 00:18:27,020 --> 00:18:33,820 these malware will use shell executor hook, 267 00:18:33,820 --> 00:18:36,580 meaning that it will affect your exporter 268 00:18:36,580 --> 00:18:41,320 so that once you get infected, 269 00:18:41,520 --> 00:18:44,240 it will try to connect to all these online games 270 00:18:44,240 --> 00:18:47,360 and then try to steal your username and password 271 00:18:47,360 --> 00:18:48,460 for these online games. 272 00:18:50,240 --> 00:18:52,320 We have a very detailed story 273 00:18:52,320 --> 00:18:55,860 about this massive SQL injection on our blog. 274 00:18:56,880 --> 00:18:59,060 And this one is still ongoing nowadays. 275 00:18:59,500 --> 00:19:01,780 So even though its first experience 276 00:19:01,780 --> 00:19:03,280 are back in March, 277 00:19:03,280 --> 00:19:05,060 and it's still ongoing. 278 00:19:08,780 --> 00:19:11,020 So the last one will be the Zeus bot. 279 00:19:11,220 --> 00:19:13,320 It's also another malware that we study. 280 00:19:13,860 --> 00:19:16,860 And this one is a very famous one as well. 281 00:19:17,900 --> 00:19:21,260 You can see that it's actually trying to use 282 00:19:21,260 --> 00:19:22,900 the Winlogon notify. 283 00:19:23,380 --> 00:19:24,900 So through the Regis key. 284 00:19:25,260 --> 00:19:28,380 And then it will infect every process 285 00:19:28,380 --> 00:19:29,540 you have on the system. 286 00:19:30,200 --> 00:19:32,600 And then it will connect to a CNC server. 287 00:19:32,600 --> 00:19:34,160 Then you will become a bot. 288 00:19:37,200 --> 00:19:39,340 The Zeus bot is so famous 289 00:19:39,340 --> 00:19:41,680 that it even has its wiki page. 290 00:19:42,140 --> 00:19:45,100 And one of the security vendor even named it 291 00:19:45,600 --> 00:19:46,820 called the king of bots. 292 00:19:47,220 --> 00:19:50,380 Its botnet size is kind of like 3.6 millions. 293 00:19:54,340 --> 00:19:58,360 So now we will go into how we do malware clustering. 294 00:19:58,540 --> 00:20:01,640 Because we already know so much about malware. 295 00:20:01,640 --> 00:20:04,360 And then we know how to study them. 296 00:20:04,440 --> 00:20:05,900 We know how to do forensics on them. 297 00:20:06,060 --> 00:20:07,620 We know all their techniques. 298 00:20:08,380 --> 00:20:10,220 Then how do we do clustering? 299 00:20:13,340 --> 00:20:14,600 And then you might ask, 300 00:20:14,720 --> 00:20:16,960 why do you have to do clustering? 301 00:20:17,100 --> 00:20:17,980 You already know it's a malware. 302 00:20:19,840 --> 00:20:22,580 So the reason behind this is very obvious. 303 00:20:23,000 --> 00:20:25,880 Then you can group those that are alike together. 304 00:20:28,880 --> 00:20:31,600 So the way we do malware clustering is 305 00:20:31,600 --> 00:20:33,520 we try to compute the similarity 306 00:20:33,520 --> 00:20:35,220 between these malware instances. 307 00:20:36,460 --> 00:20:39,140 And so our final result, 308 00:20:39,300 --> 00:20:41,300 we will have to come up with a similarity matrix, 309 00:20:41,700 --> 00:20:44,520 which is a score that indicates 310 00:20:44,520 --> 00:20:50,740 how similar any two instances are compared 311 00:20:50,740 --> 00:20:52,020 between each other. 312 00:20:55,880 --> 00:20:58,080 So we will build a similarity matrix 313 00:20:58,080 --> 00:21:00,300 of the malware samples that we collected. 314 00:21:03,940 --> 00:21:07,380 So among the test sets that we have, 315 00:21:07,520 --> 00:21:09,960 it's more than 400 malware samples. 316 00:21:10,340 --> 00:21:13,340 We do forensic reports on all these malware samples. 317 00:21:16,700 --> 00:21:20,220 And then we try to extract the three significant features 318 00:21:20,220 --> 00:21:21,720 that we just mentioned. 319 00:21:22,940 --> 00:21:24,840 Installation elements, memory layouts, 320 00:21:24,840 --> 00:21:26,920 and suspicious malware behaviors. 321 00:21:29,680 --> 00:21:31,480 And then all these features, 322 00:21:31,600 --> 00:21:32,900 they will have a score. 323 00:21:33,140 --> 00:21:34,160 They will have a score. 324 00:21:37,060 --> 00:21:41,060 And then for every malware that have this score, 325 00:21:41,320 --> 00:21:44,080 it will compare against another malware instance. 326 00:21:44,480 --> 00:21:46,900 And then you can get a similarity. 327 00:21:47,340 --> 00:21:50,640 And then we compare with every malware instance. 328 00:21:50,860 --> 00:21:52,220 You get a vector of similarities. 329 00:21:54,060 --> 00:21:57,200 And then finally you get a matrix of similarities. 330 00:21:58,360 --> 00:22:01,940 And this is how we come up with the matrix after all. 331 00:22:04,880 --> 00:22:06,820 And then we automate this process 332 00:22:06,820 --> 00:22:09,300 through our tool called Zerobox. 333 00:22:10,520 --> 00:22:15,500 So Zerobox will scan all the malware samples that we have. 334 00:22:17,860 --> 00:22:19,140 Make it execute. 335 00:22:20,360 --> 00:22:21,660 And then study it. 336 00:22:23,700 --> 00:22:24,800 Get a report. 337 00:22:27,840 --> 00:22:29,540 And then come up with the matrix. 338 00:22:31,760 --> 00:22:33,260 And then do the clustering. 339 00:22:35,840 --> 00:22:39,200 And then you will be able to group into different groups. 340 00:22:43,660 --> 00:22:45,260 In our test samples, 341 00:22:45,440 --> 00:22:48,520 we actually have 408 malware samples 342 00:22:48,520 --> 00:22:51,600 that we collected on the July. 343 00:22:52,460 --> 00:22:55,280 On the 8th of July this year. 344 00:22:55,800 --> 00:22:59,500 Because we have a product called HackAlert 345 00:22:59,500 --> 00:23:02,740 that can scan websites for Trojans 346 00:23:02,740 --> 00:23:04,480 that are already on that website. 347 00:23:04,820 --> 00:23:06,620 And then we collect all these malware samples. 348 00:23:08,380 --> 00:23:11,240 And then we also test against these malware samples 349 00:23:11,240 --> 00:23:14,180 on some existing antivirus. 350 00:23:14,420 --> 00:23:17,000 And the hit rate is not that really good. 351 00:23:17,340 --> 00:23:20,160 Some vendors have less than 20%. 352 00:23:20,160 --> 00:23:21,920 Some vendors can have 50%. 353 00:23:21,920 --> 00:23:23,820 So these malware are really new. 354 00:23:30,340 --> 00:23:33,920 And how we do the clustering is through the K-means clustering. 355 00:23:34,220 --> 00:23:36,680 But we will not get into too much details 356 00:23:36,680 --> 00:23:38,360 on why we choose this one. 357 00:23:38,500 --> 00:23:43,000 But the clustering mechanism we use is K-means clustering. 358 00:23:44,460 --> 00:23:47,080 And you see the similarity matrix. 359 00:23:47,080 --> 00:23:49,660 And you see a lot of colors. 360 00:23:50,040 --> 00:23:52,200 The reason that it has a lot of colors 361 00:23:52,200 --> 00:23:58,540 is because we model these scores into RGBs. 362 00:23:58,580 --> 00:24:00,800 Because we want to visualize it. 363 00:24:01,000 --> 00:24:05,060 Humans have more feelings with pictures. 364 00:24:05,360 --> 00:24:06,800 So we try to visualize it. 365 00:24:07,620 --> 00:24:09,560 And then if you look at the first block, 366 00:24:10,920 --> 00:24:13,540 you see some patterns that are alike. 367 00:24:13,880 --> 00:24:15,000 Maybe you don't. 368 00:24:15,020 --> 00:24:16,340 But we will get into that. 369 00:24:19,720 --> 00:24:21,480 So this is the first block. 370 00:24:22,060 --> 00:24:24,200 Did you see any color patterns? 371 00:24:26,640 --> 00:24:28,920 Definitely you see a lot of color patterns. 372 00:24:29,100 --> 00:24:31,540 But actually there are some blocks 373 00:24:31,940 --> 00:24:33,960 that differentiate from other blocks. 374 00:24:35,100 --> 00:24:38,280 So for example, if you look at the second line, 375 00:24:38,600 --> 00:24:40,840 you see the upper corner, 376 00:24:41,040 --> 00:24:42,480 there are some gray colors. 377 00:24:42,940 --> 00:24:46,320 And then you see it becomes a little pink. 378 00:24:46,320 --> 00:24:47,780 Or the skin color. 379 00:24:47,980 --> 00:24:50,500 And then it becomes more purple. 380 00:24:50,680 --> 00:24:54,820 And then becomes more like a pale white again. 381 00:24:55,180 --> 00:24:58,160 So it seems that you can see four blocks 382 00:24:58,160 --> 00:25:00,340 within this big block. 383 00:25:06,020 --> 00:25:08,580 So simply by visualizing it, 384 00:25:08,700 --> 00:25:12,060 you already can group these colors into four blocks. 385 00:25:14,560 --> 00:25:17,040 I hope that you guys are not feeling dizzy. 386 00:25:17,600 --> 00:25:18,040 Okay. 387 00:25:22,600 --> 00:25:23,320 Yeah. 388 00:25:23,520 --> 00:25:28,180 And actually, every line, as we mentioned, 389 00:25:28,360 --> 00:25:30,640 it's a similarity vector. 390 00:25:30,960 --> 00:25:35,900 How these malware instance compare against other malware instance. 391 00:25:36,260 --> 00:25:38,600 So every line represents a malware instance. 392 00:25:38,920 --> 00:25:41,020 And then we use the antivirus 393 00:25:41,020 --> 00:25:44,840 to double check whether it's a malware or not. 394 00:25:46,180 --> 00:25:50,420 And you can see all these malware different namings 395 00:25:50,640 --> 00:25:52,780 used by these antivirus vendors. 396 00:25:59,880 --> 00:26:02,120 And then all these malware instance 397 00:26:02,120 --> 00:26:05,540 happen to be the same malware family. 398 00:26:05,800 --> 00:26:06,900 Cozy bot. 399 00:26:07,220 --> 00:26:08,400 Zeus bot. 400 00:26:09,780 --> 00:26:13,240 So even for the first upper block, 401 00:26:13,420 --> 00:26:15,200 it's all zebot. 402 00:26:15,600 --> 00:26:17,280 And then even the second block, 403 00:26:17,440 --> 00:26:18,140 it's all zebot. 404 00:26:18,400 --> 00:26:22,480 So a total of all these 26, 405 00:26:23,020 --> 00:26:25,200 these are all zebot instance. 406 00:26:29,620 --> 00:26:32,540 And because there are some zebot variants, 407 00:26:34,160 --> 00:26:37,100 instead of only believing in these antivirus, 408 00:26:37,380 --> 00:26:38,380 we actually try to use them. 409 00:26:38,400 --> 00:26:40,340 We actually do manual inspection by our own. 410 00:26:40,580 --> 00:26:46,920 We try to double check these are really zebot malware instance. 411 00:26:47,260 --> 00:26:49,220 And then we try to find their versions 412 00:26:49,220 --> 00:26:52,980 so that we can tell which variants they are. 413 00:26:53,580 --> 00:26:56,400 And there are actually some different bot command 414 00:26:56,400 --> 00:26:58,960 in these different zebot binaries. 415 00:26:59,200 --> 00:27:01,100 So you can tell there are different versions. 416 00:27:01,600 --> 00:27:04,760 So for version one, it has these commands. 417 00:27:05,080 --> 00:27:05,780 For version two, 418 00:27:05,780 --> 00:27:08,280 it has another set of commands. 419 00:27:13,640 --> 00:27:15,440 So after our manual inspection, 420 00:27:15,840 --> 00:27:20,000 we are able to identify different zebot variants. 421 00:27:20,640 --> 00:27:22,840 So the upper three blocks 422 00:27:22,840 --> 00:27:26,780 all belong to version two, zebot. 423 00:27:27,560 --> 00:27:30,080 And then the one on the bottom 424 00:27:30,620 --> 00:27:33,480 are actually zebot version one. 425 00:27:42,360 --> 00:27:43,120 And then the one on the bottom is version two. 426 00:27:43,120 --> 00:27:45,220 So based on our experimental results, 427 00:27:45,520 --> 00:27:48,520 you see that out of 408 malware instance, 428 00:27:49,580 --> 00:27:54,960 we manually identify there are 52 zebot malware instance. 429 00:27:55,760 --> 00:27:58,740 And then among these 52 malware instance, 430 00:27:58,940 --> 00:28:00,240 zebot malware instance, 431 00:28:00,460 --> 00:28:02,720 they can be clustered into four groups. 432 00:28:03,760 --> 00:28:06,140 One group is V1 variant, 433 00:28:06,420 --> 00:28:08,500 and then three groups are V2 variants. 434 00:28:09,420 --> 00:28:12,100 When we compare these clustering results 435 00:28:12,420 --> 00:28:13,900 against antivirus results, 436 00:28:14,240 --> 00:28:16,440 they actually match with each other. 437 00:28:17,000 --> 00:28:19,640 So our malware clustering 438 00:28:21,440 --> 00:28:25,240 have the same accuracy as the antivirus. 439 00:28:27,660 --> 00:28:29,980 While these antivirus tools, 440 00:28:29,980 --> 00:28:33,260 they are only able to identify 26 of them. 441 00:28:33,440 --> 00:28:38,080 While we can automatically cluster the all 52 instance. 442 00:28:40,420 --> 00:28:42,360 So even though we don't have signatures, 443 00:28:43,020 --> 00:28:45,100 because we know how to cluster them, 444 00:28:45,540 --> 00:28:47,160 their colors tend to be similar. 445 00:28:47,360 --> 00:28:48,940 Their colors tend to be similar. 446 00:28:49,140 --> 00:28:50,660 Then we are able to say that, 447 00:28:50,720 --> 00:28:54,060 okay, these malware binary are actually a zebot family. 448 00:29:03,460 --> 00:29:06,860 And then in that big block, 449 00:29:07,140 --> 00:29:08,940 we only look at the first block, right? 450 00:29:09,060 --> 00:29:12,240 So there are other blocks in that pictures. 451 00:29:12,700 --> 00:29:14,940 There are also other malware families, 452 00:29:15,200 --> 00:29:17,180 including the Undo families, 453 00:29:17,660 --> 00:29:20,240 and also the Bagel families. 454 00:29:20,540 --> 00:29:22,720 Also a very famous malware. 455 00:29:24,940 --> 00:29:27,280 So these malware instance, 456 00:29:27,420 --> 00:29:29,240 they also tend to be very similar. 457 00:29:29,240 --> 00:29:31,440 They have the same color patterns. 458 00:29:35,000 --> 00:29:36,840 So the conclusion is that, 459 00:29:36,900 --> 00:29:38,200 as you can see, 460 00:29:38,680 --> 00:29:43,400 the traditional hooking-based monitor approach 461 00:29:43,400 --> 00:29:48,260 already cannot handle the modern advanced malwares. 462 00:29:48,440 --> 00:29:50,700 Because these modern advanced malwares, 463 00:29:50,760 --> 00:29:56,300 they know how to do a lot of anti-malwares techniques, 464 00:29:56,640 --> 00:29:59,160 including a lot of techniques we mentioned. 465 00:29:59,240 --> 00:30:00,520 In previous slides. 466 00:30:01,020 --> 00:30:02,200 So instead, 467 00:30:02,420 --> 00:30:04,760 our approach is to do forensics 468 00:30:04,760 --> 00:30:07,740 after the malware already has been executed. 469 00:30:08,680 --> 00:30:11,520 So we only need a snapshot of the environment. 470 00:30:12,700 --> 00:30:16,100 And the experimental results also justify that. 471 00:30:16,500 --> 00:30:19,420 Because of our runtime forensics, 472 00:30:19,580 --> 00:30:22,580 we are able to collect a lot of significant features. 473 00:30:22,900 --> 00:30:27,220 These significant features help us to do automatic clustering of malware. 474 00:30:27,520 --> 00:30:29,200 So it also helps us to, 475 00:30:29,240 --> 00:30:31,340 to identify even unknown malwares. 476 00:30:31,480 --> 00:30:35,100 Because we are able to cluster them into the groups 477 00:30:35,100 --> 00:30:36,780 that they are more alike with. 478 00:30:39,060 --> 00:30:40,880 So that will end our talk. 479 00:30:41,400 --> 00:30:44,620 And if you have any questions, 480 00:30:44,800 --> 00:30:47,640 you actually can also write emails to us. 481 00:30:59,240 --> 00:30:59,260 So it's really, really helpful. 482 00:30:59,260 --> 00:31:01,080 if you try to emulate a, 483 00:31:01,100 --> 00:31:04,520 what would be a normal PC running in a normal version of Windows, 484 00:31:04,860 --> 00:31:10,040 what would be a special way that we have to run this on for post analysis? 485 00:31:10,480 --> 00:31:13,000 Yeah, surprisingly, actually a normal PC. 486 00:31:13,620 --> 00:31:14,060 Yeah. 487 00:31:14,720 --> 00:31:15,640 But can you, 488 00:31:15,880 --> 00:31:16,880 is it something that, 489 00:31:16,960 --> 00:31:20,740 like, this is a production PC that has whatever software load on it, 490 00:31:20,820 --> 00:31:21,920 you can just load it via, 491 00:31:22,400 --> 00:31:24,960 you'll take it on an after you can fetch it into malware? 492 00:31:25,200 --> 00:31:25,540 Yes. 493 00:31:25,720 --> 00:31:28,160 And how long does it take to do that type of thing? 494 00:31:28,160 --> 00:31:30,060 Presumably, it connects to your back end. 495 00:31:30,580 --> 00:31:31,060 What's the, 496 00:31:31,220 --> 00:31:33,260 what sends it out to your back end for? 497 00:31:33,460 --> 00:31:33,820 Yeah. 498 00:31:34,300 --> 00:31:35,200 On average, 499 00:31:35,340 --> 00:31:38,140 we try to limit that into less than 30 minutes. 500 00:31:38,540 --> 00:31:39,820 Can you repeat this question again? 501 00:31:40,140 --> 00:31:40,620 Yeah. 502 00:31:41,740 --> 00:31:42,220 So, 503 00:31:42,400 --> 00:31:45,640 he actually asked whether we use a normal PC or not, 504 00:31:45,780 --> 00:31:46,820 or an emulator environment. 505 00:31:47,360 --> 00:31:49,440 Our answer is that we use a regular PC. 506 00:31:49,800 --> 00:31:51,100 Because as we mentioned, 507 00:31:51,220 --> 00:31:52,800 there are so many anti-VM, 508 00:31:52,980 --> 00:31:56,160 anti-emulator techniques malware can use. 509 00:31:56,480 --> 00:31:57,320 And normally, 510 00:31:57,460 --> 00:31:58,140 for us, 511 00:31:58,160 --> 00:32:00,700 to restart all these regular PC boot up 512 00:32:00,700 --> 00:32:02,840 until we finish all these forensics, 513 00:32:02,980 --> 00:32:04,640 it takes less than 30 minutes. 514 00:32:05,920 --> 00:32:06,480 Yeah. 515 00:32:06,720 --> 00:32:08,540 How are you taking a snapshot? 516 00:32:08,900 --> 00:32:09,160 Like, 517 00:32:10,020 --> 00:32:12,860 are you running your boot before and then after, 518 00:32:12,900 --> 00:32:15,840 or how are you taking it? 519 00:32:16,060 --> 00:32:16,560 Yeah. 520 00:32:16,640 --> 00:32:18,080 So, we're taking a snapshot. 521 00:32:18,840 --> 00:32:20,920 After the malware already executed, 522 00:32:21,180 --> 00:32:24,120 we try to execute our binary. 523 00:32:25,160 --> 00:32:27,080 So, we try to launch our program. 524 00:32:28,160 --> 00:32:29,120 So, how do you get the difference? 525 00:32:29,540 --> 00:32:33,940 Like, what was the state of the machine first, 526 00:32:34,080 --> 00:32:36,280 and then after from the malware? 527 00:32:36,500 --> 00:32:38,780 So, then after we launch our program, 528 00:32:38,920 --> 00:32:41,640 we will look for all those three significant features 529 00:32:41,640 --> 00:32:42,200 we mentioned. 530 00:32:42,500 --> 00:32:45,760 So, we started this startup keys, 531 00:32:46,080 --> 00:32:47,560 all these installation files, 532 00:32:47,960 --> 00:32:49,260 all these memory layouts, 533 00:32:49,560 --> 00:32:51,480 and all these suspicious behaviors. 534 00:32:55,180 --> 00:32:55,740 Yeah. 535 00:32:55,740 --> 00:32:56,600 . 536 00:33:01,280 --> 00:33:04,180 It's still on a very early stage of prototype. 537 00:33:04,700 --> 00:33:04,800 Yeah. 538 00:33:04,980 --> 00:33:07,040 And we try to make it more mature 539 00:33:07,040 --> 00:33:09,180 so that we can release to the community. 540 00:33:11,520 --> 00:33:12,040 Yes? 541 00:33:12,620 --> 00:33:13,140 . 542 00:33:15,200 --> 00:33:15,720 Yeah. 543 00:33:16,160 --> 00:33:16,680 . 544 00:33:21,220 --> 00:33:22,140 And then we have, 545 00:33:22,580 --> 00:33:24,240 that's why we have to restart it. 546 00:33:25,060 --> 00:33:25,580 Yeah. 547 00:33:28,680 --> 00:33:29,200 . 548 00:33:30,180 --> 00:33:30,700 . 549 00:33:32,060 --> 00:33:32,580 . 550 00:33:38,220 --> 00:33:39,320 Yeah, it's possible. 551 00:33:39,660 --> 00:33:43,000 This is why all these kind of forensic tools, 552 00:33:43,300 --> 00:33:46,040 they have to stay anonymous 553 00:33:46,740 --> 00:33:47,880 so that they cannot be, 554 00:33:48,020 --> 00:33:49,800 become one of the blacklist. 555 00:33:50,260 --> 00:33:52,200 Yeah, once you make it into a product, 556 00:33:52,280 --> 00:33:54,380 then they will try to stop you right away. 557 00:33:54,380 --> 00:33:56,040 When you try to install it. 558 00:33:58,240 --> 00:33:58,800 . 559 00:33:59,600 --> 00:34:00,160 Yes? 560 00:34:01,860 --> 00:34:02,420 . 561 00:34:04,920 --> 00:34:05,480 . 562 00:34:16,180 --> 00:34:17,660 Yes, definitely, yeah. 563 00:34:18,160 --> 00:34:18,720 . 564 00:34:19,360 --> 00:34:19,640 Yes. 565 00:34:20,900 --> 00:34:21,460 . 566 00:34:22,020 --> 00:34:22,460 . 567 00:34:23,520 --> 00:34:23,960 Yes. 568 00:34:24,240 --> 00:34:24,680 . 569 00:34:25,860 --> 00:34:26,300 . 570 00:34:26,300 --> 00:34:27,620 Yeah, we will try to make it public 571 00:34:27,620 --> 00:34:30,460 because we are still in a rush to finalizing it. 572 00:34:35,440 --> 00:34:37,040 Okay, thank you very much. 573 00:34:37,200 --> 00:34:38,700 And then if you have any feedbacks, 574 00:34:38,700 --> 00:34:40,700 we welcome you to write us. 575 00:34:41,180 --> 00:34:41,800 Thank you. 576 00:34:42,940 --> 00:34:44,820 See you DEF CON 19.