All right, guys. The few, the proud. The guys who made it all the way to the end of the day here. Pretty amazing. Everybody can hear me? In the back, you can hear me? All right, good. Well, we are here to talk about advanced file system hiding and detection. You'll have to forgive me because you either get the... We got nothing on the laptop here, but we got both screens. So if I fade in and out, just let me know. I'll stick to this one. Anyway, I'm Irby Thompson. This is Matthew Monroe. My colleague. We work at Lockheed Martin. But don't hold that against us. Anyway, all right. What we're going to talk about today. First thing is doing a little history and analysis of traditional data hiding methods. Then we're going to do a case study on finding new places to hide. We chose NTFS because there have been some projects on Linux about data hiding in the file system. But we wanted to look at something different. NTFS was closed sourced. Made it more fun to reverse. We're going to do a demo of that. We'll talk about detection a little bit and maybe some future considerations. So let's start off with why is data hiding important? A lot of people will say that modern rootkits alleviate need to hide data persistently. I would disagree with them. I think they're wrong. I think rootkits are really good at hiding data on a live system. But what happens? The problem is if you need to store data on that system until you can get it off, how would you be able to hide from offline forensic analysis? Say an investigator pulls the hard drive and runs encase against it. You want to be able to hide against that as well. Of course, you can say what if the rootkit is entirely memory based? It never touches the disk. You never have any traces on the hard drive itself. Well, I mean that certainly buys you something. But you don't have reboot persistence. If you reboot, you're going to lose. Access to that machine if you were trying to actually save like say you had a keystroke logger on the machine, you're going to lose obviously those keystrokes. So I think there are situations where you want to be able to hide on the machine covertly. I would call this the patient hacker. There might be some foreign intelligence type types that would be interested in being able to maintain access on the machine through reboots and also staying pretty low on the radar screen. From forensic analysis. So just moving on a little bit. Information hiding is nothing new. We're not really pulling any new tricks out of the hat. I mean we're kind of taking existing ideas and applying them to modern technology. So I'm sure many of you as kids wrote with invisible ink, used the lemon juice, you know, take the little candle and you got your hidden message there. Kind of trying to do similar stuff to that. Hiding data on computers is just the modern application of old principles basically. And we categorize data hiding into three major areas. The first is out of band and we'll get into that a little more. Then in band and application layer. So just diving right in. Out of band data hiding is what I would call the portion of a medium that's outside the format specification of that medium, which means nothing. So what does that mean exactly? Well say you had a radio channel that was, you know, 210 megahertz. Well what about the area that's like 210.9 plus? 209 point, you know, whatever. So it's, you're trying to hide outside the normal realm of operation. Going to a hard drive in our specific case, if you're hiding beyond the end of a partition. So a hard drive might be 100 gigs big. The partition might only be 99 gigs and that last gigabyte of space is just kind of, it's just kind of out there. It's beyond, it's not really being used but it's still, you know, part of the drive. There's a program called Slacker that came out last Black Hat. Two years ago. Two Black Hats ago. That used Slack space at the end of files. So if you know how files are stored on a hard drive, they're stored in basically a page boundary. So if a file's only like 3K, it'll still take up 4K on the disk. And so that last K is just unused and so Slacker would stuff data in those little Slack spaces at the end of files. You could take a hard drive and mark certain sectors as bad and they would no longer be within the realm of normal use. But they might still be, you know. Able to store data. And finally, host protected area. I'm not going to go into that too much but basically, modern hard drives present one amount of data to a system but they actually underneath can store more data. They can have system management information stored there and whatnot. In band is kind of the opposite of out of band. You're hiding within the format specification. You're not breaking the format in any way or you're not doing anything illegal, so to speak. You're kind of using the file system in ways it wasn't necessarily necessary. You're kind of using the file system in ways it wasn't necessarily intended to be used. Alternate file streams is the big one here. NTFS supports multiple data streams for a single file. And most people, you know, just see the regular data stream. If you open up Windows Explorer, it only shows you the regular data stream. But if you go to the command line, you can do like copy data into another data stream of the same file name and it won't show up for most tools. Similarly, you could use a file system journal log. You could say I need 100 megabytes for my journal log. But it only uses the first, you know, 200K. All the data after that or all the space after that, we would consider that to be in band. You know, you're hiding in space that's been reserved but you're not actually, I mean, you're not supposed to be there really. And reserved but unallocated sectors, going back to our original hard drive example, what if we had a, you know, partition that was 99 gigs but we might only be using the first 20 gigs? Well, we could put data out later on that partition. Within the partition. But not showing up as a file per se. Finally, application layer. This is kind of hiding in a higher level format specification. It's kind of like in band data hiding except at a different level of granularity. Most people would recognize this with steganography. You think about steganography where you try to hide data within, say, a picture. So you can take a picture. You can manipulate the bits in such a way that you hide data in there but the picture still looks the same. Similarly, you could take a Word document and you could add extra spaces. You could add maybe tabs and new lines in a way that it doesn't make it look any different to the naked eye but actually it's storing information that you might want to be hiding. There was a tool called Hydrant that came out a while ago and I haven't played with it in a while but it actually used redundancies in the i3886 opcodes to restructure the opcodes of a program in such a way that you could hide data. But it would still execute exactly the same. A really quite novel tool, I would say. And so that's kind of the application layer hiding. We're going to do a little more analysis on each of these because it's important to think about if you're going to hide something, how should you do it? Specifically, forensic tools know about many of these methods. Alternate file streams, they know about that. Slack space at the end of files, they know about that too. And they will flag the data as such. They'll say, hey, this data is hiding. It's an alternate file stream. It will just show it as if it were a separate file. Similarly, if you were using a strings or signature search across a whole hard drive, you're going to find the data if you know what to look for no matter where it is. So say you're a forensic analyst and you think somebody's hiding data on this hard drive. Well, if you know they're hiding some special character sequence, you can just search from beginning to end and you're going to find it. There's ways to get around that obviously with encryption obfuscation. But that obviously, even our methods of hiding are not going to be able to hide if they know exactly what they're looking for. But just going a little further, experienced analysts are going to find stuff beyond what the tools give them. As long as they have the time and money available and they know that there's something there they need to find, they're going to be able to find it. Fortunately for us, they usually don't have the time available to them. Okay. So let's just do pros and cons of each of these. Out-of-band analysis. The strengths is that being outside the boundaries means you're often overlooked. I mean, how many of you guys have actually looked at the space beyond the end of your partition? Probably, well, a few of you have. That's good. That's good. You're on top of things. But I'll be honest. I've never brought up the hex editor to look at the end of the drive. There's often a lot of space available there. But it is hard to discover without special tools and it's also resilient. The weakness is that it's also hard to access without special tools. You know, if you just do a file open, you can't do it on the space beyond the end of the drive. I mean, you could, well, I won't get into all that, but it's harder to access, basically. And it's hard to hide from plain sight analysis. So as the gentleman back there was saying, he's actually looked at the end of the drive. Well, if you open a hex editor to look at it, well, you're kind of a sitting duck to say the least. In-band analysis. The strengths are that it's usually easy to access. It's easy to access with existing tools. So you can use your regular file system calls to do things. You're not breaking the specifications. So you're using the system the way it was intended to use, even if it's maybe kind of an obscure way of using it. You're less devious in some senses because you're not doing anything illegal. The weakness is that the storage space is often small and scattered. You'll have a few bytes here, a few bytes there, but you don't have a contiguous big space to hide data in. And that... Part of our FRAGFS is we address that issue, and we'll get into that a little bit more. And you're relying on security through obscurity. So as soon as the method becomes known, such as alternate file streams, it's not really worth anything anymore. And the specifications may change. That great hiding location you used to have is now either being used for something else or it's no longer useful, basically. Application layer analysis. The biggest strength is you're hiding in plain sight. I can show you a picture. You would never know that there was data hidden within it. If you had the right tools, you might be able to detect it, but nine times out of ten, it just looks like a picture. So you're hard to detect. You're hiding in plain sight. Obviously your weakness is that the amount of storage space you have relies on the size of the data you're trying to hide within. So the bigger the picture, the more you can hide there. But obviously that's a trade-off. It's difficult to access without special tools. You need special algorithms to do this kind of hiding in a way that's not going to be obvious. I think it's Johnny Long that presented where he just opened up MP3 and typed some text in there. You can make it a little more obscure than that, but that was one way to do it. So they're complex algorithms, and it's not very resilient. If the data, if somebody opens the picture in Photoshop and changes it, then you just lost all your hidden data, which may be okay, but we're trying to be resilient here. We're trying to be persistent in some ways. So let's look at just a screenshot here of NCASE. It's detecting alternate file streams. As you can see, well, the text is a little bit small, but the first one that's checked there, 11452, is test file. And I created an alternate file stream. I just opened the command prompt, and I said, you know, cat this data into test file dot hidden. And so it created an alternate file stream of the same file. So in Windows Explorer, you only see one file, but NCASE obviously will show you the second file as if it were something different. So in the bottom, you can see a hex dump of what that second data is. It says, this is our hidden text in an alternate data stream. Not very exciting. Slacker similarly is hiding, again, at the end of files, in the Slack space at the end of files. And NCASE will mark any space that's beyond the end of a file, I mean, that still belongs to the file, but it's not, like, within the file size, it'll mark it in red. So obviously at the bottom there, I've highlighted that with the cursor, but that data in red, it's obviously not supposed to be there. It should just be nulls. So NCASE is pretty good about detecting those kind of things. So now Matt's going to talk to us a little bit about finding new places to hide. MATTHEW HENDERSHOT Yeah, my section of the talk is going to be, basically it's a case study. My goal is that, nothing we're showing is necessarily super revolutionary, like, our ideas and how we do things are somewhat similar to what people have done in the past. But I also want to, a lot of people don't know how this works. So the goal of this part of the talk is to help step you through how you would find a new place to hide, or if you're an analyst, how to think like people are trying to hide their data. Where you want to look where you currently aren't, where your tools aren't going to show you what are the things you need to look out for. And the basic start off is, you want to hide some data. When you're doing so, you have to figure out the domain of your problem. How much space do you want to hide? Do you need a few K to hide what you're hiding? Do you want several minutes? Do you want megabytes? Maybe you want gigabytes. Do you want to hide movie files or something? Like, those are very different problems. Also, you want to figure out what type of access. Do you just want to be able to read and write it? Do you want to be able to execute programs? Things like that. Also, what are your performance requirements? Does this need to be like high speed access? Can you write it really slowly? Do you need to read it quickly? And that can make a difference in how you hide things. For example, Stego tends to be very slow. Algorithms are complex. So that might not work if you have high speed data requirements. Also, how sensitive your data is it? Is it OK if your forensic analyst finds it? Like, how bad is that for you? And how well do you want to hide it beyond just making it less obvious where it's at, but actually, if they see it, can they tell what it is? Finally, is how long does it need to stay around? Is it something that's going to be like, do you need an hour to store on disk? Are you talking about months on disk? And what place do you want to hide it? And how do you want to hide it? Those things will affect. Once you figure out a basic idea of what you want to do, start looking at how people have hidden before. Because any time someone's presented how to hide data or whatever else, you've got tools out there that will detect it. And if you're serious about hiding stuff, you don't want to use something people already know about. You want to come up with something new. Then start looking at some file system specifications and try to find new places to hide within them. And what you're looking for within the file system are something that's unused, reserved, otherwise not being used by something else. We chose, in this case, NTFS because it's used on Windows. It's the default file system since NT 3.5. And XP has it, 2003 has it, Vista will use it. They talked about putting a new file system, which really was a new file system, was NTFS with a database added to it. But even that they're not doing, it's going to be NTFS just by itself. The core part of NTFS is what they call the master file system table or master file table. And this is the, it's an actual file on the drive that holds all the metadata, all the information about all the other files and directors on the entire system. It's stored in one place. And it's a big table. It's got entries. A file, a directory, they all have entries within this big table that store information about them. And it's this big file that grows as you add more files. And it's this big file that grows as you add more files. to your system. But it doesn't actually shrink. If you delete a whole bunch of files, it doesn't get smaller suddenly. Unfortunately, this is something that's not very well documented or understood. It's Microsoft proprietary. They don't release, they don't talk about it. Fortunately, some people in the Linux community have worked very hard for several years to reverse engineer it. And there's a lot known about it. Unfortunately, not everything we'd like, but enough to serve our purposes at least. Looking more closely, what we know by reverse engineering this, file system is that you have these entries in the MFT and they all have a fixed size when you're forming a drive it makes them each a size by default this is 1k on Windows for each entry and each of these file every file and directory system normally takes up one entry technically they can take up more but generally it's one entry per file and the information about each entry is stored as attributes there's a whole bunch of different attributes for each file and it can be stored in any order to help explain what those attributes are basically an attribute is this block of data they've got types associated with them there's lots of different types there's 13 different types of metadata currently in NTFS and basically these attributes some of them can be repeated for example we talked about alternate data streams there is a attribute that's type data for for files and you can have more than one attribute of type data for a file and that's how you keep as many streams of data as you want for a single file name it's just by adding more attributes to it and directories each directory is stored as an attribute and each of the attributes can have different characteristics you can have them some of them can have names some of them can be compressed or encrypted and you have different attributes that each one can have independently and important for us ends up being this feature they call resident or non-resident and what that really means is a resident attributes something which stored in the MFT itself and compare that to non-resident non-resident would mean it's an attribute where the MFT has a pointer to where else on disk it is for example with a file if you have a hundred byte file and NTFS it will store the entire file in the data attribute in MFT itself but if it's like 200k file it's way too big to fit in MFT so they have a pointer to worlds on disk that data is at. And that's the difference between resident and non-resident attributes. A little more examples of what you'll see is what you'll see during forensic analysis is you're going to look at two things that show up immediately, everyone looks at is the standard information attribute and the file name attribute. These have your timestamps, your file names, all that sort of information stored in those attributes. And basically every file has them. Every directory has them. They're just there. All files have a data attribute, of course, even if it's zero length you have a data attribute that says hey, I have no data. Directories are interesting because you look at them and every directory entry stores a separate attribute. Actually more importantly it stores two attributes currently, which is you have the long file name that stores an attribute and the dos file name that stores a separate attribute. So it ends up taking a lot of attributes for every directory. If you've got 2,000 files in a directory, you've got 4,000 attributes for that directory, which is quite a few. And once you're, after all the attributes, because they're stored in any order, the sort of mismatch, they can go whatever, they have this little marker that says, hey, there's no more attributes for this current MFT entry. So it knows to stop trying to parse the MFT for it. And as I said a little bit earlier, you've got 13 attributes. Currently, you only use about five of those 13 different types, because you've got a whole bunch of ones kept over from like NT days, they did security differently, but all those attribute types still exist, but they're not currently used by Windows XP, for example. So if you're thinking about, hey, where might I hide data, well, I could use an old attribute maybe to put data there or something. To help explain this hopefully better, I have a picture here, a little example MFT entry. You've got a little MFT header. You've got a little MFT header. It's got all sorts of different information, different flags about what it is. Is this a deleted MFT entry or not? Such things. Then you've got, for example, over here, you've got a resident attribute. It's got a little bit of header information. Then at the bottom of it, it's got a whole bunch of attribute data for whatever goes with that attribute. If it was, say, data, that might be data for your file, it might be a directory entry, so on and so forth. Below that, you might have a different non-resident attribute that is very similar. Similar information, except at the bottom it's got what you call a data run that says, hey, this is where else on disk to look for this attribute. Then you might have variable number of different attributes, and finally, an end of attribute marker. After that, you've got a whole bunch of slack space to your 1K boundary. So we're thinking, hey, that's basically how it works. I want to go, okay, so this is MFT. We want to look at, let's hide some information there. Let's see what we can do. So let's look for places. We can hide it. Looking at Nband, you've got a whole bunch of reserve space. You end up a whole bunch of bytes in every attribute are reserved. And doing a little bit of research analysis of live systems, we found out that for every file on the system, you've got about 32 bytes of reserve space within its attributes. And for every directory, about 64 bytes. That's not a whole lot of data. Maybe it'll work if you want to hide just a small amount of data, but that's not much. But what's more interesting is that you've got a whole bunch of slack space after every MFT entry. Is that normally an average file directory, whatever, on a system has about 450 bytes of attributes stored within the MFT. Yet it's formatted to be 1K in size. So you have almost 600 bytes for every single file or directory on your system that's there and unused. Seems like a lot of space. So we want to look at, well, how can we use that? What are things we have to worry about? Well, first is what happens when people delete files? Fortunately for us, NTFS has this thing where when you delete a file, it marks a bit in the MFT entry that says it's deleted. It doesn't actually delete anything except says we're not valid anymore. Actually the entries will get deleted if that MFT entry is ever reallocated for a new file, will zero everything out. But otherwise it just stays there. So if somebody deletes an MFT entry which you're using, it's still there. They changed one bit. The reserved space, though you have a problem with, is that NTFS has changed. There's been five or six different versions basically, if you count the minor versions of it. So it might change in the future. Some of the currently reserved space might go away, some new stuff might become reserved, so on and so forth. So you have that problem of, hey, technology might change, what we're doing now doesn't work. And you also have a problem of all that reserved space, it's zeroed normally. So hey, if you're a forensic analyst and there's some non-zero reserved space in MFT, you have a good hint that something's going on there. It's pretty obvious that something's wrong. Looking at the after attribute slack space, you have a problem of these are attributes and they might expand and grow. Someone adds more data to a file. Someone adds an alternate data stream to a file. You suddenly got another attribute taking up space, and all that slack space you thought you had may go away dynamically on a system. So that's a pretty big concern. On the other hand, we actually have an advantage here is that because of how the MFT works dynamically, that space isn't always zeroed, is that NTFS only changes stuff on the drive it has to. If it gets rid of an attribute or something, it doesn't zero out that space. It just marks it as no longer used. The end of attribute marker will just move up higher if you delete an attribute. It won't actually remove the old data. It will still keep it and write it back to disk, which means you end up with a whole bunch of garbage in the supposed slack space. This is really common in directories. For example, if you have a directory, the first five or six files you add to it, all of that information is stored in MFT. But after that point, it gets bigger than 1K, so it copies it all out to disk somewhere else and puts a little non-resident attribute in that says, here's where all the directory information is really stored at. It keeps the old directory information still there, though. So it looks like if you're just looking at a raw hex dump of it, you're like, where does the attributes end and whatever else, because it's not clear unless you really understand what's going on because of how it does that. Well we talked a little about these problems, now let's go into how can we avoid them. What are techniques we can use so that these problems don't become a real problem for us, that we can get around them? The basic idea is, let's find some safe entries. Let's find some safe MFT entries. Some things are more safe than others. And the basic idea is that some files rarely get modified or deleted. Operating system files, you install your operating system. You get patches, but a lot of operating system files never change. Font files are a great example. You might add new fonts to your system, but who deletes fonts off their systems or modifies the font files? It's very rare. You also have a thing of... Old files tend to be pretty safe. People install the applications they use as soon as they get a machine, and they're not likely to delete them. They might upgrade them, but they don't delete them. And so those files tend to stay around. You also have another interesting characteristic of NTFS, talking about attributes possibly growing and stuff, is that once an attribute goes non-resident, it never becomes resident again. If you have this big file and you truncate it down to zero size, it doesn't make the data attribute suddenly resident again. It still keeps it non-resident. It keeps blocks allocated elsewhere on disk for it. So we know that attributes themselves won't tend to grow a lot. Non-resident attributes don't tend to grow a lot. You also have a thing of directories tend not to get deleted. Various reasons. You have to delete all the files is a basic one. And even that, a lot of uninstaller programs, if you notice, won't even delete the directories for the programs that uninstall. Like you have to go back and manually delete them all. A lot of people don't do that. So director entries tend to stay around. Which is quite useful to know. Basic summary is, if you're looking for safe MFT entries to put data in, you want to look for something that has non-resident attributes, it's never been modified, because files that aren't modified don't tend to be, and it's been around for a long time. Okay. Well. Talked a little about. Okay. About NTFS. I want to go, well, how much can we actually store? What are we actually talking about? And basically is, if you stall Windows XP, base professional install, 12,000 MFT entries by default. That's how many files and directories it has. Most systems have at least 100,000. I know Erby's laptop has 230,000 MFT entries in it. And not all of these are safe. Using our basic metrics, we found about 60% of MFT entries we'd consider safe. In looking at the case, we're looking at, we want to look at the Slack space height and then the attributes. So we're talking about 600 bytes per entry. 100,000 entries. At 60% of them we'd consider safe enough to store data in. That gives us 36 megabytes of hidden storage on an average NTFS drive. That's a lot of storage. That's a lot of storage for something that you can't see. Or most people can't see. But there's still a few issues about actually implementing this and getting this to work. The first issue is that you've got 600-byte chunks all over the disk. And that tends not to be very useful. So you want to have a technique where you can map these different chunks across the disk into a contiguous address space. Something that you can access like it's flat, like it's a drive itself even, so that all your current IDs of how you access files, write files, do all of that stuff, you can do all that sort of stuff, work. You don't have to change your pentagram of thinking about how you access your data in order to use this. Also you want to have that mapping system be dynamic. We try to be safe and not lose an MFT entry, but what happens if we do? We want a way to be able to replace it, perhaps grow if we need more space, people add more files to their file system. We're able to dynamically change how we're doing stuff to keep up and modify and try to maintain both our percentage. We need some sort of dynamic mapping. You also have to think about no matter where you hide, no matter whatever else, forensic analysts will be able to find you. If they really want to and they have enough time, they'll find you. They can do a string search across the drive and find some data. So you have to think about more than just hiding out of their vision, what happens when they do find you? And big thing there is encryption. Maybe you just want XOR. That's good enough for you. We gave talk earlier this year and at that time our proof of concept code used Blowfish, which was okay. Now we've gone to GCM AES, which is actually a data encryption specifically designed for data storage. And the advantage here is note is that it's authenticating encryption. You can tell when an encrypted data block gets changed and that's quite useful is if somebody overwrites your header. Overwritten data. You know that it got overwritten. You can say I might not have the data anymore but at least I know something changed. And you can do that with your encryption if you use the right algorithms. That's quite useful. Unfortunately with all encryption is key management is pretty hard. Well if someone only has a raw hard drive that pulled it out, they might have a hard time getting your key back. If you use some key dispersal algorithms and stuff, you can make it really hard for forensic analysts to say well here's an encryption key to decode all the rest of the data. But if they have it on a live running system and can do run time analysis and watch you as you encrypt and decrypt, you're pretty much gone. They can find your encryption key and they'll get your encrypted data if they want. That's an unfortunate thing and I wish there were better ways to do it but currently nobody's really figured out a way that I know of to do so. But that doesn't mean we should throw it out. Encryption is still quite useful. You also have the problem here of changing the way you encrypt. You also have the problem here of changing the way you encrypt. You also have the problem here of changing the way you encrypt. Change tracking is basically the thing is what happens when Windows decides to change your files. Fortunately, it doesn't change what doesn't need to change. But it does change some of it and we might lose our data. As talked about, you want to be able to dynamically remap it, so on and so forth. Checksums work. We've gone to authenticated encryption. That works quite well. But actually for this technique, we found one of the best things to do is just keep extra copies of your data around. Is that if you are smart about it and you use different MFT entries, it's unlikely two files on different parts of the system will change at the exact same time and you'll lose both copies of your data. So if you keep two, three, four copies of it, you can say, hey, I lost one copy. Let's make a new copy somewhere else and keep up with any file system changes. You also have the problem of NTFS might notice some changes you do on your file system. Fortunately, if you use the slack space at the end of attributes, they tend not to notice, which is very good. Ultimately, you'd really like to watch your file system changing, the disk, and be able to respond to say, hey, it's going to overwrite my data. I want to move my data before it does so. That's possible, but it's complicated. I won't go into it in this talk, but as a note, if you're really interested, it can be done. Finally, you want to think a little bit about usability. You've got your space. You know we're going to hide. We're going to hide in this case slack space at the end. And after the attributes in the MFT table. But how are we going to use it? Well the big thing is none of us want to rewrite all our applications and suddenly use this hidden data area. So you want to be able to write some way of accessing it that uses standard techniques. You also have to worry about how it's presented to the operating system. Does the operating system even recognize it? Is it something it sees it doesn't see? And the big thing is standard interfaces. And see your files read, write, open, close, those kind of things are very useful. Unfortunately file execution on Windows is very hard. Windows because of how it does file execution says it will only run files out of file systems it recognizes. So to get it to run an executable out of the hidden data area is actually quite difficult. But if you can convince it that it knows what file system you're running, it works great. Specifically. I'll go now move on to the final parts which is what FragFS actually does. Basically what we do with FragFS is proof of concept code that this technique actually works. And it starts up, you tell it to format. It will scan the entire MFT on your system and look for what it considers safe entries. And then it will put how much space is in each entry and it will put a little chunk of data there. In this case there are 160 byte chunks of data. Any. And if you have 320 bytes it will put two chunks in one entry and so on and so forth. And the advantage of this technique is that we keep no indexing of any of the blocks we use on disk. And I know for example like Slacker and some of the other tools that come out, all the forensics tools detect them by their indexes. They don't actually look for data, they just look for index pointing to where the hidden data is at. And we totally avoid that by each block has all the information it needs to be a data. And that's quite useful. Basically how it works is we have unlimited redundancy, you can keep as many copies of each block of data as you want. When you format you tell it how many times. It detects when it's been modified and can respond to that. If you lose one chunk you don't lose them all because each one is independent. There's nothing to be, there's no central database that can be overridden. And each chunk can easily be relocated, if one of it is overridden you can take a copy and put it somewhere else on disk, quite fine. Unfortunately it does have a disadvantage by doing this is that you have to scan the entire MFT to find all the chunks for your hidden data before you can actually start modifying stuff. Which can be slow but if you cache that information and keep it in memory you don't have to keep rescanning. Specifically we have two different versions of the code. One is a user space library which you can basically link programs against, provide standard interfaces of open read write, has a built in mini file system in it, basically store files like they were just normal files and read and write from it. Can link with any program. Specifically actually people are interested in if the Black Hat website from Black Hat Federal actually has the demo code you can download executables of it. And we also have a demo code. For a kernel driver which is actually much more sophisticated and works in the kernel and can create a virtual drive on the system that Windows sees as a DOS drive. And you can actually run programs out of it and do everything like it was a normal drive. Interestingly enough because of how you can set up those virtual drives it won't show up in Windows Explorer but will show up from command prompt into programs. And finally. Everybody will give a check. So that's the demo of the user space code. All right guys. Well now for the more fun part. No offense. What is this code actually doing? The proof of concept is called hammer.exe. I've run it here. I've gone ahead and started it. And obviously you have a bunch of options. The most important is what drive you want to do this on. Obviously if there's more than one hard drive. You can do it separately for each one. There's a format command which is what we run first. And I just actually have run it. And what the format will do is set up the MFT or set up our hidden space so that we can use it. I've just run the format command here and it says with four times redundancy which means we're keeping four copies of each byte. We have a little over 15 megabytes available. So in my system standard 40 gig laptop that's 60 megabytes of hidden space. In the MFT. Just slack space that Microsoft decided wasn't important. So the next thing I'm going to do is store a file. If I do a DIR we have usage.txt. Let's just put that into our hidden file system. Then we'll take a look at it and then we'll pull it back out so you guys can see it. So I'm going to run hammer. I'm going to say I want to do it on drive C. I'm going to store usage.txt. I'm going to store it as file number one. And what this is doing is as Matt said. The library at user space library has a mini file system in it. And basically it just stores files as numbers. So you can go file number one, file number two. Whatever. So it's going to take a little bit of time. Hopefully not too long. Because what it's doing right now is reading the entire MFT. And that's the trade off of our system. By not having a central index we have to read the entire MFT which causes it to be a little bit slow. But we've stored a file in there now. We can actually list the files that are in the system. In the hidden area. And it will go through again the MFT. It will find all the hidden files. It's going to show you file number zero. Which is the actual book keeping information. And then file number one which is the file we just hid. So there we go. File number zero. And file number one. File number zero is not really useful. Well it is useful for us. But not really so much to store data in. So now let's pull it back out. Retrieve data. Retrieve number one. And store this file name. Usage two dot text. So now what it's going to do. It's going to pull the file that we just stored back out. Put it back on the regular hard drive. And we'll do a comparison to make sure those two files are the same. Unless something fails they will be. So let's compare usage text. Usage two dot text. And they are the same file. If I do a DIR you can see they are the exact same size. So that would be basically how the tool works. There are a few other options. As far as if you want to get rid of yourself off the drive. You can run the cleanse command. And it's like you were never there. Which can be useful obviously. So I'm going to go a little bit further. We're going to look at a little bit of detection. How do you detect this? Well current forensic tools don't. They treat the MFT as a black box. They don't know what the MFT is supposed to look like. They know how to look at all the files on the drive. But they don't really look at the MFT for its own sake. And it's a pretty big chunk of the drive. So there's a need for the forensic tools to understand the file structure. The file structure is better. And the analysts don't have time to comb through hex stumps. And even if they do I'll show you what it looks like. It's not obvious really that you're there. We did develop a detection tool specifically for detecting ourselves. So since we knew how we were hiding. We thought we'd be good guys. And also develop a way of detecting that. We consider any data beyond the end of attribute marker to be suspicious. So I'll flip back over. Our detection tool is called Looker. And I'll just run Looker. See what the options are. Because I never can remember. So we want to do a verbose. Which will print out dumps of interesting information. And I'm going to skip directory entry. Because if you remember Matt said earlier. When directory entries become non-resident. Microsoft doesn't ever clean them out. And so you can get false positives there. It's just easier for me to skip them. It'll be nice if I actually put the drive letter within there. So it's scanning through. It's seeing like some junk data. And there if you can see it. I just stopped. There's our usage text. Actually hiding beyond the end of attribute marker of different MFT entries. So an entry number 190. We found data at offset 760. So that's how the detection tool works. Both of those are on the Black Hat website. From Black Hat Federal this past year. And feel free to pull them down. And take a look. Play with them. No. We didn't get the source code out. Because we had some other interested parties. All right. Finally. I just wanted to show you what NCASE finds. NCASE is kind of the defacto forensic tool. And I basically scanned. I pulled up the MFT. I opened up the hex view window. And I just started scanning through it. And it took about ten minutes. And I finally got to an MFT entry that had some hidden data in it. At the very beginning you can see there's a magic number. It's called file zero. That just is a magic number for an MFT entry. Then you'll see the different attributes there at the top. And there's a little bit of. There's the four double Fs. Which is the end of attribute marker. There's a little bit of slack space. And then our hidden data. Now obviously that's encrypted data. It's somewhat more dense than the data above it. But obviously you could mitigate that if you really wanted to do some kind of statistical analysis. So that you looked the same. We just chose to dump ourselves in there. NCASE doesn't do any kind of like flagging or marking. Doesn't show that hey this is something suspect. It doesn't know what it is. It doesn't know anything about it. So. Pretty well hidden there. Unless analysts start doing a bit by bit. You know. Search of the raw drive. So. I've already showed you the detection demonstration. Future considerations. Obviously hiding through obscurity only buys you time. Now that we've. You know. Discussed this. It's not nearly as useful as it would have been. A few months ago. Yeah. Well. There's still no tool that detects it. But. It's. You know. We have other ways to hide. There are many other unexplored data storage areas. So. This was just one place we saw. Hey. This is kind of cool. Look at all this space. We can hide there. But there's plenty of other places to do similar type stuff. And the way we built our tools. We can just retarget it towards whatever space we want to hide in. You still have the problem of hiding the access tools. So. The Hammer and Looker executables were residing in the normal file system. And. We've kind of been looking at ways. How can we bootstrap ourselves out of the hidden space. So. That we never have anything. That's not in the hidden space. And that's. A pretty hard problem. We've got some leads on how to do that. But we haven't explored it fully yet. And then. I just want to close with kind of a side thought. And that's. Should file system standards be open. Or at least like. The specs be published. If they were. The forensics tools could do a better job of understanding. Hey. This is good data. This is what good data looks like. There's also kind of the counter argument. Would it be easier to exploit file systems. If. You know. Somebody could look at the source code. And find a little flaw or whatever. My general feeling is. If. It's open. It's just better for everybody. The forensic tools know exactly what good data looks like. Anything that doesn't fit that. Is automatically suspect. A hacker only has to find. One way to hide. Whereas. Somebody trying to play defense. Has to think of every possible way a hacker would try. To hide. Or. Do whatever they want to do. So. I'm all for. Just. You know. Opening the spec. At least. At least. You know. Just publishing. What it's supposed to look like. So. I hope you guys have some questions. Feel free to. You know. Stick around. Or. Give us questions. Go ahead. . Are we done? Yeah. Well. . Question. . . Never mind. Do we have questions. Do you do exercises. Oh, yeah. Guys. If you do have questions. Either go to the mic. Or. We can talk offline. But your question was. . . . I just sent in some percentage of the stuff. . You could consider stable to use. Is there like a way of algorithm. So that it's part of the . Well. Actually. It is part of our algorithm. That's how we come up with the 60% number. Actually. The question was is. It said like 40%. percent isn't stable for storing stuff in is I cannot be algorithmically determined. And actually it was. That number came from algorithm. I didn't say it, but it's basically the file never been modified. It's been more than a year old. Those are the two key characteristics. And if those things are true, it's unlikely to be modified any time soon. Yeah. Does it work in the VMware? Yes. In fact, that's where I did the initial testing. How does EFS affect it? Does what? EFS. EFS. Encrypted file system for NT. EFS actually works by encrypting individual attributes such as the data attribute would be encrypted. So in fact, it actually makes no difference whatsoever because we ignore the normal attributes. We store ourselves after them. EFS doesn't do a whole drive encryption. It only does per data stream encryption. So it does like the AC. So it's like the ACL instead of the MTF or MFT. Yeah. Okay. So therefore, we don't interfere with it. Yeah. Okay. So the MFT is outside of EFS? Correct. Okay. Are you aware of anything that actually is using some of these techniques that you're talking about? None that I can talk about publicly. At techno security, there was quite a bit of discussion about, you know, everything's going to EFS and the current standard of imaging an entire drive is probably going to go away, which, you know, means that there's just going to be specialized tools to find, you know, certain types of data in certain ways. You know, is that going to make it easier then to find stuff that is hidden in Slack space, et cetera? Well, yes and no. Take your question as, is that... In some senses, yes and no, because ultimately, you have to have a file system. Even if you have a whole drive underneath the file system, there's still the file system on top. And even if your data is getting encrypted by the encryption layer, you can still store yourself in the file system where people aren't looking now. So it will change somewhat, but not... The fundamental concepts stay the same. Let me give you my personal view, okay? Does that... How it's going to change?