1 00:00:00,000 --> 00:00:06,000 Please join me in welcoming Chapo and XLOGICX. (Applause) >> Hi, DEF CON. Can you hear 2 00:00:13,250 --> 00:00:19,250 me? Well I can hold it closer. >> How it everybody doing? Good time? >> Woo-hoo! >> Serious 3 00:00:21,458 --> 00:00:27,458 business here, what's up? You'll have it in a minute. Yeah. In a minute. All right. So no bio 4 00:00:31,792 --> 00:00:37,458 stuff, just gonna get right into it. Gonna get really off-topic for like the first 20 minutes 5 00:00:37,458 --> 00:00:41,583 until we gradually get on-topic because I like talking about formal systems so we'll talk 6 00:00:41,583 --> 00:00:47,583 about philosophical regressions. Although we'll be talking about automated security tools and how 7 00:00:51,458 --> 00:00:57,458 we need automation but if you rely on it too much you can run into problems. But anyway, so on 8 00:00:57,458 --> 00:01:02,417 formal systems, so a game I played a lot as a kid, it wasn't that it was challenging, whereas 9 00:01:02,417 --> 00:01:09,167 other people they start with the challenge. But not us. We could do it in a minute or less. What 10 00:01:09,167 --> 00:01:14,833 I was fascinated about as a kid was half the different communications or combinations 11 00:01:14,833 --> 00:01:20,458 of this are impossible. So in this case if you guys have ever, this is interactive, if you guys 12 00:01:20,458 --> 00:01:26,542 have ever tried to solve this in order so you have to get that 1 all the way up there, totally -- 13 00:01:26,542 --> 00:01:33,208 won't waste my time but at least get the 1 up there. Okay. 2 is close enough. Anyway, this is 14 00:01:33,208 --> 00:01:41,083 unsolvable. If I wanted to get 1 through 15. But I could get 15 backwards which you can't if you 15 00:01:41,083 --> 00:01:48,250 just buy one of those. Nothing else on that, just find that really interesting. You're 16 00:01:48,250 --> 00:01:55,333 welcome. >> (Speaking off-mic). >> This is the same concept. Show of hands. Who thinks they 17 00:01:55,333 --> 00:02:00,667 know why you couldn't solve this just based on this picture? Yeah! Yeah, every middle square 18 00:02:00,667 --> 00:02:06,667 is a unique square and people familiar with Rubik's cubes they know the most important square 19 00:02:09,208 --> 00:02:14,583 is the middle one. It doesn't change. I also find this interesting. This is a game that 20 00:02:14,583 --> 00:02:17,125 maybe you would never end up playing naturally, chess, it starts like this, very 21 00:02:17,125 --> 00:02:22,333 interesting chess -- called chess 960. You stall the pawns but the pack peoples you 22 00:02:22,333 --> 00:02:28,125 randomize and black and white near the randomization. All these examples I need to update, 23 00:02:28,125 --> 00:02:34,125 all these are in the same theme of formal systems are not breaking the rules, we are 24 00:02:40,083 --> 00:02:44,917 either changing environment or starting positions and first three examples we change 25 00:02:44,917 --> 00:02:50,917 starting positions. Here are examples of changing environment. 3-D, Qbert, the 26 00:02:54,000 --> 00:02:59,000 point is like the first two are like, yeah, okay, you're being trolled with this impossible 27 00:02:59,000 --> 00:03:04,125 situation but it doesn't have to be that way. You might actually end up playing an interesting 28 00:03:04,125 --> 00:03:11,708 and fun game of chess. This is another example of changing the environment. So some of you may 29 00:03:11,708 --> 00:03:18,125 have seen this video. There's this 23-minute video, I'll only do my favorite top hits, 50 30 00:03:18,125 --> 00:03:23,917 seconds but it's impossible -- not impossible but very challenging Mario level this guy 31 00:03:23,917 --> 00:03:29,917 plays but it's a funny video just because of how rant he is. Look it up, type in impossible 32 00:03:32,500 --> 00:03:38,292 Mario level guy rants, whatever, you'll find it. Here is my favorite parts of it. I'll make 33 00:03:38,292 --> 00:03:44,292 it a little bit bigger. Level starts out that way. (Laughter) >> That's my favorite right 34 00:03:59,958 --> 00:04:05,958 there! (Laughter) >> I would have audio but I sliced so much together it would have been 35 00:04:28,042 --> 00:04:34,292 choppy. Check it out on YouTube. It's hilarious, more than that. You are gonna have to watch it. 36 00:04:34,292 --> 00:04:40,292 Changing gears here on wrecking the earth with resonant frequencies, I have a -- Tesla, 37 00:04:43,667 --> 00:04:49,667 I won't get in detail with that, just skip along sort of on that theme, though. Has anybody ever 38 00:04:52,750 --> 00:04:58,750 read this book? Awesome. Okay. It's by far my favorite book, not even on a margin. My second 39 00:05:03,375 --> 00:05:08,125 favorite book would still be 110/10 and it's not about computers or hacking but what I 40 00:05:08,125 --> 00:05:14,042 learned about hacking is from this book, formal systems, more than that, though, if you 41 00:05:14,042 --> 00:05:20,500 haven't heard of this book check it out, read a preview but read this book, it's awesome. But 42 00:05:20,500 --> 00:05:25,917 about 100 pages deep the author in between chapters talks about this scenario. This scenario 43 00:05:25,917 --> 00:05:31,792 of -- these illustrations are from a friend of mine, not from the book. This is the tortoise 44 00:05:31,792 --> 00:05:36,958 and the crab and the crab is the instigator here, giving the tortoise the record, record 45 00:05:36,958 --> 00:05:42,958 player is supposed to be high Fidelity, not only very high Fidelity but should be able to 46 00:05:42,958 --> 00:05:48,292 reproduce any sound. I'm looking at this as our signature-based system. The crab is trying to 47 00:05:48,292 --> 00:05:54,500 foil this. He has a record that has a resonant frequency either geared for the horn or wood on 48 00:05:54,500 --> 00:05:58,042 the record player but resonant frequency that will cripple that record player. So that's the 49 00:05:58,042 --> 00:06:04,042 black record there, and that happens. So to try to defeat that he builds a more signature 50 00:06:06,417 --> 00:06:11,958 basis that might detect those frequencies so you have this red needle that is analyzing the 51 00:06:11,958 --> 00:06:17,458 record to try to avoid this. You run into problems with that, too, say the record player 52 00:06:17,458 --> 00:06:22,833 detects signature and decides not to play it. Now the record player that is high Fidelity is 53 00:06:22,833 --> 00:06:29,125 not reproducing every sound. So you fail that way. Or say this is just an evasion technique and 54 00:06:29,125 --> 00:06:36,333 the record still plays and still destroys the record player. Like that. So another solution, this 55 00:06:36,333 --> 00:06:40,375 is like this cat-and-mouse, not supposed to be specific but another solution is let's have 56 00:06:40,375 --> 00:06:45,750 several different horns so when you give it a bad record you can switch to a different horn that 57 00:06:45,750 --> 00:06:49,375 can play that record but you can have a record player with several different tracks and 58 00:06:49,375 --> 00:06:56,625 destroy the horns and again, that's kind of the theme. Every system, I wouldn't say it's 59 00:06:56,625 --> 00:07:02,708 vulnerable to exploitation but I don't think there's any perfect system just because it does 60 00:07:02,708 --> 00:07:07,333 something. So it doesn't have to be exploitation. It could be malservice or doing something 61 00:07:07,333 --> 00:07:11,750 it's not meant to do which may not be damaging but still not a perfect system. It's doing 62 00:07:11,750 --> 00:07:17,083 something it wasn't designed to do. Now we'll get into more lower-tech, more familiar abuses 63 00:07:17,083 --> 00:07:24,458 and I'll hand it over to Ruben here. >> We're all very familiar with this picture here. 64 00:07:24,458 --> 00:07:30,458 You know, SQL injections, into database, it drops or SQL injections, typical. But in 65 00:07:35,000 --> 00:07:41,125 these cases here, it is more or less, not a signature base but still abusing a system in an odd 66 00:07:41,125 --> 00:07:46,292 kind of way. So this guy here, Robert, he ordered, he wanted the special license plate, he 67 00:07:46,292 --> 00:07:52,042 was really into sailing and boating and this kind of stuff. He wrote down first license 68 00:07:52,042 --> 00:07:58,042 plate I want I want it to say sailing. If I can't get that I want it to say boating and if I 69 00:08:00,167 --> 00:08:05,667 can't get that, then I wouldn't it to eventually just say -- >> No plate. >> No plate 70 00:08:05,667 --> 00:08:10,958 that's right. He wrote down no plate. What happens is obviously the first two were taken and he 71 00:08:10,958 --> 00:08:16,958 got a plate that said no plate. Well, with that eventually he ended up getting $2500 notices 72 00:08:21,083 --> 00:08:26,458 in the mail of violation and tickets because every type the cop would write no plate on the 73 00:08:26,458 --> 00:08:32,917 form, you know, exactly, you can see where this is going. He got all these violations. Same thing 74 00:08:32,917 --> 00:08:38,917 with this. So the first slide there, they switched it over to non-add missing and this guy the 75 00:08:41,500 --> 00:08:47,542 same issue. He had a plate that said missing and he got violations as well. This guy 76 00:08:47,542 --> 00:08:54,083 here, he thought he'd be cute to have his little motorcycle to say no tag, and really 77 00:08:54,083 --> 00:09:00,500 brilliant, and when license plates had no tag on them, the cops would write down no tag and 78 00:09:00,500 --> 00:09:05,542 he would -- his actually showed up with the 200 violations so when he got his license plate in 79 00:09:05,542 --> 00:09:11,542 the mail those violations were there already! (Laughter) Same thing with this guy. It's void. 80 00:09:14,875 --> 00:09:20,792 The unknown. And then this guy here, I guess his favorite number was 7 and they called him 81 00:09:20,792 --> 00:09:26,792 racer X, and he ended up being 19,000 worth of fines and his quote out of this article was, 82 00:09:29,833 --> 00:09:33,833 you know, he messed up the system so bad they were gonna send him to jail or something 83 00:09:33,833 --> 00:09:40,125 for doing this. This is kind of a unique way of showing, you know, when I guess we're kind of 84 00:09:40,125 --> 00:09:46,292 analyzing or not paying attention to specifics and certain systems you can really 85 00:09:46,292 --> 00:09:52,292 mess things up. So go ahead. >> Who is familiar with these? We all know what they do, right. 86 00:09:54,583 --> 00:09:59,083 >> We're from Arizona so we are really familiar. >> Who still has them in their state? I know 87 00:09:59,083 --> 00:10:04,958 they were trying to... >> So we are very familiar with these. Speeding tickets. Now, a while 88 00:10:04,958 --> 00:10:12,583 back I think in Maryland, these students thought it would be real neat, they graduated from 89 00:10:12,583 --> 00:10:20,500 elementary school and they hated their teachers, right, hated the teachers so they would actually 90 00:10:20,500 --> 00:10:27,750 photocopy their old teachers' license plate and run through the speeding ticket cameras and 91 00:10:27,750 --> 00:10:32,333 those tickets would actually go to their teachers, there was no validation of who was actually 92 00:10:32,333 --> 00:10:37,125 driving the car, and it says pimping because it's what they coined the term. Pimping or -- I 93 00:10:37,125 --> 00:10:43,125 don't know. (Laughter) There was no validation, you know, from this whole attack, if you will. 94 00:10:48,417 --> 00:10:54,542 So PirateEye is. Has anybody heard of it. >> Little obscure. >> PirateEye, well, first of 95 00:10:54,542 --> 00:11:00,542 all, they claim to be the leader in anti-piracy. Show the next slide here. >> Leader in some 96 00:11:03,917 --> 00:11:10,917 other stuff apparently. (Laughter) They really can use a Web admin or something. 97 00:11:10,917 --> 00:11:16,917 WordPress, pretty obvious how the attack -- (Laughter) Went down. But anyway pirate eye they 98 00:11:20,292 --> 00:11:26,458 do as I said anti-piracy in movie theaters, this story came about because some guy was 99 00:11:26,458 --> 00:11:33,500 wearing Google Glasses in a theater one night, when he was watching that movie he ended up 100 00:11:33,500 --> 00:11:39,375 getting escorted by three-letter agency or something, but what this service does is pretty much 101 00:11:39,375 --> 00:11:45,083 they put a little camera, if you will, mount it at the top of the theater and once the movie 102 00:11:45,083 --> 00:11:51,417 starts it actually starts recording. And their service is it kind of works like a security 103 00:11:51,417 --> 00:11:58,833 operations center, that device I constantly scanning three seats at a time for, you know, any 104 00:11:58,833 --> 00:12:04,750 recordable devices, camera phones, anything like that. And it got -- his Google Glasses got 105 00:12:04,750 --> 00:12:10,750 triggered by this. Once it does detect something possibly might be recording, they send off a 106 00:12:13,375 --> 00:12:19,250 text message or e-mail to their point of contact at that certain movie theater and say hey this 107 00:12:19,250 --> 00:12:24,292 guy was recording in your theater and essentially they try to get the guy arrested or 108 00:12:24,292 --> 00:12:30,417 whatever. So the attack against that, just abusing their systems a little bit and how you could 109 00:12:30,417 --> 00:12:36,458 just -- yeah, basically abusing and attacking them. XLOGICX came up here with spider eye. I guess 110 00:12:36,458 --> 00:12:41,667 it looks like a spider, spider's eye. >> So can you! >> Go ahead. >> So this is, this is 111 00:12:41,667 --> 00:12:47,667 my profile, I only have a couple things, this is an iPhone case, don't know if it will fit an 112 00:12:51,083 --> 00:12:57,083 iPhone, not the point. But I made it so it fits the like 100 or 50 lenses that I purchased. 113 00:13:00,042 --> 00:13:06,250 But it's open scan format so you can change that. That one global variable. So it's an iPhone case 114 00:13:06,250 --> 00:13:10,417 you put a little lens in so plausible, looks like it may be something you are recording in. 115 00:13:10,417 --> 00:13:16,083 You go into a theater, put the iPhone case in the cup holder, there's the chair, that's the 116 00:13:16,083 --> 00:13:21,083 theater (Laughter) >> I told XLOGICX it might be nice to put mannequins to look like real 117 00:13:21,083 --> 00:13:27,083 people! >> I'll take this a little bit here. Bar codes, I've done bar codes, stupid 118 00:13:31,417 --> 00:13:36,333 shenanigans with bar codes for quite a while but I don't like VIP cards and what they stand 119 00:13:36,333 --> 00:13:43,458 for. They are used for a lot more than what they were originally intended for, in bad 120 00:13:43,458 --> 00:13:48,750 ways. I think the main reason they first started, you have a thing called correlated goods, 121 00:13:48,750 --> 00:13:54,750 hot dogs and buns. If you are a grocery store retailer you can have a sale on hot dogs, but 122 00:13:57,458 --> 00:14:01,667 then jack up the price of buns so people are still paying either equal or more than they 123 00:14:03,833 --> 00:14:09,292 expected to. But that's obvious. People would catch on. Hot dogs and buns you might notice the 124 00:14:09,292 --> 00:14:15,083 buns cost more and you'd catch on to that. So you need to use statistics to find like less 125 00:14:15,083 --> 00:14:19,500 obvious correlated goods? Correlation and statistics that's just the right tool for 126 00:14:19,500 --> 00:14:25,792 the job. So one of the best ways is give everybody a discount card, savers card but 127 00:14:25,792 --> 00:14:30,375 it's really just data mining for those statistics. One thing that came out and I think I learned 128 00:14:30,375 --> 00:14:38,083 it from my use less MBA, marketing or something like that, it was wine and diapers 129 00:14:38,083 --> 00:14:42,875 was a significant correlated good! For some reason! (Laughter) It's funny but 130 00:14:42,875 --> 00:14:48,167 that's the point, it's not obvious, that was the initial reason and whatever, sort of 131 00:14:48,167 --> 00:14:53,542 evil but kind of Diet Coke of evil a little bit so that's their solution to that but kind 132 00:14:53,542 --> 00:14:58,583 of privacy things, so you can figure out shopping preferences, clothing size which could say a 133 00:14:58,583 --> 00:15:05,708 little bit about health, then smoking, alcohol, whatever pills, they will know if you own 134 00:15:05,708 --> 00:15:11,500 a pet. I was going to say birth control purchasing but there was a case of like just correlated 135 00:15:11,500 --> 00:15:17,500 thing that would indicate you are pregnant. Big story about that. And then health insurance 136 00:15:19,875 --> 00:15:26,042 claims. I forget the name of the program, it's called smart mouth, I don't know if they are 137 00:15:26,042 --> 00:15:32,042 still doing it. But HSA would buy this data right up and you might get a claim denied because 138 00:15:34,625 --> 00:15:40,625 of your saver card. So, yeah, things like ice cream means you're obese to a health 139 00:15:43,458 --> 00:15:49,333 insurance agency. Cardiovascular disease, meat, milk, cancer, additives, sweetener, which may 140 00:15:49,333 --> 00:15:56,208 or may not be the case but to them it is. In law enforcement I think they have been known to 141 00:15:56,208 --> 00:16:01,250 use it, too, but this case specifically I find interesting. It actually didn't get used in 142 00:16:01,250 --> 00:16:08,667 court, but they try to use it. Vons which I think is a subsidiary of Safeway, they had 143 00:16:08,667 --> 00:16:14,875 a yogurt spill in the aisle, someone slipped, fell, was hospitalized for about ten days 144 00:16:14,875 --> 00:16:19,708 and then tried to Sue to recoup some losses which I don't care about the politics of that. He's 145 00:16:19,708 --> 00:16:24,375 probably in the right for doing that but that's not the point. Vons was trying to data-mine his 146 00:16:24,375 --> 00:16:31,125 card to see how much alcohol he was purchasing to build a case against him. They didn't end up 147 00:16:31,125 --> 00:16:35,750 using that in court and my theory on that is that that would be showing their hand. If 148 00:16:35,750 --> 00:16:40,500 they started doing that, that would precedent a precedent that would do that and people would 149 00:16:40,500 --> 00:16:47,708 be more skeptical about cards. >> Not just with the special shopper cards, but nowadays also 150 00:16:47,708 --> 00:16:52,417 they're also tracking by debit, credit card and all this good stuff. They'll present out 151 00:16:52,417 --> 00:16:56,625 several receipts that you have bought in the past for something, and just like wait a 152 00:16:56,625 --> 00:17:01,167 minute how did they know I purchased this? Well, they are obviously tracking. That's 153 00:17:01,167 --> 00:17:06,833 another good point. >> We have one giveaway item. We don't have enough for everybody but but 154 00:17:06,833 --> 00:17:14,542 about 100, so after the talk come up and take them if they're here, but this is my VIP card. 155 00:17:14,542 --> 00:17:20,542 It ends in the digits 2600 and the -- it does work at Safeway, this also works at our local 156 00:17:26,083 --> 00:17:32,000 chain in Phoenix, Fridays, Kroger, it might work at other places too but the point is we 157 00:17:32,000 --> 00:17:36,958 all have the same bar code and that's funny. When they are data-mining we are one very 158 00:17:36,958 --> 00:17:43,125 large customer. >> So you better fight for those gas points because whoever gets to 159 00:17:43,125 --> 00:17:48,125 it first is getting it! (Laughter) >> On my same thingiverse of profile I was 160 00:17:48,125 --> 00:17:53,500 talking about earlier, you can just Google thingiverse and my handle XLOGICX or whatever, but 161 00:17:53,500 --> 00:17:59,500 I have a list, I have a bar code generator so if you want a 3-D print laser cut and I have a 162 00:18:01,750 --> 00:18:08,875 list of valid bar codes I'm currently using so if you know of a bar code I don't have, I 163 00:18:08,875 --> 00:18:16,042 don't need your whole VIP card just the first six digits and then I have a cool script to end 164 00:18:16,042 --> 00:18:21,583 it in 2600. I did a laser cut bar code and totally works, you have to put it on black 165 00:18:21,583 --> 00:18:28,250 background because they cut the spaces so it comes through as the lines from the black. This 166 00:18:28,250 --> 00:18:32,958 doesn't work anymore but it's on my cell phone, single lines fell off. Gimmicky, doesn't work but 167 00:18:32,958 --> 00:18:39,667 it did work for the first few weeks, that's from a vinyl cutter or plotter or whatever. 168 00:18:39,667 --> 00:18:45,333 You don't have to be as fancy, I thought gimmicks were fun, but there are smartphone apps, I 169 00:18:45,333 --> 00:18:51,625 listed four of them here, most popular ones. Make sure you select UPC A for the bar code, I 170 00:18:51,625 --> 00:18:58,208 know some phones don't scan but I think most do, just because of the type of screen or just print 171 00:18:58,208 --> 00:19:03,083 them on a piece of paper. Point is use our bar code that I have listed on that thing, even if 172 00:19:03,083 --> 00:19:08,708 you don't get one of these you can still use the bar code. Last point what if the score 173 00:19:08,708 --> 00:19:13,542 blacklists it? I don't care, it would be funny, it would show we pissed them off enough to make 174 00:19:13,542 --> 00:19:19,542 the difference. I have the pearl script so get someone else's six digits and there's the central 175 00:19:21,708 --> 00:19:28,958 repository of my bar codes we could all use. >> Now we'll get more technical. I'll go through 176 00:19:28,958 --> 00:19:36,583 the first like three subsets of things. Forensics, AD and IDS. IDS is my favorite so I'll spend 177 00:19:36,583 --> 00:19:41,917 the most time on that which means I'll kind of blaze through forensic and AV and then do the 178 00:19:41,917 --> 00:19:47,917 most live demo proof of concept with IDS First with forensics stuff, anybody familiar with 179 00:19:52,458 --> 00:19:58,458 scalpel? Show of hands. Scalpel. It carves through a file system for files based off of they say 180 00:20:02,083 --> 00:20:07,583 magic numbers but mostly headers and footers part of it in Linux it's more than headers and 181 00:20:07,583 --> 00:20:13,292 footers, there are regular expresses, but in this case headers and footers and also, 182 00:20:13,292 --> 00:20:19,917 like, optionally how far into the file you want to go. So we'll troll that tropical that. 183 00:20:19,917 --> 00:20:25,917 This is a loose example of what a file system is like. Green, green is a hex dump of that 184 00:20:28,750 --> 00:20:34,458 simple HTML page and then like you'll have metadata but that's not part of the file. It's 185 00:20:34,458 --> 00:20:40,458 somewhere else. So this is the same HTML file. This is a busy slide. I'll dig around but in 186 00:20:43,375 --> 00:20:49,375 the middle here is what a scalpel signature may look like for an HTM file. So the first 187 00:20:51,625 --> 00:20:56,250 part is just the extension title. Next is whether it's case sensitive, this number is how 188 00:20:56,250 --> 00:21:02,208 many bytes to carve into, if you don't have a footer. So we'll stop at that point because some 189 00:21:02,208 --> 00:21:07,542 signatures don't have a footer. Then the header and footer. If we go down here, this is how it 190 00:21:07,542 --> 00:21:13,333 what carve. It's HTML starts carving the content and once it hits the HTML closing bar it 191 00:21:13,333 --> 00:21:19,333 knows to stop and carves it is whole thing out and spits out a serialized HTM file. That's how 192 00:21:21,833 --> 00:21:27,458 that works. Thinking about how that works, what do you think that might do if that was the 193 00:21:27,458 --> 00:21:34,833 content of the file? Actually horrible. Really really bad. We'll get into that. Recursively 194 00:21:34,833 --> 00:21:41,583 like goes to the first HTML, I'm pointing at my screen (Laughter) Goes to the first HTML and then 195 00:21:41,583 --> 00:21:49,292 carves down to these and each HTML will be content, then start that up again and go to that 196 00:21:49,292 --> 00:21:56,375 one. This keeps going and then it will, next HTML start and it's bad. So I could do a live 197 00:21:56,375 --> 00:22:02,958 demo but for time I won't. But I did record a demo I did. The two I wrote in Pearl is like magic 198 00:22:02,958 --> 00:22:08,958 BOM. I'm ruining tool magic BOM, multiplier of 50, generated payload, and then I'll show us 199 00:22:16,125 --> 00:22:22,125 what we have as a result. Show you how large the payload size is. For some reason... okay. 200 00:22:28,250 --> 00:22:34,250 (Pause) So in this case it's 17 K, we'll run scalpel against it. Output directory out. So you see 201 00:22:39,875 --> 00:22:44,833 it says like 50 of each file because that's what I told payload to do in our 17 K 202 00:22:44,833 --> 00:22:50,833 payload -- (Coughing) -- and running DU on the output file that gives us actual output it 203 00:22:53,250 --> 00:23:00,292 spit out. This is 17 megabytes. Keep in mind none of the files carved out were actual files. 204 00:23:00,292 --> 00:23:07,750 They are all false positives. I'm also demonstrating audit text files, it shows all file 205 00:23:07,750 --> 00:23:14,458 sizes of each file. What it does not give is a total which kind of successes, so in that 206 00:23:14,458 --> 00:23:18,708 case I kind of just wrote a little hack Perl script what you are seeing right there to parse 207 00:23:18,708 --> 00:23:25,708 out and add up all the individual different file sizes. I know it's lame to show code 208 00:23:25,708 --> 00:23:31,708 in a presentation but it's like almost a 10-liner so whatever. Come on, howdy. It's gonna 209 00:23:34,875 --> 00:23:40,833 be -- it can do itself. So the Perl script against audit.txt, it's close 16.7 mess as opposed 210 00:23:40,833 --> 00:23:47,875 to 17 flat but I'm only demonstrating because I'm going to do a really massive payload 211 00:23:47,875 --> 00:23:51,875 so I can do a scalpel and just say just give me the audit. Don't carve, just tell me what 212 00:23:51,875 --> 00:23:56,250 it would look like if you carve and then I could run the Perl script. I'm creating payload of 213 00:23:56,250 --> 00:24:02,250 30,000 of each file and it's reading from a scalpel.com file, that is how that's going. This 214 00:24:06,375 --> 00:24:09,750 is actually looking like it's going slow. In real life it goes slower, we'll see it fin finish 215 00:24:09,750 --> 00:24:15,750 in 90 seconds. Payload is 10 megs. >> May I have your attention, please? Keep your 216 00:24:19,333 --> 00:24:25,458 arms and legs in the car at all times. If you are a new speaker, raise your hand. 217 00:24:25,458 --> 00:24:33,375 >> Doesn't matter. >> Well, yes it does! >> No, it really doesn't. No, that ain't 218 00:24:33,375 --> 00:24:39,375 happening! Who wants it? I'm too fucking edged for this shit, man, I'm not doing that. >> You 219 00:24:44,167 --> 00:24:49,750 said you wanted it, here, you come and get it. (Laughter) >> Chill. >> I'll get it for 220 00:24:49,750 --> 00:24:55,750 you. (Laughter) >> Speakers do a fucking shot! Vodka I got. (Laughter) >> Here. (Laughter) 221 00:25:22,792 --> 00:25:28,792 (Applause) >> Thank you, gentlemen. Continue. (Laughter) >> All right. Continuing on. So 222 00:25:38,542 --> 00:25:44,542 we're carving. 30,000 in each file. Running the Perl script on the audit.txt and I'll zoom into 223 00:25:53,125 --> 00:25:59,125 this astronomical number it will eventually show. (Laughter) So we have a 10 megabyte payload, 224 00:26:04,208 --> 00:26:10,208 3.7 terabytes! And it actually takes like hours to actually -- it would take (Terabytes) If you 225 00:26:13,667 --> 00:26:21,542 have to drive for it. So this is kind of that 17 k payload the first thing we did, that's a lot 226 00:26:21,542 --> 00:26:25,958 of files, it might daunt your brain if you're trying to analyze it. 10.3 megabyte 227 00:26:25,958 --> 00:26:33,583 payload, it carves out 3.7 terabytes. If we did 100 megabyte payload, scalpel would 228 00:26:33,583 --> 00:26:39,583 just break. Unless you have like a super computer, whatever, bill or whatever, that's funny to me, 229 00:26:41,708 --> 00:26:47,708 all that. So AVtrolling, I won't go into this tool called hedge sneeze. It just reads the 230 00:26:52,667 --> 00:26:57,958 signature file and then spits out a file for each signature so if you were to run ClamAV or 231 00:26:57,958 --> 00:27:03,958 other vendors on it it will look like a bunch of viruses and the funny irony is they are not 232 00:27:08,083 --> 00:27:12,167 viruses, they're false positives. The highlighting is a little off. It's supposed to be 233 00:27:12,167 --> 00:27:18,167 highlighting this burst of byte here. But it's what I call a tumor. And we'll get into how 234 00:27:20,292 --> 00:27:27,958 this works. It only really plays off one individual vendor. But so say our virus signature was 235 00:27:27,958 --> 00:27:35,417 this binary here, actually in ASCII just the letter X, this red stuff here says expect us. 236 00:27:35,417 --> 00:27:41,875 So this particular vendor the way it quarantines is it takes the metadata, makes a file out 237 00:27:41,875 --> 00:27:49,583 of it, takes the virus, makes a file out of it, X stores both files with the key of 6 A, and 238 00:27:49,583 --> 00:27:56,875 then puts them Beth into one 7-Zip archive container. So you have, you are left with a 7 zip 239 00:27:56,875 --> 00:28:04,667 file and both those metadata and files are in there with the key of 6 A. The idea is to 240 00:28:04,667 --> 00:28:10,167 neutralize it so it doesn't rescan again because if you have a virus in its own quarantine 241 00:28:10,167 --> 00:28:16,167 file it will detect it. And we are using that. So before I get into that, I am -- I can some of 242 00:28:18,542 --> 00:28:24,542 you might know about the ever so powerful double XOR. We are using that, too. So here is the 243 00:28:26,625 --> 00:28:32,625 process. we have our metadata in file type not tumor, say the virus signature is this string 244 00:28:37,167 --> 00:28:44,667 that I highlighted in purple and then a two-byte file but the next string of bytes is not that 245 00:28:44,667 --> 00:28:50,958 signature, and just to like cut to the chase you'll see it but this here, if you XOR it with 6 246 00:28:50,958 --> 00:28:56,958 A would be the virus signature. So we quarantine it and that is kind of what it would look like 247 00:28:59,625 --> 00:29:05,417 now, so it's still a virus to the AV vendor so you XOR it again because it's a virus and 248 00:29:05,417 --> 00:29:11,417 it keeps on building up with metadata. So let's see that. This is longer because I kind of 249 00:29:14,625 --> 00:29:19,250 hate magic, I don't want to show you an -- like any tool that is doing it all for you. HipSneeze 250 00:29:19,250 --> 00:29:25,833 will do this but I won't do it. I'll manually rip a signature out, XOR it manually, combine it 251 00:29:25,833 --> 00:29:31,833 manually and show you what the vendor does to it. I'm copying AV's main file to a local 252 00:29:38,750 --> 00:29:44,750 directory here. My tumor directory. I'm using VDD or DD to chop off the first 512 bytes 253 00:29:49,250 --> 00:29:55,250 because this is a tar file but not the first five, I'm chopping that un, untarring it and then 254 00:29:57,500 --> 00:30:03,667 I'll have to edit permissions and I don't know why my video is stopping 20 seconds into it. 255 00:30:03,667 --> 00:30:09,667 Here we go. So now we have our main file. Fix permissions, show you what the actual file looks 256 00:30:14,750 --> 00:30:20,917 like in the raw. I scroll down here to show more meaningful names because the first ones are 257 00:30:20,917 --> 00:30:26,917 all hexy. We see we have plain text signatures and we can get our hands dirty and play with 258 00:30:34,750 --> 00:30:40,750 them. I'm graphing for a signature that is very tumorible. It's an alba worm. 259 00:30:42,875 --> 00:30:48,875 That's what I did in this demo. So the format is virus signature name, equal sign and then that 260 00:30:55,292 --> 00:31:01,292 hex you see there is the signature itself, just ASCII hex so we'll use the tool XXD to 261 00:31:04,167 --> 00:31:09,750 make an actual binary file. Now we have what would be scanned as a virus if we were to scan for 262 00:31:09,750 --> 00:31:15,750 it. Now I'll cat it out, see it's plain text, this is a Perl one-liner to convert it, XOR 263 00:31:22,708 --> 00:31:28,708 encode it. Trivial but I'm using the key of J, J in ASCII hex is 6 A, that's why I'm using J. And 264 00:31:36,250 --> 00:31:41,125 I'm showing aside by side ex-sort one and then original and I will cap them both 265 00:31:41,125 --> 00:31:47,125 together and that will be a real payload. That will work. Tumor.txt. There it is 266 00:31:54,000 --> 00:32:00,000 altogether. Like I really like seeing all the intermediate steps, there is no magic here. 267 00:32:06,125 --> 00:32:13,500 Copying it to a shared folder because in this demo this was a mint VM so we'll go over to 268 00:32:13,500 --> 00:32:19,500 Windows VM You see how grainy this is but I'm copying the text file over and this is the 269 00:32:23,333 --> 00:32:31,167 quarantine folder so a file pops in, I did didn't mention what vendor but if you know what 270 00:32:31,167 --> 00:32:37,167 .taup means you know what vendor this is. So note that it's three K and I'm going to try to 271 00:32:45,458 --> 00:32:51,458 access the file, so that would be considered an on-access scan. So open it with Notepad ++ and 272 00:32:54,667 --> 00:33:00,667 malware. Found it in quarantine. Then you'll also notice that it is 6 k now. (Laughter) 273 00:33:05,333 --> 00:33:11,333 >> Tumor. >> Tumor, it grows slowly. We'll access it again. Oh, crap! Here is 2. (Laughter) 274 00:33:16,333 --> 00:33:22,333 Now it's 8 K. I would say the tumor thankfully is benign, it doesn't repeat forever. I didn't 275 00:33:25,667 --> 00:33:31,667 weaponize it because I don't care. I like formal systems, I stop there. Now, our favorite 276 00:33:36,583 --> 00:33:42,583 part. >> I'll get into a little of IDS fun. >> Well, this is like the demo stuff so -- 277 00:33:45,750 --> 00:33:51,750 >> This is snorby. >> Our IDS system here. This guy here. >> I should probably zoom into 278 00:33:59,083 --> 00:34:05,083 this. >> Basically we see the typical SOC or situation where you always have analysts that 279 00:34:10,083 --> 00:34:14,958 are sitting on a channel just watching the CIM or IDS or whatever it mate be, in this 280 00:34:14,958 --> 00:34:20,958 case IDS and a lot of times, especially nowadays seems like training is always a hard thing 281 00:34:23,083 --> 00:34:29,167 to you know come by with training people up in order to analyze these kind of events and 282 00:34:29,167 --> 00:34:35,375 signatures and what everything means. But clearly here you can see it looks like a possible SQL 283 00:34:35,375 --> 00:34:42,125 injection intact. When I see these things, I have even had people do this in real life, 284 00:34:42,125 --> 00:34:46,917 they would take this and be like okay I see they are trying to attack our server here, let me 285 00:34:46,917 --> 00:34:53,250 try to go ahead and validate and see if it actually is possibly SQL injection. >> Before we get 286 00:34:53,250 --> 00:34:58,542 to that, this is a rule. This is what it looks like, what it's detecting, pretty simple. 287 00:34:58,542 --> 00:35:03,708 Looking for a little bit of not case sensitive but really it's looking for the word 288 00:35:03,708 --> 00:35:09,708 "Select" and "version" so someone could Google it and say I want to select the version of 289 00:35:11,875 --> 00:35:17,875 some software and it will look like a SQL injection. This is in that scenario and you could have 290 00:35:20,167 --> 00:35:25,917 someone that might think okay well my site maybe doesn't use SQL back end so put it in the I 291 00:35:25,917 --> 00:35:31,917 bar and see what happens. >> Smart analyst would probably just take that first piece, SQL 292 00:35:34,875 --> 00:35:42,833 part, but in some other cases I have seen this as well. Demonstrating here. >> I just 293 00:35:42,833 --> 00:35:50,208 want to show some of the stupidness of that. >> I'm going to verify and post this to 294 00:35:50,208 --> 00:35:56,208 our server. >> You have select, obscure stuff, we don't know what that is and so it's tested. 295 00:36:04,000 --> 00:36:11,083 (Laughter) >> It's not SQL injection. So it is again just playing with signature, the 296 00:36:11,083 --> 00:36:17,167 thought is it's not like elite hacking, with a cross eyed scripting your attack vector 297 00:36:17,167 --> 00:36:23,417 might be an email or something like that. This is obscure as hell, the attack vector is a 298 00:36:23,417 --> 00:36:29,417 security analyst that is watching in IDS, that's the attack vector. So next is a 299 00:36:34,792 --> 00:36:40,208 script called eight ball. (Laughter) >> Yeah, this slide sometimes you have to kick the 300 00:36:40,208 --> 00:36:47,000 tires of your IDS with a rocket launcher. So it's not the first tool like this. There was some 301 00:36:47,000 --> 00:36:51,917 tools, sort of researched but couldn't get the actual code. Might be Vapor but Nick and 302 00:36:51,917 --> 00:36:59,917 Snot, those are big ones, it does more -- you don't have to hunt for it either. It's kind of 303 00:36:59,917 --> 00:37:05,917 like this is a very not -- bigger than this but test my IDS.com, if you go there, it's 304 00:37:05,917 --> 00:37:13,667 not HTML it has this text and it plays off this signature, meant to test your IDS. To validate 305 00:37:13,667 --> 00:37:19,125 it's working and that is what this tool is doing, eight ball, I even added there rot ling so 306 00:37:19,125 --> 00:37:23,667 you can make it slow enough to where you are not dropping packets and increase it to see 307 00:37:23,667 --> 00:37:31,417 where it drops packets to test performance of it. We'll get into this. This is a slightly 308 00:37:31,417 --> 00:37:37,417 more complex rule. Note the whole rule just... here, so it's looking for awstats.pl, 309 00:37:40,417 --> 00:37:47,417 configure, update, plug-in mode, equal any amount of anything including nothing, and then any 310 00:37:47,417 --> 00:37:53,125 amount of alphanumeric text surrounded by pikes or system. The question is: So could we 311 00:37:53,125 --> 00:38:00,917 just do that, a get for that using that cat or whatever? The answer is yes, we can. So it 312 00:38:00,917 --> 00:38:05,250 triggered that rule and that was the packet. This is not how the attack would actually work, 313 00:38:05,250 --> 00:38:10,917 we're looking at the signature going it will be that, it will trigger. So what about 314 00:38:10,917 --> 00:38:17,500 automating it? That is what eight ball does. Literally reads a rules file and generates a 315 00:38:17,500 --> 00:38:23,625 packet for all of the rules. So you run it, your IS will light up with unique rules, maybe not 316 00:38:23,625 --> 00:38:27,708 all of them because (?) is hard to deal with backwards but it does do the PCRE stuff. 317 00:38:27,708 --> 00:38:35,208 >> Takes me back to my SOX days was channel flow, I'm sure some of you are familiar with it. 318 00:38:35,208 --> 00:38:42,750 >> This I'll do live, not do a video, I have it just in case. It's fun, doesn't take too long. 319 00:38:42,750 --> 00:38:48,750 There it goes! This is the script running. In green. You have the content matches. In red 320 00:38:51,375 --> 00:38:59,000 you have the PCRE matches so it's looking at a regX stream, creating 1 that would match that 321 00:38:59,000 --> 00:39:05,000 regX, this is porn, while that's going I have a couple more slides because this takes like 322 00:39:07,042 --> 00:39:12,708 two to three minutes. So I want make use of my time efficiently. Things I have not had added to 323 00:39:12,708 --> 00:39:20,458 the script yet but plan to, the first thing, UDP, spoofing, so light up TI stuff or make it so 324 00:39:20,458 --> 00:39:26,458 it's not attributable as much. One of my favorite things like crazy to go over this in 30 325 00:39:26,458 --> 00:39:32,458 seconds or less, it's a crazy big talk but regX denial of service. This is a bad regular 326 00:39:36,500 --> 00:39:42,917 expression! This is Perl script and there's only two lines here that matter. I'm taking an input 327 00:39:42,917 --> 00:39:48,417 and I'm seeing if that input matches that regular expression, so if I run it, first time, I 328 00:39:48,417 --> 00:39:54,417 say, As and the Bs, that took one .5 seconds, adjust a few more As that takes about ten 329 00:39:56,500 --> 00:40:03,125 minutes. See if it matches. That is bad on IDS, bad on Web apps if it's doing any validation but 330 00:40:03,125 --> 00:40:08,042 it also is taking advantage of someone running a really really bad regular expression. Long 331 00:40:08,042 --> 00:40:15,667 circuiting if you do coding you have an expression if A, B, C, D, and E then fire the laser, 332 00:40:15,667 --> 00:40:23,250 compiler would be if A is false the rest is false, don't evaluate the rest. So the long 333 00:40:23,250 --> 00:40:28,667 circuit attack is make all true but E so it doesn't match but takes as long as it possibly can 334 00:40:28,667 --> 00:40:34,792 to find that out. If you look at a more complicated rule here all stuff in yellow has to match 335 00:40:34,792 --> 00:40:39,708 and then a regular expression down here. So we do all this stuff that has to match and the 336 00:40:39,708 --> 00:40:44,917 regular expression is just saying we need the range Colon space bytes equal, then 337 00:40:44,917 --> 00:40:50,917 character set so 0 through 9-space comma, we need 100 of those, 4 1 comma, 99 of those 338 00:40:54,375 --> 00:41:00,375 and then X. It's going to really hurt performance but also not gonna trigger an alert. That's 339 00:41:04,000 --> 00:41:08,125 funny. (Laughter) Some other stuff, wrapping this up, we are kind of done, actually let's see 340 00:41:08,125 --> 00:41:14,125 if that's done. We finished so now I'll go to snorby up here and go to the dashboard. (Pause) 341 00:41:32,042 --> 00:41:37,458 That was actually when I was testing it this morning, ran the script twice, I'll do force 342 00:41:37,458 --> 00:41:42,792 cache update which will take about one minute and just to wrap it up, this is something 343 00:41:42,792 --> 00:41:48,083 I'm interested in. Haven't done anything with it but it would be same thing, attention deficit 344 00:41:48,083 --> 00:41:55,083 disorder is pretty awesome, not ours but I guess it kind of poisons memory and volatility it 345 00:41:55,083 --> 00:42:00,750 will deal with it nasty and all your awesome tools. So probably don't have enough time for 346 00:42:00,750 --> 00:42:06,750 questions. I'll leave this up here for a moment. I will check to see if, maybe I'll click on 347 00:42:09,000 --> 00:42:15,000 the -- there are 200,000 events. If I click on it, I am seeing 207,000 events up here. So just 348 00:42:18,917 --> 00:42:25,792 triggered 7,000 events and they're all unique. I could go to any one of these and analyze 349 00:42:25,792 --> 00:42:31,792 it. Like it just shot that at it because the rule is looking for just that. That's what it does. 350 00:42:39,000 --> 00:42:45,000 So... >> That's all. Thank you. (Applause)