Everybody in a good mood? I'm like a lie this is Matt Richard you can call him Matt or Richard because he has two first names so it doesn't really matter. So our talk today is about it's called making fun of your malware and here's what we're going to try to do. So not all guys that write code are really good at it and people make a lot of mistakes. Not all guys who use malicious code are actually good at operating it so we got a little bit of that in there too. And then there are people who just completely fail at both. So sit back relax. We may not be funny so just in case we included actual technical material just in case you want to learn something too so if we're not funny at least enjoy you know some little tidbits of tech talk. So the real quick disclaimer is these opinions are our opinions and nothing in here is that of our employers standard disclaimer. Don't hold us liable. All right so this first one is called Honey I Shrunk the Entropy and it's the story of silent banker authors who developed this very complex encryption algorithm and then forgot to seed the random number generator. So this code over there is a snippet from Zeus from September 2007 and you can see that it is seeding a random seeding that global variable called DD tick count. It first moves it into the EAX register the first time that this function is called and then it checks that value to see if it's zero. And if it's not zero it calls get tick count to seed it. We weren't surprised when we saw a similar resemblance in a silent banker binary from February 2008. And you can see the resemblance here. It has a similarly named global variable called DD tick count that gets checked if it's zero or not. If it's not zero it gets seeded with the value of get tick count. And uh at first before uh I saw the MSV seeding I was like oh my god I'm gonna have to do this again. So I thought maybe there was a link between the Zeus authors and the silent banker authors just based on those few hex numbers that are uh hard coded into the binary. But really uh they both just statically linked with MSV CRT. So now we get to the recipe for disaster. This uh snippet of code is from silent banker in July 2008 so just a few months after that last sample we saw in February. So they updated their code sent out a new version of silent banker and this one is significantly different from the ones that we saw previously because you don't see that global variable uh named current seed in this case being checked if it's ever zero and seeded. It's just used. So it's possible that somewhere else in the binary before we get here silent banker seeds uh this global variable with some type of number. So I'm gonna skip over here to the disassembly. Here's that same function. Let's just check if current seed is used anywhere else in the program before it gets used in this rand function. You can see it initially starts out as zero. And we'll check the cross references to that variable. Based on this T column right here the W means write. There's only one write operation to that global variable throughout the entire binary. And it is the rand function itself. So I'm gonna skip through this one just a bit fast. I talked about this briefly at uh DEF CON last year. The recipe for disaster is to seed the random number generator that's uh fairly gray up on there because I wanted to indicate that they didn't do it. The next step is that they make 1,000 calls to that my rand function and generate a 16 byte number uh which is the primary encryption key. And then they take that 16 byte number and they run a new one called my rand. And then they compute an 8 byte number using a particular formula. Then they generate another 8 byte number from the secondary key. And then they use some arbitrary precision math to explode that 8 byte tertiary key into a 32 byte number. Finally, they encrypt the stolen data, usernames, passwords, what have you, using the original 16 byte key. But they don't trance, they don't transmit that 16 byte key with the stolen data when they send it to the drop site. Because that would be kind of transmitting the key with the encrypted message. Not a very good idea. So instead the silent banker authors transmitted that 32 byte number instead. And on their side they've got a program that converts this 32 byte number back into the 16 byte primary key. But we don't have that program. So recipe to exploit the disaster. Number one, we start with seeding the random number generator. Two zero. Those next four steps, we can all automate with a Python script for immunity debugger. Because we have the formula that computes that 16 byte key, the 8 byte key, the next 8 byte key, and the 32 byte key. We have that formula. It's not in C code, but we have it because we have a copy of the silent banker binary that does it. So that Python script, I'm gonna show you a demo of how it works in just a second. When we're done, we should have a good disaster recovery. So here, I've got silent banker and immunity debugger. I'm attached to Internet Explorer, which is where silent banker runs. And I've marked the four functions that generate the encryption keys. And I plug in that Python script that I showed on the last slide. I invoke it by typing bang Keegan. And I'm gonna show you how that works. And I'm gonna show you how that works. And you can see that the debugger will just play through those few functions that I want to execute about five times for this demo. But in real life, we did it about 5,000 times to get a larger set of keys. You can see on the log pane here that for each iteration of the loop, it outputs a 16 byte primary key here. And then the associated 32 byte key. So at the same time that this script is printing information to the log data, it's also creating a text, a file on disk. And then the other key here that has the associated 16 and 32 byte keys here. So it's just a hex file. So we can go and use a Python script that we wrote that accepts that keys file. And also a directory of logs that we recovered from the stolen, from the command and control site. So here we have a few encrypted private key certificates and a few .txt files which contain the encrypted data. And we can just run this program. And it's searching through each of these text files, extracting that 32 byte key, looking through the key file that I have and pairing that 32 bit number with its original 16 byte key. And then it goes ahead and decrypts the information once it finds the 16 byte key. So this is the original .txt file. You can tell it's obviously not readable. And then the output is a bunch of .tmp files which are in fact readable. And we can take that out and run it from the information and then go return it to the rightful owners. So all the complex work that silent banker authors went through to keep their information protected is just completely ruined because they forgot to see the random number generator. Now the best part about this is this function here in the silent banker binary. I've named it why not use this. So they've actually got a function in here that uses get current get cursor position to generate entropy and uses that to seed a random number generator and we can check the cross references to this function here and see that it's used about 10 or 15 other places in the code. So it's not that the silent banker authors forgot to write code that was capable of seeding a random number generator they just simply forgot to call this function from their encryption routines. It's there, they just forgot to use it. So we thought that was pretty funny. And there's the one that got away. It's there, why not use it? So the next one is called to DES or not to DES. And this is a story about a malware author who either doesn't know how to use the Windows API appropriately or doesn't know the maximum size of a DES key. So for the crypt derived key API function, the crypt used the DW flags parameter, the high order, I'm sorry, the low order two bytes of this specify the key size that you want for your encryption key. So here if the low bytes are 0080 then the encryption key that we're asking is 128 bit RC4 key. Now this is how to shoot yourself in the foot. And I'm going to go to the disassembly for this one as well. Here is a function called initialize crypto subsystem. And you can see the Trojan calling crypt acquire context. And then it's creating a container for an MD5 hash. And then it's creating an MD5 hash of a hard coded password in the binary. And it's trying to use the output of that hashing function to generate a 128 bit DES key. Which obviously will fail because there's no such thing as a 128 bit. So if any of those API functions fail, it follows this jump to what I've labeled cannot derive key. And that location is right here where it moves the value that is in EBP, which is zero at the time, into this Boolean value called BU's MS crypto API. Now to see what type of effect this has at runtime, we have to follow this structure member and see where else it's used in the program. What different behavior does the Trojan exhibit? If this is true or if it's false. So in the function that I've named encrypt data, we can see that Boolean value being checked. And if it's true, then it comes over here to this side, where it uses DES encryption and the crypt encrypt Microsoft API. However, if that value is zero, which as we know will always be zero, it comes over here and defaults to XOR. So, I'm going to show you how that works. I was just a little curious, at what point in time did the malware author decide to make a backup of this? Was he getting pressure from people above that he needed to push some malware out the door? And then at the last minute he realized that his DES wasn't working, so he threw in some XOR? I'm not sure, but it's pretty funny. So always make backups is the moral of that story. The next one is called you did what with what? And I was trying to think of a term. A term that described the way CoreFlood's encryption worked, and I came up with location-dependent encryption. And I wondered, hmm, has somebody else already written a paper about this? Maybe I can Google for it. And I Googled for that, and I found a hit on the U.S. patent website where someone has actually submitted a patent for something called location-dependent encryption. And this diagram is pretty meaningless. I wouldn't recommend staring at it too long. But basically the way that it works is I send you a message, an encrypted message. And in order to read it, you have to take your GPS device and travel to the exact longitude and latitude that I specified when I encrypted the data. So normally there's that security and convenience tradeoff, and this one has neither. So it's definitely not secure. And in order to read a message, you have to travel somewhere that I specify. So I was joking with Matt earlier saying that if you find yourself in a flame war on an e-mail thread. And you really want to get rid of somebody, just encrypt a message to them and make it only readable from, like, Iraq, and then there will never be a problem. So the way that this fits into CoreFlood is their patent-pended method here. This is a snippet of the code where CoreFlood, after it steals information from the user, it will encrypt it and write it to disk so that the Trojan can then retrieve it later and upload it to its command and control site. So it calls set file pointer. And the return value of set file pointer is a D word, which specifies the offset in the file that the pointer was set to if it succeeded. So then it takes the number of bytes to encrypt and moves it into the ECX register. And it takes a pointer to the data to encrypt and moves it into the EDX register. And then it ensues with this XOR loop here, where it XORs every byte in the buffer with AL and AH, which are the high and low order bytes returned from set file pointer. So the actual encryption key in this scheme is the offset in the file where the data exists. Brilliant. So how to dump Core? This is a program that I wrote and just released fairly recently, and you can download it. It's got the entire source code there. And it's helpful if you encounter a machine that has been infected with CoreFlood. And for some reason it wasn't able to reach its command and control server in order to upload the data. So you can actually go and retrieve those files that it has on disk and decrypt them using this tool to figure out what would have gotten stolen if you need to report it to a customer or anything. So the other interesting part about CoreFlood is, albeit it has that encryption algorithm, kind of weak, but then it goes and transmits all its configuration information, what information to steal, all its target information, which banks, which credit unions to steal information from, transmits all that in the clear. So another method of dumping Core is just using Wireshark and viewing the traffic. So here, the way that CoreFlood works is it's a DLL that gets injected into Internet Explorer and Explorer. And there are various ways to inject a code or a DLL into a process. There are several of them. And the important part for a stealthy malware author is, number one, does the method require a change to the registry? Number two, does it require me to reboot my computer before the change takes effect? And number three, does it require the application that I'm injecting code into to restart? So there are several options here available to malware authors. And which one does CoreFlood choose? They chose one that requires modification to the registry. And they chose one that requires modification to the registry. And they chose one that requires modification to the registry. And in this case, the application is Explorer. Quietly, so no one hears. This is the code that we reverse engineered showing where CoreFlood chooses to manually terminate Explorer so that the change takes effect immediately. Now, you're probably familiar with what happens if Explorer crashes on your machine. Your taskbar disappears. Your open applications disappear. All your desktop icons disappear. And then slowly, one by one, they start to come back. So the CoreFlood authors obviously knew that because they went in here and they made a call to set error mode right before calling open process and terminate process. So what set error mode does is it prevents particular crash notifications being sent to the system which would then create a small pop-up box. And it sends the error message to the terminating application instead. So all that they've done with this call to set error mode is prevented a small pop-up box from being shown to the user before Explorer crashes. So you tell me, which one is more suspicious to a user? A small pop-up box followed by everything disappearing and then reappearing or everything disappearing and then reappearing? Both? So CoreFlood, when it loads its DLL, it doesn't stay loaded in the loaded modules list. It allocates some memory on the heap and copies itself to the location on the heap. And then it deletes its PE header. So if you encounter a machine that's infected with CoreFlood and you say, okay, the next step is to dump this executable then I can maybe load it in IDA and I can analyze it. Well, it's pretty hard to dump an executable if there is no PE header. So on top of that, CoreFlood, when it calls virtual alloc, it specifies the mem top down flag which causes the system to return an address, the highest available address rather than the lowest available address. And it causes CoreFlood to then be able to, quote unquote, hide in the higher regions of user mode memory around all the system DLLs. So this next demo is how to make all that hiding useless. And when you encounter something like CoreFlood that has a few hiding techniques and there aren't available tools to help you, you have to create your own tools. If you're familiar with unpacking, what you normally do is use a debugger if there isn't an automated unpacker. For CoreFlood, there isn't because it's not a common algorithm. But you might use a debugger and go to the original entry point and then maybe dump it with Lord PE or ProcDump or another process dumping utility. And then you might fix the imports with Import Reconstructor. And then finally, after all that work, you might have a binary, an IDB, that you can open and examine. So this next demo is a tool that I wrote recently. It's not publicly released yet because I haven't actually finished it. But it's a plug-in for the volatility platform. And right now, I'm connected to Internet Explorer in a debugger. And since I know where to find CoreFlood, I'll show you where it is just for purposes of the beginning of this demo. So here it is right here, hiding in memory at 7FF80. 8100. We can double-click on that to see the actual hex data there. And we can verify that it's CoreFlood based on some strings that we see. So the next step... Sorry, it's a little hard to read, but I'm going to make these demos available. You can download them and play them on your own machine where you have better resolution. Behind the scenes, I took a memory dump of that system infected with CoreFlood. And I'm analyzing it now. With volatility. And first, I'm printing a process list so I can find out the PID of Internet Explorer. And right here, it's telling me that the PID is 1732. So what I'll do next is use the malfind plug-in, which searches the virtual address descriptors, which contain similar information to what the memory map in the debugger contains, all the allocated memory regions in the process. And for each allocated memory region, it checks the VAD tags and the permissions to see if there's executable code there. And if it is, it'll try to disassemble it so that you can, instead of attaching to it with the debugger and searching through the memory map, all this is is one step. And you can see that malfind has located some executable code identified by the proper disassembly here at 7FF80000. So naturally, the next step is to use this new plug-in. It's called FixIAT. And I give it a process list. I give it a process context, PID 1732 for Internet Explorer. And I specify the start of that memory range where core flood is hiding. And what the plug-in does is it enumerates all the loaded DLLs in Internet Explorer's memory, along with its base address and size. And then it parses the export table to find the RBAs of the exported functions from those modules, and it saves them. And then it disassembles all of the information starting at that memory region at 7FF80000, looking for calls that lead to any of those exported functions. And that's how it rebuilds the import address table without even having a PE header. And you can see that the output of this will be something similar to Import Reconstructor. You have the modules, the first func, and each imported function from the modules. And the output of this FixIAT script is an executable that you can open in a PE Viewer and see that the import table is successfully reconstructed. And you can further verify by just taking that and loading it into IDA. Everything looks right. In the import address table, we can then go and follow the cross references to set file pointer in this case. And there we are exactly at that point of the location-dependent encryption code. So in just a few commands, with volatility on the memory dump, we located where core flood was hiding in memory, we disassembled it, extracted it, pasted a PE header onto it, even though it didn't have one, and then completely rebuilt the import address table. And it only took about 20 seconds. So the next one is called Honey. Sorry to bother you again, I shrunk the internet. And this is a story about Configure.B's flawed IP generation. So we're going back to the Windows RAND function here. And the important part about this function is the very last instruction where it performs an AND of whatever value is in EAX with 7FFF. So if you're not familiar with assembly and what that instruction might do, then here's a small demo. We're moving the maximum value that EAX can hold into the register here, and then we're going to move the maximum value and then executing that AND instruction. And you can see it chops off that upper half of the value and then subtracts one. 7FFF is 32768, also known as RANDMAX, defined in the Windows source code. So apparently the Configure authors weren't aware of this limitation that calling Windows RAND doesn't return an integer of that size that they wanted. It chops it down to be no greater than 7FFF. So that one byte right there, the 7F, will never be greater than, well, 7F. It will never be 80 or anything like that. So now we get to the code in Configure on the left hand side where it shows one call to RAND initiates the first and second octets of the IP address that it's going to scan with what it gets back from RAND. RAND initializes the third and the fourth octets of the IP address. But two of those octets are never going to be greater than 7F. So there's a large portion of the internet that Configure.b is not capable of scanning using this algorithm. Over here on the right hand side is some source code that shows exactly what the assembly is doing right here. It's hard to read, but the code is online for you to see if you're interested. Here's a link to the tool down there at the bottom. So what's the big deal behind this? Big thanks to Brandon Enright who made this awesome diagram. It's called a Hilbert curve diagram. And I'm going to jump out to the larger version of this so you can see it a little bit better. But the blue color in this diagram shows IP address ranges that Configure.b is simply not capable of scanning using that flawed algorithm. The red code shows what you can scan. And as you can see, this color in the larger view of it right here is not actually red, it's purple. You don't see the red until you zoom in a little closer to one of the particular netblocks. And then you can start seeing a bit of red. But even in that red for each slash 16 netblock here there's still a significant amount of blue that Configure.b So that's pretty interesting. A lot of people think that there were some great minds behind Configure and maybe there were. But they weren't aware of the limitation that Windows RAND provided. So going back to those guys who just really aren't that good operators. So in the cybercrime world it's kind of like a dog-eat-dog world. So you know, no honor among thieves. So we're going to talk a little bit about the NeoSploit crew. They basically made this attack toolkit. We're going to take a cache, now we're going to dash. So NeoSploit is a web attack toolkit. So basically cybercrime fellows would buy this toolkit and they'd set it up on a web server. People would go to that web server they have a whole bunch of exploits they would trigger download their code. So basically this is kind of like a script kitty type roll your own exploit kit. So the NeoSploit guys were probably one of the most advanced groups out there. They were definitely very good on the business side. They wanted to protect their investments and their time. So they wrote all the code in C. Or some other flaky web app. They wrote it all in C as a CGI. So they would give each of their customers a binary distribution that would have this whole kit in it. And also in the underground world they were very worried about people going and ripping off the exploits. Like literally just copying and pasting the exploits and making a whole new kit out of it. And that's kind of rampant in the underground. There's 40, 50, 60 different web attack kits and they're all just ripped off from each other copy and paste exploits. So the NeoSploit guys were a little bit smarter. They thought they were going to encrypt it inside. The server shows you they actually have a key file. So this is a fully licensed distribution. They would actually distribute a key and do a bunch of IP checks on the server hosting it. So they had a lot of really good customers. I don't doubt they made tons of money. They had customers, the TorPig group if anyone's ever heard of the Master Boot Record Rootkit or TorPig. They were one of their biggest customers. They had tons and tons of other customers as well. So they were really out protecting their investment. They had version 3 was really their big build. And that was released sometime in 2008. And we'll go into more of that story later. But needless to say they were really, really worried about piracy. So there was definitely a lot of FUD that went along with NeoSploit. NeoSploit was in the media quite a bit. And there were people who said, oh, NeoSploit's just copied all over the place and NeoSploit's this. So needless to say we'll go into some of the disassembly and show a little bit of how it works. So the first funny thing they did is so they'd had this kit around since April of 2008 and then July 2008. They pretty much decided that, you know, we're really not interested in supporting this anymore. We're adding new exploits. And we've already got your money. You've already paid your subscription. So see ya. So they just basically dropped a note on their website and told all their customers that, sorry, it's been fun, but we're out of here. Then they were just kidding. So then in August 2008 they came back and they actually released a whole new version and they started redistributing it to some of their better customers, but not everybody. So they still screwed a lot of people. All those people who originally paid for it still didn't get updates. And getting people to pay for it. And they added a whole bunch of new exploits and did a lot of new work. And then they decided, yeah, no, we're really serious. We're gonna stop and we're just gonna keep that extra money you just gave us too. So now you're all screwed. So going into a little bit of Neosploits, it was kind of a cool attack kit. So like I was mentioning before, they were really worried about piracy and people ripping off exploits and copying and pasting them into new kits. So what they did is they took each exploit and within this CGI file they would basically easily rip down. So, of course, for those who were still thinking from the other slide from the media that these exploit kits are sometimes just copied and pasted, binaries are not the same as PHP scripts, they're a little bit different. And there was a famous quote on Neosploit that was in a blog that said, anyone can introduce new exploits for this kit. It's kind of hard. So this is the whole reason for this part of the talk is I said, I wonder how hard it really is. So what they do for each exploit, there's a code segment that loads the blob of the encoded exploit. It's a three byte key, it decodes it, runs through the whole loop and then serves that up to the user every time. So even if you were to go through memory, it's still even kind of tricky to dump memory and get all the exploits because it's clearing out these buffers each time. So luckily, if you did want to just copy and paste these exploits, there is an answer. So IDA scripting is a very powerful feature with scripting. So you can basically just write a little script that goes through, finds all these blobs, looks for all calls to the decode function, grabs the blob, decodes it with the XOR, and then dumps it out. So this would probably be one of the ways, or you could write your own custom small application that did it, but if you were going to go in and add new exploits to Neosploit, this is probably the way you'd have to do it is something along these lines. And of course, once you dump it out, then you've got the whole plain text to do other things. So the Neosploit guys probably just gave it up because it was some good money and they really didn't care about their customers. So for anyone who's ever heard the words of the great philosopher Biggie Smalls, he has a song called The Ten Crack Commandments. Very, very strong wisdom if anyone's a crack dealer. I highly recommend it. So number four, he's got out of the ten crack commands, number four is never get high on your own supply. Very important. You really don't want to be a crack head selling crack. So we came across this guy, I call him the peeper. So he was distributing malicious code, we'll walk through that in a second, but basically he didn't listen to this song. So his attack went something like this. He would send out these emails disguised as various government agencies, official looking emails, addressing people by name, dear so and so, the FTC has lodged a complaint against your company, click here to download this document that describes the whole thing. So when the user opens up that particular document they would get this, it's a real word doc, inside of it, a very clever feature of Word, which is basically OLE, that allows you to just drag and drop executables inside a Word document and then rename them so that they say something like Microsoft Word has encountered an error, please double click here to continue. Yeah, completely brilliant. So he was using this, and people would still click through, it takes like six clicks to go from getting this message to actually being infected, and he had tons of victims, so people are really brilliant when it comes to that. You know, and I love his message too, so the next thing we found as we were tracking this guy down is if you're gonna have a drop site, maybe he didn't have his own management tool, so maybe he thought open directories were good, but open directories are bad if you're storing a lot of information about people, so he definitely had the whole, every server that he would configure for his drop site had an open directory and he could just go through and browse all the listings of all of his victims and see each and every one of them, and oddly enough, he was, in one sense he was a good developer, so he liked to QA his code. The downside was is he was QAing his code on the actual server using his real IP, so you don't last long when you do things like that, so he actually had his DSL connection from the Ukraine, he would test all of his code, and the malware had a nice feature called watch me, or watch him, so basically the whole point of this guy is he was stealing banking credentials, but sometimes he just wanted to watch his victims and just sort of see what they were doing, hence the reason we call him the peeper, so he wasn't satisfied just to have that kind of functionality, he started to watch himself, kind of odd, so I don't know if anyone has ever opened up a VNC window on your own machine that has VNC running and loops back and starts to see smaller and smaller images, he actually did that to himself multiple times, on multiple drop servers, yeah, really, really odd, and he would go through this and we'd be looking through the drop servers and oh, there's a picture of him watching himself, watching himself, watching himself, and then the one that really takes the cake, my favorite of all that we found that he had done to himself, he was using this watch me feature on himself while he's developing the code, so he's actually got his dev environment up and he's actually writing code, watching himself sending it all back to the command and control, so there's nothing that helps the authorities when they bust down your door and kick it in and come running in and grab your machine when you've got the source code there and they can go and match it up on a command and control server and see that they're exactly the same thing, not too bright. So the last piece of malware we've got is an interesting one you might be familiar with, the Internet Explorer 7. So don't worry, it's all under control, Microsoft's taking care of it, let's not get too worked up. So Microsoft had a big problem with IE6 and that was that it was way too easy to steal stored passwords, so you're probably familiar with, you go to a website that says, do you want to save this password, they call it IntelliForms and you say yes and it stores it in the registry, well the problem with Internet Explorer 6 was any user logged in with the, there was literally no protection, so for malware if it was running in the context of the user, it could literally just read those passwords and send them back off. So in IE7 they came up with a brilliant fix, they encrypted it, with 128 bit encryption, unbreakable, brilliant. So if you look on the bottom you can see there's a hash of a website that I'll explain later on and then a binary blob that contains the username and password, so it seemed to actually be a fairly reasonable solution. So I want to quote from another great philosopher, John Travolta from the movie Swordfish, and my favorite part is when he's sitting there and he's explaining to the other guy and he says, this encryption is so good even I can't break it, and I think he mentions like the 512 bit encryption, because he's like the best cryptographer in the world that's why they hired him, so he's like, even I can't do this. So here's what Microsoft did. They, to encrypt the password, they would generate a 128 bit key based off the MD5 of the site that they were storing the password for. So that actually seems like a fairly reasonable thing. So if you went to www.bank.com slash login.asp what they would do is they would take that string they would make it all lower case then they would make it a wide string and then basically MD5 that. And that was then the key that was used to encrypt the password and the registry and the username. And then, when you visited the site that it had a stored password for, it would do the opposite. It would take the site you just visited, it would chop it down, normalize it, convert it to a wide string, and then look through the registry so it seems fairly reasonable. Except if you think about it, there's a little problem. That's actually not very much entropy. It's kind of easy. It's really not that much harder than IE6 password encryption was. So, in order to break it, it's fairly straightforward. If a user is storing a username and password, chances are it's because it's a site they go to. And if it's a site they go to, chances are it's a site that you can easily find in index.dat or the typed URL's registry key. So that part's pretty easy. So, another easy way to find them is, if you're talking about U.S. victims, there's only 15,000 banks and credit unions in the U.S. And each one of those only has a handful of login pages. So it's fairly trivial to go out and scrape them all and to gather a collection of those. So, again, not really much protection. And then, of course, if you're a bad guy, you probably know a lot of the sites that you want passwords for, whether it's Facebook or MySpace or Twitter or whatever it happens to be, and you know the login page. So, again, you can just pre-compute those. And then if you really get desperate, Alexa keeps tabs of popular sites, and you can just grab those. So it's really easy to decrypt these. You can do something like basically create a rainbow table out of all these common sources, and then you've basically got all the keys to decrypt all the passwords. So for the bad guys, it's fairly straightforward. So the moral of the story for IE7 is it's not looking good. But maybe there's help. Or there's not. So nobody really does a good job with this. Actually, Michael and I looked at a bunch of different applications, AIM and Mozilla Firefox, basically everything. We tried to write password recovery tools for them. And you can write a password recovery tool for pretty much everything. There's really not much that will help protect you if you're storing passwords in any sort of application-specific, you know, remember my password thing. They're pretty much all recoverable in some more or less trivial way, IE7 included. Firefox is probably the strongest of those, since you actually have to enter a password first. But even then, if you've already entered your password, the bad guy can sort of steal that too. So, moral of the story, don't get compromised. It helps from getting your password stolen. Don't save passwords of value. And if you run a site that does have a login form, there's some little tricks you can do to basically tell IE, don't save these passwords. So, the last one, we have one that's a Trojan called LACMA. And what it does, same typical Trojan, where basically they steal login credentials, and they steal all sorts of other pieces of data. And one of the things they steal is cookies. Mmm, I love cookies. So, what it does, when they upload the cookies, they do it in a kind of strange way where they don't necessarily sanitize the data. So, the user gets infected, the malware steals the cookie value, and then it uploads to the command and control site. And when it does it, it just uploads it with whatever file name that happened to be. And if you're emulating the Trojan with your own code, you can specify that to be anything you want, like, say, another PHP file. So, you can just upload your own PHP script to the bad guy's site simply by using this, it's literally just an arbitrary file upload vulnerability. So, I'm going to turn back over to NHL for one last demo. Sorry, this one isn't funny, but watch anyway, because I think it's cool. So, I was just trying to find a way to fit this demo into the presentation, which is why it's kind of not funny. But it's based on the LACMA rootkit that it installs. Just imagine that you're an incident responder or you're a malware reverse engineer, and you encounter a machine that is infected with LACMA, or any type of rootkit that places hooks into the system service dispatch table. So, first, what you might want to find out is what functions exactly are hooked in the SSDT. And then you might want to go and recover the kernel module that's running in order to inspect it with IDA or something. So, it's a really cool plug-in that I wrote for Volatility that automates all of those tasks. So, I've already, behind the scenes, taken a memory dump of a machine infected with LACMA. And then I'm just using the SSDT plug-in from Volatility. It's by Brendan Dolan-Gavitt. It's an awesome plug-in. And what it does by default is just prints all of the entries in the SSDT and the owning module and the address of where the SSDT function points. And it does that for all four of the SSDTs. The first one, all of the entries should be legitimate internally pointing inside NtOS kernel. For the second table, they should all be pointing inside the Win32k. And for the third and the fourth, it's a little arbitrary because those are not set by default. So, I'm going to use Brendan Dolan-Gavitt's SSDT script and on the command line just set a filter with egrep so that I ignore anything that points inside NtOS kernel and anything that points inside Win32k. And what I end up with is four functions down here that point inside a module named landman-drv.sys. NtEnumerateValueKey for hiding registry entries. NtOpenProcess for hiding processes. NtQueryDirectoryFile for hiding files. And then NtQuerySystemInformation. So, like I said, that's the first step. We wanted to know which SSDT functions that this rootkit hooks. The next step would be to dump the module and then look through it to try and maybe figure out what processes it's hiding, what registry keys it's hiding, what files it's hiding. So, I automated that task a little bit with a plugin called SSDTEX. And you can see that blue screen flash by really quickly. And that was actually IDA's command line program that I automated to process the landman-drv.sys after having dumped it from memory, after having identified that the four hooked SSDT entries point inside that module. So, furthermore, after automating the creation of an IDB, it does a little bit more automation and goes as far as actually labeling the functions in the IDB according to which SSDT functions that it hooks. So, just in one easy step, I found out which SSDT functions were hooked, dumped the owning module, created an IDB of it, and then named the function so I know exactly where to look in the IDB when I start reverse engineering it. So, that's all. Thank you. I hope you had fun.