1 00:00:00,000 --> 00:00:07,160 Everybody in a good mood? I'm like a lie this is Matt Richard you can call him Matt or 2 00:00:07,160 --> 00:00:13,920 Richard because he has two first names so it doesn't really matter. So our talk today is 3 00:00:13,920 --> 00:00:18,340 about it's called making fun of your malware and here's what we're going to try to do. So not 4 00:00:18,340 --> 00:00:22,360 all guys that write code are really good at it and people make a lot of mistakes. Not all guys 5 00:00:22,360 --> 00:00:26,360 who use malicious code are actually good at operating it so we got a little bit of that in 6 00:00:26,360 --> 00:00:31,220 there too. And then there are people who just completely fail at both. So sit back relax. We 7 00:00:31,220 --> 00:00:35,220 may not be funny so just in case we included actual technical material just in case you want 8 00:00:35,220 --> 00:00:39,260 to learn something too so if we're not funny at least enjoy you know some little tidbits of tech 9 00:00:39,260 --> 00:00:45,080 talk. So the real quick disclaimer is these opinions are our opinions and nothing in here is 10 00:00:45,080 --> 00:00:52,040 that of our employers standard disclaimer. Don't hold us liable. All right so this first one 11 00:00:52,040 --> 00:00:56,200 is called Honey I Shrunk the Entropy and it's the story of silent banker authors 12 00:00:56,200 --> 00:01:00,960 who developed this very complex encryption algorithm and then forgot to seed the random 13 00:01:00,960 --> 00:01:12,260 number generator. So this code over there is a snippet from Zeus from September 2007 and you 14 00:01:12,260 --> 00:01:19,060 can see that it is seeding a random seeding that global variable called DD tick count. It first 15 00:01:19,060 --> 00:01:24,660 moves it into the EAX register the first time that this function is called and then it checks 16 00:01:24,660 --> 00:01:25,980 that value to see if it's zero. 17 00:01:26,200 --> 00:01:32,940 And if it's not zero it calls get tick count to seed it. We weren't surprised when we saw a 18 00:01:32,940 --> 00:01:39,480 similar resemblance in a silent banker binary from February 2008. And you can see the 19 00:01:39,480 --> 00:01:44,760 resemblance here. It has a similarly named global variable called DD tick count that gets checked 20 00:01:44,760 --> 00:01:53,040 if it's zero or not. If it's not zero it gets seeded with the value of get tick count. And uh at 21 00:01:53,040 --> 00:01:56,180 first before uh I saw the MSV seeding I was like oh my god I'm gonna have to do this again. So I 22 00:01:57,680 --> 00:02:03,440 thought maybe there was a link between the Zeus authors and the silent banker authors just based on 23 00:02:03,440 --> 00:02:09,260 those few hex numbers that are uh hard coded into the binary. But really uh they both just 24 00:02:09,260 --> 00:02:18,160 statically linked with MSV CRT. So now we get to the recipe for disaster. This uh snippet of code 25 00:02:18,160 --> 00:02:24,080 is from silent banker in July 2008 so just a few months after that last sample we saw in February. 26 00:02:24,080 --> 00:02:29,960 So they updated their code sent out a new version of silent banker and this one is significantly 27 00:02:29,960 --> 00:02:36,020 different from the ones that we saw previously because you don't see that global variable uh 28 00:02:36,020 --> 00:02:42,880 named current seed in this case being checked if it's ever zero and seeded. It's just used. So it's 29 00:02:42,880 --> 00:02:48,520 possible that somewhere else in the binary before we get here silent banker seeds uh this global 30 00:02:48,520 --> 00:02:53,900 variable with some type of number. So I'm gonna skip over here to the disassembly. 31 00:02:54,440 --> 00:03:00,020 Here's that same function. Let's just check if current seed is used anywhere else in the program 32 00:03:00,020 --> 00:03:08,020 before it gets used in this rand function. You can see it initially starts out as zero. And we'll 33 00:03:08,020 --> 00:03:14,220 check the cross references to that variable. Based on this T column right here the W means 34 00:03:14,220 --> 00:03:20,140 write. There's only one write operation to that global variable throughout the entire binary. And 35 00:03:20,140 --> 00:03:21,700 it is the rand function itself. 36 00:03:26,080 --> 00:03:31,000 So I'm gonna skip through this one just a bit fast. I talked about this briefly at uh DEF CON last 37 00:03:31,000 --> 00:03:38,640 year. The recipe for disaster is to seed the random number generator that's uh fairly gray up on 38 00:03:38,640 --> 00:03:44,320 there because I wanted to indicate that they didn't do it. The next step is that they make 1,000 39 00:03:44,320 --> 00:03:49,740 calls to that my rand function and generate a 16 byte number uh which is the primary encryption 40 00:03:49,740 --> 00:03:54,060 key. And then they take that 16 byte number and they run a new one called my rand. And then they 41 00:03:54,080 --> 00:03:59,100 compute an 8 byte number using a particular formula. Then they generate another 8 byte 42 00:03:59,100 --> 00:04:04,740 number from the secondary key. And then they use some arbitrary precision math to explode 43 00:04:04,740 --> 00:04:13,160 that 8 byte tertiary key into a 32 byte number. Finally, they encrypt the stolen data, 44 00:04:13,340 --> 00:04:19,380 usernames, passwords, what have you, using the original 16 byte key. But they don't 45 00:04:19,380 --> 00:04:25,260 trance, they don't transmit that 16 byte key with the stolen data when they send it to the 46 00:04:25,260 --> 00:04:29,600 drop site. Because that would be kind of transmitting the key with the encrypted message. 47 00:04:29,780 --> 00:04:34,020 Not a very good idea. So instead the silent banker authors transmitted that 32 byte number 48 00:04:34,020 --> 00:04:39,280 instead. And on their side they've got a program that converts this 32 byte number back into the 49 00:04:39,280 --> 00:04:45,360 16 byte primary key. But we don't have that program. So recipe to exploit the disaster. 50 00:04:45,840 --> 00:04:48,960 Number one, we start with seeding the random number generator. 51 00:04:49,380 --> 00:04:55,420 Two zero. Those next four steps, we can all automate with a Python script for immunity 52 00:04:55,420 --> 00:05:01,500 debugger. Because we have the formula that computes that 16 byte key, the 8 byte key, the 53 00:05:01,500 --> 00:05:06,980 next 8 byte key, and the 32 byte key. We have that formula. It's not in C code, but we have it 54 00:05:06,980 --> 00:05:12,620 because we have a copy of the silent banker binary that does it. So that Python script, I'm 55 00:05:12,620 --> 00:05:18,620 gonna show you a demo of how it works in just a second. When we're done, we should have a good 56 00:05:18,620 --> 00:05:19,280 disaster recovery. 57 00:05:31,480 --> 00:05:37,180 So here, I've got silent banker and immunity debugger. I'm attached to Internet Explorer, which 58 00:05:37,180 --> 00:05:41,060 is where silent banker runs. And I've marked the four functions that generate the encryption 59 00:05:41,060 --> 00:05:48,080 keys. And I plug in that Python script that I showed on the last slide. I invoke it by typing 60 00:05:48,080 --> 00:05:49,360 bang Keegan. And I'm gonna show you how that works. And I'm gonna show you how that works. And 61 00:05:50,580 --> 00:05:54,920 you can see that the debugger will just play through those few functions that I want to execute 62 00:05:55,420 --> 00:06:00,260 about five times for this demo. But in real life, we did it about 5,000 times to get a larger set 63 00:06:00,260 --> 00:06:06,640 of keys. You can see on the log pane here that for each iteration of the loop, it outputs a 16 64 00:06:06,640 --> 00:06:13,140 byte primary key here. And then the associated 32 byte key. So at the same time that this script 65 00:06:13,140 --> 00:06:19,360 is printing information to the log data, it's also creating a text, a file on disk. And then the 66 00:06:19,380 --> 00:06:28,700 other key here that has the associated 16 and 32 byte keys here. So it's just a hex file. So we can 67 00:06:28,700 --> 00:06:35,960 go and use a Python script that we wrote that accepts that keys file. And also a directory of logs 68 00:06:35,960 --> 00:06:40,760 that we recovered from the stolen, from the command and control site. So here we have a few 69 00:06:41,540 --> 00:06:49,000 encrypted private key certificates and a few .txt files which contain the encrypted data. And we can 70 00:06:49,000 --> 00:06:54,060 just run this program. And it's searching through each of these text files, extracting that 32 71 00:06:54,060 --> 00:07:00,300 byte key, looking through the key file that I have and pairing that 32 bit number with its original 72 00:07:00,300 --> 00:07:09,000 16 byte key. And then it goes ahead and decrypts the information once it finds the 16 byte key. So 73 00:07:09,000 --> 00:07:15,640 this is the original .txt file. You can tell it's obviously not readable. And then the output is a 74 00:07:15,640 --> 00:07:18,980 bunch of .tmp files which are in fact readable. And we can take that out and run it from the 75 00:07:19,000 --> 00:07:21,500 information and then go return it to the rightful owners. 76 00:07:22,760 --> 00:07:26,420 So all the complex work that silent banker authors went 77 00:07:26,420 --> 00:07:29,020 through to keep their information protected is just 78 00:07:29,020 --> 00:07:31,180 completely ruined because they forgot to see the random 79 00:07:31,180 --> 00:07:31,700 number generator. 80 00:07:35,820 --> 00:07:43,100 Now the best part about this is this function here in the 81 00:07:43,100 --> 00:07:43,820 silent banker binary. 82 00:07:44,660 --> 00:07:46,540 I've named it why not use this. 83 00:07:47,500 --> 00:07:50,600 So they've actually got a function in here that uses get 84 00:07:50,600 --> 00:07:54,680 current get cursor position to generate entropy and uses that 85 00:07:54,680 --> 00:07:59,500 to seed a random number generator and we can check the 86 00:07:59,500 --> 00:08:02,560 cross references to this function here and see that it's 87 00:08:02,560 --> 00:08:04,680 used about 10 or 15 other places in the code. 88 00:08:05,700 --> 00:08:08,380 So it's not that the silent banker authors forgot to write 89 00:08:08,380 --> 00:08:11,060 code that was capable of seeding a random number 90 00:08:11,060 --> 00:08:14,340 generator they just simply forgot to call this function 91 00:08:14,340 --> 00:08:16,260 from their encryption routines. 92 00:08:16,900 --> 00:08:18,500 It's there, they just forgot to use it. 93 00:08:18,800 --> 00:08:19,980 So we thought that was pretty funny. 94 00:08:23,040 --> 00:08:24,220 And there's the one that got away. 95 00:08:24,360 --> 00:08:25,280 It's there, why not use it? 96 00:08:26,980 --> 00:08:29,700 So the next one is called to DES or not to DES. 97 00:08:30,420 --> 00:08:33,960 And this is a story about a malware author who either 98 00:08:33,960 --> 00:08:36,720 doesn't know how to use the Windows API appropriately or 99 00:08:36,720 --> 00:08:38,900 doesn't know the maximum size of a DES key. 100 00:08:41,780 --> 00:08:46,520 So for the crypt derived key API function, the crypt 101 00:08:46,540 --> 00:08:50,920 used the DW flags parameter, the high order, I'm sorry, the 102 00:08:50,920 --> 00:08:54,540 low order two bytes of this specify the key size that you 103 00:08:54,540 --> 00:08:55,940 want for your encryption key. 104 00:08:56,780 --> 00:09:03,760 So here if the low bytes are 0080 then the encryption key 105 00:09:03,760 --> 00:09:07,300 that we're asking is 128 bit RC4 key. 106 00:09:09,940 --> 00:09:11,900 Now this is how to shoot yourself in the foot. 107 00:09:12,740 --> 00:09:15,820 And I'm going to go to the disassembly for this one as 108 00:09:15,820 --> 00:09:15,940 well. 109 00:09:16,720 --> 00:09:19,900 Here is a function called initialize crypto subsystem. 110 00:09:21,200 --> 00:09:24,560 And you can see the Trojan calling crypt acquire context. 111 00:09:26,100 --> 00:09:28,760 And then it's creating a container for an MD5 hash. 112 00:09:30,580 --> 00:09:33,900 And then it's creating an MD5 hash of a hard coded password 113 00:09:33,900 --> 00:09:34,480 in the binary. 114 00:09:34,720 --> 00:09:37,600 And it's trying to use the output of that hashing 115 00:09:37,600 --> 00:09:42,060 function to generate a 128 bit DES key. 116 00:09:43,160 --> 00:09:45,620 Which obviously will fail because there's no such thing 117 00:09:45,620 --> 00:09:46,520 as a 128 bit. 118 00:09:46,540 --> 00:09:51,920 So if any of those API functions fail, it follows this jump to 119 00:09:51,920 --> 00:09:53,540 what I've labeled cannot derive key. 120 00:09:54,740 --> 00:09:58,120 And that location is right here where it moves the value that 121 00:09:58,120 --> 00:10:02,120 is in EBP, which is zero at the time, into this Boolean 122 00:10:02,120 --> 00:10:04,920 value called BU's MS crypto API. 123 00:10:05,620 --> 00:10:09,480 Now to see what type of effect this has at runtime, we have to 124 00:10:09,480 --> 00:10:12,540 follow this structure member and see where else it's used in the 125 00:10:12,540 --> 00:10:12,780 program. 126 00:10:13,300 --> 00:10:16,420 What different behavior does the Trojan exhibit? 127 00:10:16,540 --> 00:10:18,200 If this is true or if it's false. 128 00:10:21,560 --> 00:10:25,340 So in the function that I've named encrypt data, we can see 129 00:10:25,340 --> 00:10:26,860 that Boolean value being checked. 130 00:10:27,920 --> 00:10:31,520 And if it's true, then it comes over here to this side, where it 131 00:10:31,520 --> 00:10:34,980 uses DES encryption and the crypt encrypt Microsoft API. 132 00:10:36,360 --> 00:10:41,080 However, if that value is zero, which as we know will always be 133 00:10:41,080 --> 00:10:44,400 zero, it comes over here and defaults to XOR. 134 00:10:45,560 --> 00:10:46,520 So, I'm going to show you how that works. 135 00:10:46,540 --> 00:10:49,780 I was just a little curious, at what point in time did the malware 136 00:10:49,780 --> 00:10:51,880 author decide to make a backup of this? 137 00:10:52,480 --> 00:10:56,180 Was he getting pressure from people above that he needed to 138 00:10:56,180 --> 00:10:57,920 push some malware out the door? 139 00:10:58,080 --> 00:11:00,680 And then at the last minute he realized that his DES wasn't 140 00:11:00,680 --> 00:11:02,040 working, so he threw in some XOR? 141 00:11:03,200 --> 00:11:05,380 I'm not sure, but it's pretty funny. 142 00:11:06,020 --> 00:11:08,220 So always make backups is the moral of that story. 143 00:11:09,600 --> 00:11:11,840 The next one is called you did what with what? 144 00:11:13,320 --> 00:11:16,460 And I was trying to think of a term. 145 00:11:16,540 --> 00:11:19,740 A term that described the way CoreFlood's encryption worked, and I 146 00:11:19,740 --> 00:11:21,440 came up with location-dependent encryption. 147 00:11:22,220 --> 00:11:25,380 And I wondered, hmm, has somebody else already written a paper about 148 00:11:25,380 --> 00:11:25,580 this? 149 00:11:25,680 --> 00:11:26,740 Maybe I can Google for it. 150 00:11:27,700 --> 00:11:30,460 And I Googled for that, and I found a hit on the U.S. 151 00:11:30,460 --> 00:11:34,220 patent website where someone has actually submitted a patent for 152 00:11:34,220 --> 00:11:36,280 something called location-dependent encryption. 153 00:11:36,760 --> 00:11:38,360 And this diagram is pretty meaningless. 154 00:11:38,460 --> 00:11:40,760 I wouldn't recommend staring at it too long. 155 00:11:41,080 --> 00:11:45,800 But basically the way that it works is I send you a message, an 156 00:11:45,800 --> 00:11:46,480 encrypted message. 157 00:11:46,540 --> 00:11:51,580 And in order to read it, you have to take your GPS device and travel to the exact 158 00:11:51,580 --> 00:11:54,980 longitude and latitude that I specified when I encrypted the data. 159 00:11:56,840 --> 00:12:01,080 So normally there's that security and convenience tradeoff, and this one has neither. 160 00:12:04,720 --> 00:12:06,380 So it's definitely not secure. 161 00:12:06,500 --> 00:12:10,340 And in order to read a message, you have to travel somewhere that I specify. 162 00:12:10,860 --> 00:12:15,760 So I was joking with Matt earlier saying that if you find yourself in a flame war on an 163 00:12:15,760 --> 00:12:16,300 e-mail thread. 164 00:12:16,300 --> 00:12:21,140 And you really want to get rid of somebody, just encrypt a message to them and make it only 165 00:12:21,140 --> 00:12:24,600 readable from, like, Iraq, and then there will never be a problem. 166 00:12:25,860 --> 00:12:31,100 So the way that this fits into CoreFlood is their patent-pended method here. 167 00:12:31,740 --> 00:12:37,900 This is a snippet of the code where CoreFlood, after it steals information from the user, it 168 00:12:37,900 --> 00:12:42,200 will encrypt it and write it to disk so that the Trojan can then retrieve it later and upload it 169 00:12:42,200 --> 00:12:43,580 to its command and control site. 170 00:12:44,140 --> 00:12:45,660 So it calls set file pointer. 171 00:12:46,400 --> 00:12:53,580 And the return value of set file pointer is a D word, which specifies the offset in the file that 172 00:12:53,580 --> 00:12:55,540 the pointer was set to if it succeeded. 173 00:12:57,680 --> 00:13:02,780 So then it takes the number of bytes to encrypt and moves it into the ECX register. 174 00:13:03,700 --> 00:13:07,900 And it takes a pointer to the data to encrypt and moves it into the EDX register. 175 00:13:08,680 --> 00:13:15,720 And then it ensues with this XOR loop here, where it XORs every byte in the buffer with AL and AH, 176 00:13:15,720 --> 00:13:20,360 which are the high and low order bytes returned from set file pointer. 177 00:13:20,540 --> 00:13:27,700 So the actual encryption key in this scheme is the offset in the file where the data exists. 178 00:13:29,180 --> 00:13:29,680 Brilliant. 179 00:13:31,080 --> 00:13:32,520 So how to dump Core? 180 00:13:33,020 --> 00:13:39,400 This is a program that I wrote and just released fairly recently, and you can download it. 181 00:13:39,440 --> 00:13:41,140 It's got the entire source code there. 182 00:13:41,980 --> 00:13:45,700 And it's helpful if you encounter a machine that has been infected with CoreFlood. 183 00:13:45,720 --> 00:13:51,280 And for some reason it wasn't able to reach its command and control server in order to upload the data. 184 00:13:51,420 --> 00:13:58,040 So you can actually go and retrieve those files that it has on disk and decrypt them using this tool 185 00:13:58,040 --> 00:14:02,360 to figure out what would have gotten stolen if you need to report it to a customer or anything. 186 00:14:03,040 --> 00:14:10,180 So the other interesting part about CoreFlood is, albeit it has that encryption algorithm, kind of weak, 187 00:14:10,320 --> 00:14:15,240 but then it goes and transmits all its configuration information, what information to steal, 188 00:14:15,720 --> 00:14:19,120 all its target information, which banks, which credit unions to steal information from, 189 00:14:19,260 --> 00:14:20,800 transmits all that in the clear. 190 00:14:20,980 --> 00:14:25,220 So another method of dumping Core is just using Wireshark and viewing the traffic. 191 00:14:31,500 --> 00:14:39,340 So here, the way that CoreFlood works is it's a DLL that gets injected into Internet Explorer and Explorer. 192 00:14:40,340 --> 00:14:44,940 And there are various ways to inject a code or a DLL into a process. 193 00:14:45,720 --> 00:14:46,340 There are several of them. 194 00:14:46,620 --> 00:14:53,360 And the important part for a stealthy malware author is, number one, does the method require a change to the registry? 195 00:14:53,980 --> 00:14:57,900 Number two, does it require me to reboot my computer before the change takes effect? 196 00:14:58,320 --> 00:15:02,640 And number three, does it require the application that I'm injecting code into to restart? 197 00:15:03,700 --> 00:15:07,360 So there are several options here available to malware authors. 198 00:15:07,580 --> 00:15:09,400 And which one does CoreFlood choose? 199 00:15:10,180 --> 00:15:13,440 They chose one that requires modification to the registry. 200 00:15:13,880 --> 00:15:15,700 And they chose one that requires modification to the registry. 201 00:15:15,700 --> 00:15:17,260 And they chose one that requires modification to the registry. 202 00:15:17,260 --> 00:15:19,420 And in this case, the application is Explorer. 203 00:15:23,460 --> 00:15:24,720 Quietly, so no one hears. 204 00:15:25,360 --> 00:15:34,000 This is the code that we reverse engineered showing where CoreFlood chooses to manually terminate Explorer 205 00:15:34,000 --> 00:15:35,860 so that the change takes effect immediately. 206 00:15:36,660 --> 00:15:40,200 Now, you're probably familiar with what happens if Explorer crashes on your machine. 207 00:15:40,480 --> 00:15:41,660 Your taskbar disappears. 208 00:15:42,080 --> 00:15:43,800 Your open applications disappear. 209 00:15:43,980 --> 00:15:45,360 All your desktop icons disappear. 210 00:15:45,700 --> 00:15:47,740 And then slowly, one by one, they start to come back. 211 00:15:49,220 --> 00:15:55,020 So the CoreFlood authors obviously knew that because they went in here and they made a call to set error mode 212 00:15:55,020 --> 00:15:58,300 right before calling open process and terminate process. 213 00:15:58,760 --> 00:16:04,680 So what set error mode does is it prevents particular crash notifications being sent to the system 214 00:16:05,200 --> 00:16:07,580 which would then create a small pop-up box. 215 00:16:07,720 --> 00:16:10,660 And it sends the error message to the terminating application instead. 216 00:16:11,980 --> 00:16:14,600 So all that they've done with this call to set error mode 217 00:16:14,600 --> 00:16:20,260 is prevented a small pop-up box from being shown to the user before Explorer crashes. 218 00:16:20,520 --> 00:16:23,920 So you tell me, which one is more suspicious to a user? 219 00:16:24,120 --> 00:16:28,440 A small pop-up box followed by everything disappearing and then reappearing 220 00:16:28,440 --> 00:16:31,720 or everything disappearing and then reappearing? 221 00:16:32,940 --> 00:16:33,500 Both? 222 00:16:37,860 --> 00:16:43,520 So CoreFlood, when it loads its DLL, it doesn't stay loaded in the loaded modules list. 223 00:16:43,520 --> 00:16:49,080 It allocates some memory on the heap and copies itself to the location on the heap. 224 00:16:49,460 --> 00:16:51,260 And then it deletes its PE header. 225 00:16:51,700 --> 00:16:54,660 So if you encounter a machine that's infected with CoreFlood 226 00:16:54,660 --> 00:16:57,580 and you say, okay, the next step is to dump this executable 227 00:16:57,580 --> 00:16:59,800 then I can maybe load it in IDA and I can analyze it. 228 00:16:59,960 --> 00:17:03,940 Well, it's pretty hard to dump an executable if there is no PE header. 229 00:17:04,920 --> 00:17:08,600 So on top of that, CoreFlood, when it calls virtual alloc, 230 00:17:08,800 --> 00:17:13,380 it specifies the mem top down flag which causes the system to return 231 00:17:13,520 --> 00:17:18,060 an address, the highest available address rather than the lowest available address. 232 00:17:18,320 --> 00:17:21,160 And it causes CoreFlood to then be able to, quote unquote, 233 00:17:21,280 --> 00:17:26,500 hide in the higher regions of user mode memory around all the system DLLs. 234 00:17:28,140 --> 00:17:31,520 So this next demo is how to make all that hiding useless. 235 00:17:31,860 --> 00:17:35,660 And when you encounter something like CoreFlood that has a few hiding techniques 236 00:17:35,660 --> 00:17:40,120 and there aren't available tools to help you, you have to create your own tools. 237 00:17:40,880 --> 00:17:42,740 If you're familiar with unpacking, 238 00:17:43,520 --> 00:17:47,500 what you normally do is use a debugger if there isn't an automated unpacker. 239 00:17:47,560 --> 00:17:50,740 For CoreFlood, there isn't because it's not a common algorithm. 240 00:17:50,980 --> 00:17:54,900 But you might use a debugger and go to the original entry point 241 00:17:54,900 --> 00:17:59,680 and then maybe dump it with Lord PE or ProcDump or another process dumping utility. 242 00:18:00,380 --> 00:18:03,480 And then you might fix the imports with Import Reconstructor. 243 00:18:03,620 --> 00:18:08,100 And then finally, after all that work, you might have a binary, an IDB, 244 00:18:08,160 --> 00:18:09,340 that you can open and examine. 245 00:18:10,360 --> 00:18:13,220 So this next demo is a tool 246 00:18:13,520 --> 00:18:14,460 that I wrote recently. 247 00:18:14,660 --> 00:18:18,260 It's not publicly released yet because I haven't actually finished it. 248 00:18:20,100 --> 00:18:22,580 But it's a plug-in for the volatility platform. 249 00:18:26,880 --> 00:18:31,380 And right now, I'm connected to Internet Explorer in a debugger. 250 00:18:34,080 --> 00:18:36,020 And since I know where to find CoreFlood, 251 00:18:36,120 --> 00:18:39,720 I'll show you where it is just for purposes of the beginning of this demo. 252 00:18:39,920 --> 00:18:41,020 So here it is right here, 253 00:18:41,080 --> 00:18:43,500 hiding in memory at 7FF80. 254 00:18:43,520 --> 00:18:44,100 8100. 255 00:18:45,900 --> 00:18:49,580 We can double-click on that to see the actual hex data there. 256 00:18:51,180 --> 00:18:54,260 And we can verify that it's CoreFlood based on some strings that we see. 257 00:18:58,860 --> 00:19:00,200 So the next step... 258 00:19:00,940 --> 00:19:02,900 Sorry, it's a little hard to read, 259 00:19:02,960 --> 00:19:04,620 but I'm going to make these demos available. 260 00:19:04,840 --> 00:19:06,540 You can download them and play them on your own machine 261 00:19:06,540 --> 00:19:07,460 where you have better resolution. 262 00:19:08,360 --> 00:19:11,880 Behind the scenes, I took a memory dump of that system infected with CoreFlood. 263 00:19:12,240 --> 00:19:13,500 And I'm analyzing it now. 264 00:19:13,520 --> 00:19:14,120 With volatility. 265 00:19:14,540 --> 00:19:16,680 And first, I'm printing a process list 266 00:19:16,680 --> 00:19:19,160 so I can find out the PID of Internet Explorer. 267 00:19:19,640 --> 00:19:22,440 And right here, it's telling me that the PID is 1732. 268 00:19:23,900 --> 00:19:26,480 So what I'll do next is use the malfind plug-in, 269 00:19:26,560 --> 00:19:29,220 which searches the virtual address descriptors, 270 00:19:29,700 --> 00:19:33,840 which contain similar information to what the memory map in the debugger contains, 271 00:19:34,080 --> 00:19:36,260 all the allocated memory regions in the process. 272 00:19:36,860 --> 00:19:38,700 And for each allocated memory region, 273 00:19:38,740 --> 00:19:40,460 it checks the VAD tags and the permissions 274 00:19:40,460 --> 00:19:42,160 to see if there's executable code there. 275 00:19:42,160 --> 00:19:44,860 And if it is, it'll try to disassemble it 276 00:19:45,720 --> 00:19:49,680 so that you can, instead of attaching to it with the debugger 277 00:19:49,680 --> 00:19:50,820 and searching through the memory map, 278 00:19:51,020 --> 00:19:52,240 all this is is one step. 279 00:19:52,480 --> 00:19:56,740 And you can see that malfind has located some executable code 280 00:19:56,740 --> 00:19:59,340 identified by the proper disassembly here 281 00:19:59,980 --> 00:20:02,260 at 7FF80000. 282 00:20:02,940 --> 00:20:08,540 So naturally, the next step is to use this new plug-in. 283 00:20:08,600 --> 00:20:09,580 It's called FixIAT. 284 00:20:10,600 --> 00:20:12,140 And I give it a process list. 285 00:20:12,160 --> 00:20:14,820 I give it a process context, PID 1732 for Internet Explorer. 286 00:20:16,280 --> 00:20:19,740 And I specify the start of that memory range 287 00:20:19,740 --> 00:20:21,220 where core flood is hiding. 288 00:20:22,360 --> 00:20:23,760 And what the plug-in does 289 00:20:23,760 --> 00:20:27,800 is it enumerates all the loaded DLLs in Internet Explorer's memory, 290 00:20:28,000 --> 00:20:30,320 along with its base address and size. 291 00:20:30,780 --> 00:20:33,880 And then it parses the export table to find the RBAs 292 00:20:33,880 --> 00:20:37,060 of the exported functions from those modules, and it saves them. 293 00:20:38,160 --> 00:20:41,120 And then it disassembles all of the information 294 00:20:41,120 --> 00:20:45,020 starting at that memory region at 7FF80000, 295 00:20:45,200 --> 00:20:49,040 looking for calls that lead to any of those exported functions. 296 00:20:49,340 --> 00:20:51,400 And that's how it rebuilds the import address table 297 00:20:51,400 --> 00:20:52,760 without even having a PE header. 298 00:20:54,740 --> 00:20:57,500 And you can see that the output of this 299 00:20:57,500 --> 00:20:59,420 will be something similar to Import Reconstructor. 300 00:20:59,540 --> 00:21:01,480 You have the modules, the first func, 301 00:21:01,540 --> 00:21:03,240 and each imported function from the modules. 302 00:21:06,960 --> 00:21:09,400 And the output of this FixIAT script 303 00:21:09,400 --> 00:21:14,520 is an executable that you can open in a PE Viewer 304 00:21:14,520 --> 00:21:18,200 and see that the import table is successfully reconstructed. 305 00:21:18,760 --> 00:21:21,000 And you can further verify by just taking that 306 00:21:21,000 --> 00:21:22,380 and loading it into IDA. 307 00:21:24,960 --> 00:21:25,960 Everything looks right. 308 00:21:26,100 --> 00:21:28,720 In the import address table, we can then go and follow the cross references 309 00:21:29,660 --> 00:21:31,400 to set file pointer in this case. 310 00:21:31,580 --> 00:21:33,420 And there we are exactly at that point 311 00:21:33,420 --> 00:21:35,400 of the location-dependent encryption code. 312 00:21:36,440 --> 00:21:38,460 So in just a few commands, 313 00:21:40,040 --> 00:21:42,020 with volatility on the memory dump, 314 00:21:42,200 --> 00:21:45,740 we located where core flood was hiding in memory, 315 00:21:47,040 --> 00:21:48,920 we disassembled it, extracted it, 316 00:21:48,980 --> 00:21:50,560 pasted a PE header onto it, 317 00:21:50,620 --> 00:21:51,940 even though it didn't have one, 318 00:21:52,060 --> 00:21:53,940 and then completely rebuilt the import address table. 319 00:21:54,220 --> 00:21:55,820 And it only took about 20 seconds. 320 00:22:00,240 --> 00:22:02,040 So the next one is called Honey. 321 00:22:02,260 --> 00:22:04,260 Sorry to bother you again, I shrunk the internet. 322 00:22:05,640 --> 00:22:06,940 And this is a story about 323 00:22:06,940 --> 00:22:09,280 Configure.B's flawed IP generation. 324 00:22:11,820 --> 00:22:14,900 So we're going back to the Windows RAND function here. 325 00:22:15,600 --> 00:22:17,960 And the important part about this function 326 00:22:17,960 --> 00:22:19,320 is the very last instruction 327 00:22:19,320 --> 00:22:21,500 where it performs an AND 328 00:22:21,500 --> 00:22:23,480 of whatever value is in EAX 329 00:22:23,480 --> 00:22:25,240 with 7FFF. 330 00:22:27,060 --> 00:22:29,120 So if you're not familiar with assembly 331 00:22:29,120 --> 00:22:32,500 and what that instruction might do, 332 00:22:32,760 --> 00:22:34,240 then here's a small demo. 333 00:22:34,580 --> 00:22:37,700 We're moving the maximum value that EAX can hold 334 00:22:37,700 --> 00:22:38,980 into the register here, 335 00:22:39,060 --> 00:22:39,380 and then we're going to move the maximum value 336 00:22:39,400 --> 00:22:41,180 and then executing that AND instruction. 337 00:22:41,620 --> 00:22:43,020 And you can see it chops off 338 00:22:43,020 --> 00:22:45,120 that upper half of the value 339 00:22:45,120 --> 00:22:46,700 and then subtracts one. 340 00:22:47,660 --> 00:22:49,400 7FFF is 32768, 341 00:22:50,360 --> 00:22:52,160 also known as RANDMAX, 342 00:22:52,360 --> 00:22:53,940 defined in the Windows source code. 343 00:22:55,300 --> 00:22:57,180 So apparently the Configure authors 344 00:22:57,180 --> 00:22:58,800 weren't aware of this limitation 345 00:22:58,800 --> 00:23:01,100 that calling Windows RAND doesn't 346 00:23:01,100 --> 00:23:03,420 return an integer of that size 347 00:23:03,420 --> 00:23:04,100 that they wanted. 348 00:23:04,260 --> 00:23:06,800 It chops it down to be 349 00:23:07,400 --> 00:23:09,340 no greater than 7FFF. 350 00:23:09,400 --> 00:23:11,440 So that one byte right there, 351 00:23:11,520 --> 00:23:12,060 the 7F, 352 00:23:12,640 --> 00:23:14,520 will never be greater than, 353 00:23:14,760 --> 00:23:16,020 well, 7F. 354 00:23:16,480 --> 00:23:18,820 It will never be 80 or anything like that. 355 00:23:20,120 --> 00:23:21,300 So now we get to 356 00:23:21,300 --> 00:23:23,380 the code in Configure 357 00:23:23,380 --> 00:23:24,380 on the left hand side 358 00:23:24,900 --> 00:23:27,400 where it shows one call to RAND 359 00:23:31,100 --> 00:23:33,420 initiates the first and second 360 00:23:33,420 --> 00:23:34,940 octets of the IP address 361 00:23:34,940 --> 00:23:35,800 that it's going to scan 362 00:23:35,800 --> 00:23:37,840 with what it gets back from RAND. 363 00:23:39,400 --> 00:23:40,840 RAND initializes the third 364 00:23:40,840 --> 00:23:42,700 and the fourth octets of the IP address. 365 00:23:43,580 --> 00:23:45,440 But two of those octets 366 00:23:45,440 --> 00:23:47,480 are never going to be greater than 7F. 367 00:23:47,720 --> 00:23:49,200 So there's a large portion 368 00:23:49,200 --> 00:23:50,780 of the internet that Configure.b 369 00:23:50,780 --> 00:23:52,320 is not capable of scanning 370 00:23:52,320 --> 00:23:53,140 using this algorithm. 371 00:23:54,580 --> 00:23:56,080 Over here on the right hand side 372 00:23:56,080 --> 00:23:57,800 is some source code that shows exactly 373 00:23:57,800 --> 00:23:59,400 what the assembly is doing right here. 374 00:24:00,640 --> 00:24:01,540 It's hard to read, 375 00:24:01,600 --> 00:24:03,360 but the code is online 376 00:24:05,020 --> 00:24:06,580 for you to see if you're interested. 377 00:24:07,060 --> 00:24:09,380 Here's a link to the tool down there at the bottom. 378 00:24:11,660 --> 00:24:13,800 So what's the big deal behind this? 379 00:24:13,940 --> 00:24:15,420 Big thanks to Brandon Enright 380 00:24:15,420 --> 00:24:16,500 who made this awesome diagram. 381 00:24:16,760 --> 00:24:18,120 It's called a Hilbert curve diagram. 382 00:24:18,960 --> 00:24:20,960 And I'm going to jump out to the 383 00:24:22,720 --> 00:24:23,900 larger version of this 384 00:24:23,900 --> 00:24:25,060 so you can see it a little bit better. 385 00:24:26,160 --> 00:24:27,340 But the blue color 386 00:24:27,340 --> 00:24:28,300 in this diagram 387 00:24:30,140 --> 00:24:31,380 shows IP address 388 00:24:31,380 --> 00:24:33,260 ranges that Configure.b 389 00:24:33,260 --> 00:24:34,880 is simply not capable of scanning 390 00:24:35,220 --> 00:24:36,380 using that flawed algorithm. 391 00:24:37,500 --> 00:24:38,860 The red code 392 00:24:39,940 --> 00:24:40,420 shows 393 00:24:40,420 --> 00:24:42,200 what you can scan. 394 00:24:43,600 --> 00:24:44,880 And as you can see, 395 00:24:44,900 --> 00:24:47,240 this color in the larger 396 00:24:47,240 --> 00:24:48,680 view of it right here 397 00:24:48,680 --> 00:24:50,380 is not actually red, it's purple. 398 00:24:50,620 --> 00:24:51,820 You don't see the red 399 00:24:51,820 --> 00:24:54,140 until you zoom in a little closer 400 00:24:54,140 --> 00:24:55,720 to one of the particular netblocks. 401 00:24:57,780 --> 00:24:59,060 And then you can start seeing 402 00:24:59,060 --> 00:24:59,620 a bit of red. 403 00:24:59,880 --> 00:25:01,240 But even in that red 404 00:25:01,240 --> 00:25:04,440 for each slash 16 netblock here 405 00:25:04,440 --> 00:25:06,280 there's still a significant amount of blue 406 00:25:06,280 --> 00:25:08,300 that Configure.b 407 00:25:11,000 --> 00:25:12,460 So that's pretty interesting. 408 00:25:12,600 --> 00:25:13,640 A lot of people think that 409 00:25:13,640 --> 00:25:15,140 there were some great minds behind 410 00:25:15,140 --> 00:25:16,700 Configure and maybe there were. 411 00:25:17,300 --> 00:25:19,140 But they weren't aware of the limitation 412 00:25:19,140 --> 00:25:21,060 that Windows RAND provided. 413 00:25:24,200 --> 00:25:27,420 So going back to those guys 414 00:25:27,420 --> 00:25:28,880 who just really aren't that good operators. 415 00:25:29,100 --> 00:25:30,380 So in the cybercrime world 416 00:25:30,380 --> 00:25:31,680 it's kind of like a dog-eat-dog world. 417 00:25:31,860 --> 00:25:33,920 So you know, no honor among thieves. 418 00:25:34,100 --> 00:25:35,540 So we're going to talk a little bit about the NeoSploit crew. 419 00:25:35,940 --> 00:25:37,360 They basically made this attack toolkit. 420 00:25:39,400 --> 00:25:40,300 We're going to take a cache, now we're going to dash. 421 00:25:41,700 --> 00:25:43,660 So NeoSploit is a web attack toolkit. 422 00:25:43,920 --> 00:25:44,340 So basically 423 00:25:45,340 --> 00:25:46,860 cybercrime fellows would buy this toolkit 424 00:25:46,860 --> 00:25:48,220 and they'd set it up on a web server. 425 00:25:48,480 --> 00:25:49,880 People would go to that web server 426 00:25:49,880 --> 00:25:52,540 they have a whole bunch of exploits they would trigger 427 00:25:52,540 --> 00:25:53,800 download their code. 428 00:25:54,000 --> 00:25:55,660 So basically this is kind of like a script kitty type 429 00:25:55,660 --> 00:25:57,560 roll your own exploit kit. 430 00:25:58,060 --> 00:25:59,380 So the NeoSploit guys were probably 431 00:25:59,380 --> 00:26:01,160 one of the most advanced groups out there. 432 00:26:01,360 --> 00:26:04,080 They were definitely very good on the business side. 433 00:26:04,220 --> 00:26:05,840 They wanted to protect their investments and their time. 434 00:26:05,980 --> 00:26:07,840 So they wrote all the code in C. 435 00:26:09,400 --> 00:26:10,960 Or some other flaky web app. 436 00:26:11,740 --> 00:26:13,400 They wrote it all in C as a CGI. 437 00:26:14,280 --> 00:26:15,920 So they would give each of their customers 438 00:26:15,920 --> 00:26:17,500 a binary distribution that would have 439 00:26:17,500 --> 00:26:18,500 this whole kit in it. 440 00:26:18,880 --> 00:26:20,760 And also in the underground world 441 00:26:20,760 --> 00:26:23,240 they were very worried about people going and ripping off the exploits. 442 00:26:23,300 --> 00:26:25,200 Like literally just copying and pasting the exploits 443 00:26:25,200 --> 00:26:26,520 and making a whole new kit out of it. 444 00:26:26,760 --> 00:26:28,020 And that's kind of rampant in the underground. 445 00:26:29,020 --> 00:26:31,480 There's 40, 50, 60 different web attack kits 446 00:26:31,480 --> 00:26:32,860 and they're all just ripped off from each other 447 00:26:32,860 --> 00:26:33,920 copy and paste exploits. 448 00:26:34,020 --> 00:26:35,920 So the NeoSploit guys were a little bit smarter. 449 00:26:36,020 --> 00:26:37,440 They thought they were going to encrypt it inside. 450 00:26:39,400 --> 00:26:40,500 The server shows you they actually have a key file. 451 00:26:40,680 --> 00:26:42,080 So this is a fully licensed distribution. 452 00:26:42,440 --> 00:26:43,340 They would actually distribute a key 453 00:26:43,340 --> 00:26:46,100 and do a bunch of IP checks on the server hosting it. 454 00:26:47,660 --> 00:26:49,140 So they had a lot of really good customers. 455 00:26:49,320 --> 00:26:51,020 I don't doubt they made tons of money. 456 00:26:51,180 --> 00:26:53,120 They had customers, the TorPig group 457 00:26:53,120 --> 00:26:54,740 if anyone's ever heard of the Master Boot Record 458 00:26:55,340 --> 00:26:56,440 Rootkit or TorPig. 459 00:26:56,660 --> 00:26:58,040 They were one of their biggest customers. 460 00:26:58,180 --> 00:27:00,340 They had tons and tons of other customers as well. 461 00:27:01,160 --> 00:27:02,920 So they were really out protecting their investment. 462 00:27:03,400 --> 00:27:06,340 They had version 3 was really their big build. 463 00:27:06,560 --> 00:27:07,980 And that was released sometime in 2008. 464 00:27:08,200 --> 00:27:09,380 And we'll go into more of that story later. 465 00:27:09,400 --> 00:27:11,400 But needless to say they were really, 466 00:27:11,460 --> 00:27:12,760 really worried about piracy. 467 00:27:13,300 --> 00:27:15,200 So there was definitely a lot of FUD that went along 468 00:27:15,200 --> 00:27:16,040 with NeoSploit. 469 00:27:16,360 --> 00:27:17,880 NeoSploit was in the media quite a bit. 470 00:27:18,020 --> 00:27:19,160 And there were people who said, oh, 471 00:27:19,300 --> 00:27:20,900 NeoSploit's just copied all over the place 472 00:27:20,900 --> 00:27:21,720 and NeoSploit's this. 473 00:27:21,860 --> 00:27:24,160 So needless to say we'll go into some of the disassembly 474 00:27:24,160 --> 00:27:25,400 and show a little bit of how it works. 475 00:27:26,900 --> 00:27:28,740 So the first funny thing they did is 476 00:27:28,740 --> 00:27:32,440 so they'd had this kit around since April of 2008 477 00:27:32,440 --> 00:27:33,620 and then July 2008. 478 00:27:33,980 --> 00:27:35,920 They pretty much decided that, you know, 479 00:27:35,940 --> 00:27:38,140 we're really not interested in supporting this anymore. 480 00:27:39,400 --> 00:27:40,280 We're adding new exploits. 481 00:27:40,380 --> 00:27:41,420 And we've already got your money. 482 00:27:41,520 --> 00:27:42,500 You've already paid your subscription. 483 00:27:42,740 --> 00:27:44,360 So see ya. 484 00:27:44,860 --> 00:27:47,460 So they just basically dropped a note on their website 485 00:27:47,460 --> 00:27:49,120 and told all their customers that, sorry, 486 00:27:49,620 --> 00:27:51,420 it's been fun, but we're out of here. 487 00:27:53,400 --> 00:27:54,320 Then they were just kidding. 488 00:27:54,580 --> 00:27:57,200 So then in August 2008 they came back 489 00:27:57,200 --> 00:27:58,560 and they actually released a whole new version 490 00:27:58,560 --> 00:28:00,300 and they started redistributing it to some of their 491 00:28:00,300 --> 00:28:01,980 better customers, but not everybody. 492 00:28:02,180 --> 00:28:03,600 So they still screwed a lot of people. 493 00:28:03,960 --> 00:28:05,700 All those people who originally paid for it 494 00:28:05,700 --> 00:28:06,500 still didn't get updates. 495 00:28:09,620 --> 00:28:11,000 And getting people to pay for it. 496 00:28:11,020 --> 00:28:12,160 And they added a whole bunch of new exploits 497 00:28:12,160 --> 00:28:13,080 and did a lot of new work. 498 00:28:14,420 --> 00:28:17,440 And then they decided, yeah, no, we're really serious. 499 00:28:17,560 --> 00:28:18,940 We're gonna stop and we're just gonna keep 500 00:28:18,940 --> 00:28:20,160 that extra money you just gave us too. 501 00:28:20,240 --> 00:28:21,260 So now you're all screwed. 502 00:28:23,400 --> 00:28:24,960 So going into a little bit of Neosploits, 503 00:28:24,960 --> 00:28:26,560 it was kind of a cool attack kit. 504 00:28:26,660 --> 00:28:27,440 So like I was mentioning before, 505 00:28:27,600 --> 00:28:28,660 they were really worried about piracy 506 00:28:28,660 --> 00:28:30,060 and people ripping off exploits 507 00:28:30,060 --> 00:28:32,680 and copying and pasting them into new kits. 508 00:28:32,840 --> 00:28:34,860 So what they did is they took each exploit 509 00:28:34,860 --> 00:28:36,900 and within this CGI file they would basically 510 00:28:39,400 --> 00:28:40,400 easily rip down. 511 00:28:42,140 --> 00:28:43,300 So, of course, 512 00:28:43,320 --> 00:28:45,360 for those who were still thinking 513 00:28:45,360 --> 00:28:47,280 from the other slide from the media 514 00:28:47,280 --> 00:28:49,360 that these exploit kits are sometimes just copied 515 00:28:49,360 --> 00:28:51,240 and pasted, binaries are not the same 516 00:28:51,240 --> 00:28:52,920 as PHP scripts, they're a little bit different. 517 00:28:54,840 --> 00:28:56,440 And there was a famous quote 518 00:28:57,860 --> 00:28:59,500 on Neosploit that was in a blog 519 00:28:59,500 --> 00:29:01,520 that said, anyone can introduce new exploits 520 00:29:01,520 --> 00:29:02,080 for this kit. 521 00:29:02,700 --> 00:29:03,640 It's kind of hard. 522 00:29:03,800 --> 00:29:05,720 So this is the whole reason for this part of the talk 523 00:29:05,720 --> 00:29:07,560 is I said, I wonder how hard it really is. 524 00:29:09,720 --> 00:29:11,780 So what they do for each exploit, 525 00:29:12,680 --> 00:29:14,080 there's a code segment 526 00:29:14,080 --> 00:29:15,860 that loads the blob 527 00:29:15,860 --> 00:29:18,140 of the encoded exploit. 528 00:29:19,000 --> 00:29:20,200 It's a three byte key, 529 00:29:20,320 --> 00:29:21,000 it decodes it, 530 00:29:21,060 --> 00:29:21,860 runs through the whole loop 531 00:29:21,860 --> 00:29:24,220 and then serves that up to the user every time. 532 00:29:24,360 --> 00:29:25,460 So even if you were to go through memory, 533 00:29:25,620 --> 00:29:27,200 it's still even kind of tricky to dump memory 534 00:29:27,200 --> 00:29:28,640 and get all the exploits because it's clearing out 535 00:29:28,640 --> 00:29:29,660 these buffers each time. 536 00:29:31,200 --> 00:29:33,520 So luckily, if you did want to just copy and paste 537 00:29:33,520 --> 00:29:34,620 these exploits, there is an answer. 538 00:29:34,620 --> 00:29:35,820 So IDA scripting is 539 00:29:35,820 --> 00:29:39,080 a very powerful feature with scripting. 540 00:29:39,140 --> 00:29:40,360 So you can basically just write a little script 541 00:29:40,360 --> 00:29:42,140 that goes through, finds all these blobs, 542 00:29:42,480 --> 00:29:44,800 looks for all calls to the decode function, 543 00:29:45,400 --> 00:29:46,160 grabs the blob, 544 00:29:46,880 --> 00:29:47,760 decodes it with the XOR, 545 00:29:47,920 --> 00:29:48,740 and then dumps it out. 546 00:29:48,900 --> 00:29:51,040 So this would probably be one of the ways, 547 00:29:51,120 --> 00:29:53,260 or you could write your own custom small application 548 00:29:53,260 --> 00:29:55,200 that did it, but if you were going to go in 549 00:29:55,200 --> 00:29:56,380 and add new exploits to Neosploit, 550 00:29:56,440 --> 00:29:57,800 this is probably the way you'd have to do it 551 00:29:57,800 --> 00:29:58,960 is something along these lines. 552 00:30:00,300 --> 00:30:02,980 And of course, once you dump it out, then you've got the whole plain text 553 00:30:04,620 --> 00:30:05,000 to do other things. 554 00:30:05,180 --> 00:30:07,340 So the Neosploit guys probably just gave it up 555 00:30:07,340 --> 00:30:08,900 because it was some good money 556 00:30:08,900 --> 00:30:10,820 and they really didn't care about their customers. 557 00:30:12,460 --> 00:30:14,820 So for anyone who's ever heard the words 558 00:30:14,820 --> 00:30:16,680 of the great philosopher Biggie Smalls, 559 00:30:16,700 --> 00:30:17,820 he has a song called 560 00:30:17,820 --> 00:30:19,320 The Ten Crack Commandments. 561 00:30:19,420 --> 00:30:22,200 Very, very strong wisdom if anyone's a crack dealer. 562 00:30:22,360 --> 00:30:23,520 I highly recommend it. 563 00:30:24,780 --> 00:30:25,760 So number four, 564 00:30:26,020 --> 00:30:28,080 he's got out of the ten crack commands, 565 00:30:28,220 --> 00:30:30,460 number four is never get high on your own supply. 566 00:30:30,820 --> 00:30:31,440 Very important. 567 00:30:31,620 --> 00:30:33,340 You really don't want to be a crack head selling crack. 568 00:30:34,620 --> 00:30:36,020 So we came across this guy, 569 00:30:36,160 --> 00:30:37,140 I call him the peeper. 570 00:30:37,460 --> 00:30:39,700 So he was distributing malicious code, 571 00:30:39,900 --> 00:30:41,240 we'll walk through that in a second, 572 00:30:41,360 --> 00:30:43,700 but basically he didn't listen to this song. 573 00:30:44,220 --> 00:30:46,100 So his attack went something like this. 574 00:30:46,160 --> 00:30:47,180 He would send out these emails 575 00:30:48,180 --> 00:30:50,060 disguised as various government agencies, 576 00:30:50,100 --> 00:30:51,060 official looking emails, 577 00:30:51,260 --> 00:30:53,360 addressing people by name, dear so and so, 578 00:30:53,560 --> 00:30:55,520 the FTC has lodged a complaint against your company, 579 00:30:55,660 --> 00:30:57,260 click here to download this document 580 00:30:57,260 --> 00:30:58,540 that describes the whole thing. 581 00:30:59,560 --> 00:31:01,920 So when the user opens up that particular document 582 00:31:01,920 --> 00:31:04,000 they would get this, it's a real word doc, 583 00:31:04,620 --> 00:31:06,900 inside of it, a very clever feature of Word, 584 00:31:07,000 --> 00:31:08,000 which is basically OLE, 585 00:31:08,200 --> 00:31:10,440 that allows you to just drag and drop executables 586 00:31:10,440 --> 00:31:12,700 inside a Word document and then rename them 587 00:31:12,700 --> 00:31:13,880 so that they say something like 588 00:31:13,880 --> 00:31:15,540 Microsoft Word has encountered an error, 589 00:31:15,660 --> 00:31:16,940 please double click here to continue. 590 00:31:18,220 --> 00:31:19,400 Yeah, completely brilliant. 591 00:31:19,740 --> 00:31:21,120 So he was using this, 592 00:31:21,200 --> 00:31:22,240 and people would still click through, 593 00:31:22,320 --> 00:31:24,940 it takes like six clicks to go from getting this message 594 00:31:24,940 --> 00:31:25,900 to actually being infected, 595 00:31:26,000 --> 00:31:27,240 and he had tons of victims, 596 00:31:27,380 --> 00:31:29,300 so people are really brilliant when it comes to that. 597 00:31:30,080 --> 00:31:31,660 You know, and I love his message too, 598 00:31:34,620 --> 00:31:37,240 so the next thing we found as we were tracking this guy down 599 00:31:37,240 --> 00:31:38,760 is if you're gonna have a drop site, 600 00:31:39,860 --> 00:31:41,420 maybe he didn't have his own management tool, 601 00:31:41,540 --> 00:31:42,820 so maybe he thought open directories were good, 602 00:31:42,920 --> 00:31:44,520 but open directories are bad if you're storing 603 00:31:44,520 --> 00:31:45,760 a lot of information about people, 604 00:31:45,940 --> 00:31:46,920 so he definitely had the whole, 605 00:31:47,320 --> 00:31:49,360 every server that he would configure for his drop site 606 00:31:49,360 --> 00:31:50,880 had an open directory and he could just go through 607 00:31:50,880 --> 00:31:52,720 and browse all the listings of all of his victims 608 00:31:52,720 --> 00:31:54,220 and see each and every one of them, 609 00:31:54,340 --> 00:31:57,100 and oddly enough, he was, 610 00:31:57,720 --> 00:31:59,340 in one sense he was a good developer, 611 00:31:59,440 --> 00:32:01,180 so he liked to QA his code. 612 00:32:01,660 --> 00:32:03,980 The downside was is he was QAing his code 613 00:32:04,620 --> 00:32:06,440 on the actual server using his real IP, 614 00:32:06,680 --> 00:32:08,560 so you don't last long 615 00:32:08,560 --> 00:32:09,620 when you do things like that, 616 00:32:09,720 --> 00:32:12,440 so he actually had his DSL connection 617 00:32:13,600 --> 00:32:14,380 from the Ukraine, 618 00:32:14,600 --> 00:32:15,720 he would test all of his code, 619 00:32:16,200 --> 00:32:18,260 and the malware had a nice feature called 620 00:32:18,260 --> 00:32:19,920 watch me, or watch him, 621 00:32:20,080 --> 00:32:21,860 so basically the whole point of this guy 622 00:32:21,860 --> 00:32:23,000 is he was stealing banking credentials, 623 00:32:23,140 --> 00:32:25,780 but sometimes he just wanted to watch his victims 624 00:32:25,780 --> 00:32:27,040 and just sort of see what they were doing, 625 00:32:27,120 --> 00:32:28,380 hence the reason we call him the peeper, 626 00:32:28,460 --> 00:32:32,200 so he wasn't satisfied just to have that kind of functionality, 627 00:32:32,420 --> 00:32:34,020 he started to watch himself, 628 00:32:35,240 --> 00:32:36,040 kind of odd, 629 00:32:36,100 --> 00:32:37,660 so I don't know if anyone has ever opened up 630 00:32:37,660 --> 00:32:39,180 a VNC window on your own machine 631 00:32:39,180 --> 00:32:41,140 that has VNC running and loops back 632 00:32:41,140 --> 00:32:42,700 and starts to see smaller and smaller images, 633 00:32:42,900 --> 00:32:44,980 he actually did that to himself multiple times, 634 00:32:45,660 --> 00:32:47,620 on multiple drop servers, 635 00:32:47,860 --> 00:32:48,960 yeah, really, really odd, 636 00:32:49,160 --> 00:32:50,420 and he would go through this 637 00:32:50,420 --> 00:32:51,780 and we'd be looking through the drop servers 638 00:32:51,780 --> 00:32:53,720 and oh, there's a picture of him watching himself, 639 00:32:53,920 --> 00:32:55,680 watching himself, watching himself, 640 00:32:58,420 --> 00:33:00,660 and then the one that really takes the cake, 641 00:33:00,740 --> 00:33:02,180 my favorite of all that we found 642 00:33:02,180 --> 00:33:03,400 that he had done to himself, 643 00:33:04,620 --> 00:33:05,940 he was using this watch me feature on himself 644 00:33:05,940 --> 00:33:07,640 while he's developing the code, 645 00:33:08,140 --> 00:33:10,140 so he's actually got his dev environment up 646 00:33:10,140 --> 00:33:11,200 and he's actually writing code, 647 00:33:11,400 --> 00:33:13,360 watching himself sending it all back 648 00:33:13,360 --> 00:33:14,320 to the command and control, 649 00:33:15,460 --> 00:33:17,920 so there's nothing that helps the authorities 650 00:33:17,920 --> 00:33:19,800 when they bust down your door and kick it in 651 00:33:19,800 --> 00:33:21,080 and come running in and grab your machine 652 00:33:21,080 --> 00:33:22,400 when you've got the source code there 653 00:33:22,400 --> 00:33:25,020 and they can go and match it up on a command and control server 654 00:33:25,020 --> 00:33:26,780 and see that they're exactly the same thing, 655 00:33:27,560 --> 00:33:28,300 not too bright. 656 00:33:29,660 --> 00:33:31,460 So the last piece of malware we've got 657 00:33:31,460 --> 00:33:33,520 is an interesting one you might be familiar with, 658 00:33:34,620 --> 00:33:34,660 the Internet Explorer 7. 659 00:33:37,780 --> 00:33:38,780 So don't worry, 660 00:33:39,020 --> 00:33:40,300 it's all under control, 661 00:33:40,480 --> 00:33:41,640 Microsoft's taking care of it, 662 00:33:41,700 --> 00:33:42,940 let's not get too worked up. 663 00:33:43,140 --> 00:33:45,540 So Microsoft had a big problem with IE6 664 00:33:45,540 --> 00:33:47,880 and that was that it was way too easy 665 00:33:47,880 --> 00:33:48,980 to steal stored passwords, 666 00:33:49,160 --> 00:33:50,360 so you're probably familiar with, 667 00:33:50,460 --> 00:33:51,580 you go to a website that says, 668 00:33:51,600 --> 00:33:52,780 do you want to save this password, 669 00:33:52,900 --> 00:33:54,500 they call it IntelliForms and you say yes 670 00:33:54,500 --> 00:33:55,560 and it stores it in the registry, 671 00:33:55,940 --> 00:33:57,400 well the problem with Internet Explorer 6 672 00:33:57,400 --> 00:33:59,820 was any user logged in with the, 673 00:34:04,620 --> 00:34:05,620 there was literally no protection, 674 00:34:05,960 --> 00:34:08,620 so for malware if it was running in the context of the user, 675 00:34:08,740 --> 00:34:10,200 it could literally just read those passwords 676 00:34:10,200 --> 00:34:11,240 and send them back off. 677 00:34:11,620 --> 00:34:14,060 So in IE7 they came up with a brilliant fix, 678 00:34:14,380 --> 00:34:15,520 they encrypted it, 679 00:34:15,600 --> 00:34:17,280 with 128 bit encryption, 680 00:34:18,560 --> 00:34:19,420 unbreakable, brilliant. 681 00:34:19,700 --> 00:34:21,400 So if you look on the bottom you can see 682 00:34:21,920 --> 00:34:24,500 there's a hash of a website 683 00:34:24,500 --> 00:34:25,540 that I'll explain later on 684 00:34:25,540 --> 00:34:27,540 and then a binary blob that contains 685 00:34:27,540 --> 00:34:28,700 the username and password, 686 00:34:28,860 --> 00:34:31,100 so it seemed to actually be a fairly reasonable solution. 687 00:34:32,300 --> 00:34:34,460 So I want to quote from another great philosopher, 688 00:34:34,620 --> 00:34:36,720 John Travolta from the movie Swordfish, 689 00:34:36,920 --> 00:34:38,720 and my favorite part is when he's sitting there 690 00:34:38,720 --> 00:34:40,140 and he's explaining to the other guy 691 00:34:40,140 --> 00:34:41,560 and he says, this encryption is so good 692 00:34:41,560 --> 00:34:42,580 even I can't break it, 693 00:34:42,580 --> 00:34:44,440 and I think he mentions like the 512 bit encryption, 694 00:34:44,800 --> 00:34:46,500 because he's like the best cryptographer in the world 695 00:34:46,500 --> 00:34:47,360 that's why they hired him, 696 00:34:47,400 --> 00:34:48,720 so he's like, even I can't do this. 697 00:34:49,840 --> 00:34:51,280 So here's what Microsoft did. 698 00:34:54,000 --> 00:34:55,420 They, to encrypt the password, 699 00:34:55,600 --> 00:34:57,640 they would generate a 128 bit key 700 00:34:58,020 --> 00:34:59,980 based off the MD5 of the site 701 00:34:59,980 --> 00:35:01,660 that they were storing the password for. 702 00:35:02,280 --> 00:35:04,320 So that actually seems like a fairly reasonable thing. 703 00:35:04,620 --> 00:35:06,960 So if you went to www.bank.com 704 00:35:06,960 --> 00:35:08,200 slash login.asp 705 00:35:08,880 --> 00:35:10,800 what they would do is they would take that string 706 00:35:10,800 --> 00:35:13,460 they would make it all lower case 707 00:35:13,460 --> 00:35:14,860 then they would make it a wide string 708 00:35:14,860 --> 00:35:16,220 and then basically MD5 that. 709 00:35:16,720 --> 00:35:18,620 And that was then the key that was used 710 00:35:18,620 --> 00:35:20,620 to encrypt the password and the registry 711 00:35:20,620 --> 00:35:21,180 and the username. 712 00:35:21,720 --> 00:35:23,840 And then, when you visited the site 713 00:35:23,840 --> 00:35:25,100 that it had a stored password for, 714 00:35:25,160 --> 00:35:25,720 it would do the opposite. 715 00:35:25,940 --> 00:35:27,360 It would take the site you just visited, 716 00:35:27,540 --> 00:35:29,460 it would chop it down, normalize it, 717 00:35:29,500 --> 00:35:31,280 convert it to a wide string, and then look through the registry 718 00:35:34,620 --> 00:35:36,140 so it seems fairly reasonable. 719 00:35:36,560 --> 00:35:37,900 Except if you think about it, 720 00:35:38,500 --> 00:35:39,380 there's a little problem. 721 00:35:39,820 --> 00:35:41,400 That's actually not very much entropy. 722 00:35:41,560 --> 00:35:42,840 It's kind of easy. 723 00:35:43,860 --> 00:35:46,420 It's really not that much harder than IE6 724 00:35:46,420 --> 00:35:47,760 password encryption was. 725 00:35:47,940 --> 00:35:49,900 So, in order to break it, 726 00:35:49,940 --> 00:35:50,880 it's fairly straightforward. 727 00:35:51,460 --> 00:35:53,520 If a user is storing a username and password, 728 00:35:53,800 --> 00:35:55,700 chances are it's because it's a site they go to. 729 00:35:55,920 --> 00:35:57,320 And if it's a site they go to, 730 00:35:57,400 --> 00:35:59,460 chances are it's a site that you can easily find 731 00:35:59,460 --> 00:36:02,120 in index.dat or the typed URL's registry key. 732 00:36:03,320 --> 00:36:04,460 So that part's pretty easy. 733 00:36:04,620 --> 00:36:06,200 So, another easy way to find them is, 734 00:36:06,260 --> 00:36:08,280 if you're talking about U.S. victims, 735 00:36:08,460 --> 00:36:10,600 there's only 15,000 banks and credit unions 736 00:36:10,600 --> 00:36:11,340 in the U.S. 737 00:36:11,520 --> 00:36:14,140 And each one of those only has a handful of login pages. 738 00:36:14,320 --> 00:36:16,120 So it's fairly trivial to go out and scrape them all 739 00:36:16,120 --> 00:36:17,460 and to gather a collection of those. 740 00:36:17,620 --> 00:36:19,440 So, again, not really much protection. 741 00:36:20,300 --> 00:36:21,500 And then, of course, if you're a bad guy, 742 00:36:21,600 --> 00:36:24,380 you probably know a lot of the sites that you want passwords for, 743 00:36:24,480 --> 00:36:26,340 whether it's Facebook or MySpace or Twitter 744 00:36:26,340 --> 00:36:28,200 or whatever it happens to be, and you know the login page. 745 00:36:28,280 --> 00:36:29,740 So, again, you can just pre-compute those. 746 00:36:30,280 --> 00:36:32,180 And then if you really get desperate, Alexa keeps 747 00:36:32,180 --> 00:36:34,440 tabs of popular sites, and you can just grab those. 748 00:36:35,000 --> 00:36:36,700 So it's really easy to decrypt these. 749 00:36:36,720 --> 00:36:38,520 You can do something like basically create a rainbow table 750 00:36:38,520 --> 00:36:39,580 out of all these common sources, 751 00:36:39,860 --> 00:36:41,920 and then you've basically got all the keys 752 00:36:41,920 --> 00:36:43,080 to decrypt all the passwords. 753 00:36:43,420 --> 00:36:45,160 So for the bad guys, it's fairly straightforward. 754 00:36:45,500 --> 00:36:48,280 So the moral of the story for IE7 is 755 00:36:49,180 --> 00:36:50,140 it's not looking good. 756 00:36:50,780 --> 00:36:51,820 But maybe there's help. 757 00:36:53,060 --> 00:36:53,860 Or there's not. 758 00:36:54,260 --> 00:36:56,480 So nobody really does a good job with this. 759 00:36:57,700 --> 00:36:59,040 Actually, Michael and I looked at 760 00:36:59,040 --> 00:37:00,300 a bunch of different applications, 761 00:37:01,020 --> 00:37:03,240 AIM and Mozilla Firefox, 762 00:37:03,480 --> 00:37:04,220 basically everything. 763 00:37:04,220 --> 00:37:06,120 We tried to write password recovery tools for them. 764 00:37:06,260 --> 00:37:07,680 And you can write a password recovery tool 765 00:37:07,680 --> 00:37:08,760 for pretty much everything. 766 00:37:09,420 --> 00:37:12,380 There's really not much that will help protect you 767 00:37:12,380 --> 00:37:14,200 if you're storing passwords in any sort of 768 00:37:14,200 --> 00:37:15,920 application-specific, you know, 769 00:37:15,920 --> 00:37:17,000 remember my password thing. 770 00:37:17,220 --> 00:37:18,940 They're pretty much all recoverable in some 771 00:37:18,940 --> 00:37:22,120 more or less trivial way, IE7 included. 772 00:37:22,280 --> 00:37:25,040 Firefox is probably the strongest of those, 773 00:37:25,120 --> 00:37:26,820 since you actually have to enter a password first. 774 00:37:27,020 --> 00:37:27,620 But even then, 775 00:37:27,680 --> 00:37:29,260 if you've already entered your password, 776 00:37:29,380 --> 00:37:30,840 the bad guy can sort of steal that too. 777 00:37:31,000 --> 00:37:33,040 So, moral of the story, don't get compromised. 778 00:37:34,220 --> 00:37:35,340 It helps from getting your password stolen. 779 00:37:35,620 --> 00:37:37,200 Don't save passwords of value. 780 00:37:37,440 --> 00:37:39,920 And if you run a site that does have a login form, 781 00:37:40,060 --> 00:37:41,920 there's some little tricks you can do to basically 782 00:37:41,920 --> 00:37:44,220 tell IE, don't save these passwords. 783 00:37:46,840 --> 00:37:48,120 So, the last one, 784 00:37:48,260 --> 00:37:50,480 we have one that's a Trojan called LACMA. 785 00:37:50,920 --> 00:37:53,000 And what it does, 786 00:37:53,100 --> 00:37:54,220 same typical Trojan, 787 00:37:54,880 --> 00:37:56,600 where basically they steal login credentials, 788 00:37:56,760 --> 00:37:58,480 and they steal all sorts of other pieces of data. 789 00:37:58,840 --> 00:38:00,380 And one of the things they steal is cookies. 790 00:38:00,840 --> 00:38:02,380 Mmm, I love cookies. 791 00:38:03,320 --> 00:38:04,200 So, what it does, 792 00:38:04,220 --> 00:38:05,140 when they upload the cookies, 793 00:38:05,280 --> 00:38:06,960 they do it in a kind of strange way 794 00:38:06,960 --> 00:38:09,480 where they don't necessarily sanitize the data. 795 00:38:09,620 --> 00:38:11,580 So, the user gets infected, 796 00:38:11,860 --> 00:38:13,960 the malware steals the cookie value, 797 00:38:14,240 --> 00:38:16,140 and then it uploads to the command and control site. 798 00:38:16,380 --> 00:38:17,420 And when it does it, 799 00:38:17,420 --> 00:38:20,180 it just uploads it with whatever file name that happened to be. 800 00:38:20,600 --> 00:38:22,340 And if you're emulating the Trojan 801 00:38:22,340 --> 00:38:23,180 with your own code, 802 00:38:23,340 --> 00:38:26,020 you can specify that to be anything you want, 803 00:38:26,100 --> 00:38:27,440 like, say, another PHP file. 804 00:38:27,700 --> 00:38:29,400 So, you can just upload your own PHP script 805 00:38:29,400 --> 00:38:31,240 to the bad guy's site simply by using this, 806 00:38:31,280 --> 00:38:33,580 it's literally just an arbitrary file upload 807 00:38:34,220 --> 00:38:34,400 vulnerability. 808 00:38:35,580 --> 00:38:37,620 So, I'm going to turn back over to NHL for one last demo. 809 00:38:37,880 --> 00:38:39,960 Sorry, this one isn't funny, but watch anyway, 810 00:38:40,100 --> 00:38:40,960 because I think it's cool. 811 00:38:42,460 --> 00:38:44,200 So, I was just trying 812 00:38:44,200 --> 00:38:45,700 to find a way to fit this demo 813 00:38:46,380 --> 00:38:47,640 into the presentation, 814 00:38:47,840 --> 00:38:49,040 which is why it's kind of not funny. 815 00:38:49,880 --> 00:38:51,640 But it's based on the LACMA 816 00:38:52,260 --> 00:38:53,700 rootkit that it installs. 817 00:38:56,280 --> 00:38:57,420 Just imagine that 818 00:38:57,420 --> 00:39:00,300 you're an incident responder or you're a malware reverse engineer, 819 00:39:00,460 --> 00:39:01,980 and you encounter 820 00:39:01,980 --> 00:39:03,780 a machine that is infected with LACMA, 821 00:39:04,220 --> 00:39:05,440 or any type of rootkit 822 00:39:05,440 --> 00:39:08,520 that places hooks into the system service dispatch table. 823 00:39:09,240 --> 00:39:09,760 So, 824 00:39:09,820 --> 00:39:11,760 first, what you might want to find out is 825 00:39:11,760 --> 00:39:13,880 what functions exactly are hooked 826 00:39:13,880 --> 00:39:14,900 in the SSDT. 827 00:39:15,460 --> 00:39:17,800 And then you might want to go and recover 828 00:39:17,800 --> 00:39:19,880 the kernel module that's running 829 00:39:19,880 --> 00:39:21,740 in order to inspect it 830 00:39:21,740 --> 00:39:23,140 with IDA or something. 831 00:39:24,240 --> 00:39:26,280 So, it's a really cool plug-in that I wrote 832 00:39:26,280 --> 00:39:27,680 for Volatility that automates 833 00:39:27,680 --> 00:39:28,720 all of those tasks. 834 00:39:32,020 --> 00:39:33,940 So, I've already, behind the scenes, 835 00:39:34,220 --> 00:39:36,120 taken a memory dump of a machine infected with LACMA. 836 00:39:36,480 --> 00:39:37,740 And then I'm just using 837 00:39:37,740 --> 00:39:40,400 the SSDT plug-in from Volatility. 838 00:39:40,580 --> 00:39:41,740 It's by Brendan Dolan-Gavitt. 839 00:39:41,900 --> 00:39:42,640 It's an awesome plug-in. 840 00:39:43,820 --> 00:39:45,660 And what it does by default is 841 00:39:45,660 --> 00:39:48,100 just prints all of the entries 842 00:39:48,100 --> 00:39:49,920 in the SSDT and the owning module 843 00:39:49,920 --> 00:39:52,200 and the address of where the SSDT 844 00:39:52,200 --> 00:39:52,900 function points. 845 00:39:54,600 --> 00:39:56,040 And it does that for all 846 00:39:56,040 --> 00:39:58,440 four of the SSDTs. 847 00:39:58,780 --> 00:39:59,740 The first one, 848 00:40:01,420 --> 00:40:02,220 all of the 849 00:40:02,220 --> 00:40:04,060 entries should be legitimate 850 00:40:04,220 --> 00:40:05,960 internally pointing inside NtOS kernel. 851 00:40:06,180 --> 00:40:07,400 For the second table, 852 00:40:07,480 --> 00:40:09,540 they should all be pointing inside the Win32k. 853 00:40:09,940 --> 00:40:11,320 And for the third and the fourth, 854 00:40:11,420 --> 00:40:14,120 it's a little arbitrary because those are not set by default. 855 00:40:14,500 --> 00:40:16,080 So, I'm going to use 856 00:40:16,080 --> 00:40:17,500 Brendan Dolan-Gavitt's 857 00:40:18,060 --> 00:40:19,820 SSDT script and on the command line 858 00:40:19,820 --> 00:40:21,760 just set a filter with egrep 859 00:40:21,760 --> 00:40:24,080 so that I ignore anything that points 860 00:40:24,080 --> 00:40:25,880 inside NtOS kernel and anything 861 00:40:25,880 --> 00:40:27,440 that points inside Win32k. 862 00:40:32,180 --> 00:40:34,080 And what I end up with is 863 00:40:35,240 --> 00:40:36,780 four functions down here 864 00:40:36,780 --> 00:40:38,160 that point inside 865 00:40:38,160 --> 00:40:38,920 a module named 866 00:40:38,920 --> 00:40:41,100 landman-drv.sys. 867 00:40:42,500 --> 00:40:43,020 NtEnumerateValueKey 868 00:40:43,020 --> 00:40:44,900 for hiding registry entries. 869 00:40:45,560 --> 00:40:47,180 NtOpenProcess for hiding processes. 870 00:40:48,720 --> 00:40:50,340 NtQueryDirectoryFile for hiding files. 871 00:40:50,540 --> 00:40:52,020 And then NtQuerySystemInformation. 872 00:40:53,120 --> 00:40:54,440 So, like I said, 873 00:40:54,520 --> 00:40:55,180 that's the first step. 874 00:40:55,300 --> 00:40:56,940 We wanted to know which SSDT functions 875 00:40:56,940 --> 00:40:58,020 that this rootkit hooks. 876 00:40:58,280 --> 00:41:00,920 The next step would be to dump the module 877 00:41:01,680 --> 00:41:03,600 and then look through it 878 00:41:04,220 --> 00:41:05,220 to try and maybe figure out 879 00:41:05,220 --> 00:41:06,740 what processes it's hiding, 880 00:41:06,840 --> 00:41:07,900 what registry keys it's hiding, 881 00:41:07,980 --> 00:41:08,700 what files it's hiding. 882 00:41:08,940 --> 00:41:10,820 So, I automated that task a little bit 883 00:41:10,820 --> 00:41:12,800 with a plugin called SSDTEX. 884 00:41:18,160 --> 00:41:19,780 And you can see that blue screen 885 00:41:19,780 --> 00:41:21,240 flash by really quickly. 886 00:41:21,900 --> 00:41:23,080 And that was actually 887 00:41:23,080 --> 00:41:25,380 IDA's command line program 888 00:41:26,560 --> 00:41:28,420 that I automated 889 00:41:29,260 --> 00:41:30,260 to process 890 00:41:31,080 --> 00:41:31,600 the 891 00:41:32,220 --> 00:41:33,640 landman-drv.sys 892 00:41:34,220 --> 00:41:35,140 after having dumped it from memory, 893 00:41:35,300 --> 00:41:37,120 after having identified 894 00:41:37,120 --> 00:41:39,880 that the four hooked SSDT entries 895 00:41:39,880 --> 00:41:41,060 point inside that module. 896 00:41:41,800 --> 00:41:42,840 So, furthermore, 897 00:41:42,900 --> 00:41:45,160 after automating 898 00:41:45,160 --> 00:41:47,000 the creation of an IDB, 899 00:41:47,260 --> 00:41:49,340 it does a little bit more automation 900 00:41:50,180 --> 00:41:51,700 and goes as far as 901 00:41:52,220 --> 00:41:53,080 actually labeling 902 00:41:53,820 --> 00:41:55,980 the functions in the IDB 903 00:41:55,980 --> 00:41:56,820 according to 904 00:41:56,820 --> 00:41:58,860 which SSDT functions 905 00:41:58,860 --> 00:42:00,380 that it hooks. 906 00:42:00,540 --> 00:42:02,960 So, just in one easy step, 907 00:42:04,220 --> 00:42:04,480 I found out which 908 00:42:04,480 --> 00:42:05,840 SSDT functions were hooked, 909 00:42:05,960 --> 00:42:07,020 dumped the owning module, 910 00:42:07,260 --> 00:42:08,560 created an IDB of it, 911 00:42:08,680 --> 00:42:11,000 and then named the function 912 00:42:11,000 --> 00:42:12,420 so I know exactly where to look 913 00:42:12,420 --> 00:42:13,640 in the IDB when I start 914 00:42:13,640 --> 00:42:14,400 reverse engineering it. 915 00:42:21,020 --> 00:42:21,920 So, that's all. 916 00:42:22,040 --> 00:42:22,380 Thank you. 917 00:42:22,460 --> 00:42:23,020 I hope you had fun.