1 00:00:00,000 --> 00:00:29,700 Thank you to everyone that showed up at 10 a.m. on Sunday morning. So give yourself kind of a round of applause because you're not completely obliterated. You're not still drunk from Thursday like many of us are. So kind of to start off, we're going to explain what OPFOR is and what that even means. A little bit of my background, not to go too much. I was a former U.S. Army warrant officer. I dealt with what's called OPFOR, okay, or opposing forces. I used to help train teams. 2 00:00:30,000 --> 00:00:59,880 That would deploy prior to their deployment to help them prepare for the battlefield. So being a forensics investigator, I thought what better way to get better at forensic investigations than to work with my quote unquote enemy, right, which happens to be Tim, who's also a member of the spider labs, who is a pen tester. So then the same way on the battlefield how we would train infantry and artillery, we train ourselves within spider labs so that he understands indicators of compromise that he leaves behind by conducting his 3 00:00:59,880 --> 00:01:05,300 attacks, and I see real world forensic indicators of compromise from attacks that he launches. 4 00:01:06,660 --> 00:01:12,020 And just as kind of a side note, right, I'm not a proponent of any one forensic utility. 5 00:01:12,420 --> 00:01:17,000 I know when people say, oh, forensics, I use NKs. That's not forensics. That's understanding 6 00:01:17,000 --> 00:01:22,180 a piece of software, right? Knowing how to use NKs or FTK no more makes you a forensic 7 00:01:22,180 --> 00:01:29,600 investigator than knowing how to use Microsoft Word makes you Stephen King. It's just a tool 8 00:01:29,880 --> 00:01:35,240 and it just does whatever you tell it to. So forensics is truly being an independent 9 00:01:35,240 --> 00:01:39,480 finder of the facts and understanding how those facts are laid out and then how to interpret 10 00:01:39,480 --> 00:01:45,620 them, right? So, again, opposing forces is really something that we've stolen from the 11 00:01:45,620 --> 00:01:51,040 military and have kind of used internally to get better at what we do and to truly understand 12 00:01:51,040 --> 00:01:55,940 what indicators of compromise are left behind in real world attacks, right? And it works 13 00:01:55,940 --> 00:01:59,480 both ways. When Tim sees what indicators of compromise 14 00:01:59,880 --> 00:02:04,560 attacks leave behind, he can go, wow, that was a really freaking noisy attack. Is there 15 00:02:04,560 --> 00:02:08,540 a better way for me to accomplish the same goal? Not necessarily with the same tools 16 00:02:08,540 --> 00:02:12,760 and maybe he's got to write a different tool, but his end result, right, will be the same 17 00:02:12,760 --> 00:02:17,360 with less indicators of compromise left behind, which may or may not be important to our clients, 18 00:02:17,480 --> 00:02:22,220 but at least we give them the opportunity, right? And it's bringing that mentality in 19 00:02:22,220 --> 00:02:26,720 to the attack and defense communities and it's an evolving cycle. It's not something 20 00:02:26,720 --> 00:02:29,420 we do one time and go, hey, we're great. We're done. 21 00:02:29,880 --> 00:02:32,980 Right? It's something you're constantly doing. There's always new attacks. There's always 22 00:02:32,980 --> 00:02:37,020 new vulnerabilities. There's always new things that we need to see so that we can get better 23 00:02:37,020 --> 00:02:41,540 at what we do. Right? So here's our plan of attack. We're going to talk about something 24 00:02:41,540 --> 00:02:45,060 called sniper forensics and it's kind of something that we've developed in the Spider 25 00:02:45,060 --> 00:02:50,380 Labs over the last few years in opposition to shotgun forensics. And we'll give kind 26 00:02:50,380 --> 00:02:56,040 of some background in that and then with some real world pen testing events and examples, 27 00:02:56,520 --> 00:02:59,860 we'll do a proof of concept. We'll show how it actually works. Right? No longer will we 28 00:02:59,880 --> 00:03:04,200 do live demos. I don't want to get anyone all excited about live demos. It's 10 in the 29 00:03:04,200 --> 00:03:10,660 morning for us, too, and we're kind of Vegased out, too, so we took screenshots. And then 30 00:03:10,660 --> 00:03:12,460 what some of the postmortem activities and stuff are. 31 00:03:12,800 --> 00:03:18,840 So state of the industry right now. Incident response and forensics has traditionally not 32 00:03:18,840 --> 00:03:23,040 been about live analysis. It's been about dead box forensics. We're trying to get away 33 00:03:23,040 --> 00:03:28,380 from that because honestly that methodology sucks. It's 20‑year‑old methodology and 34 00:03:28,380 --> 00:03:29,860 it was really cool and cutting‑edge. 20‑year‑old methodology. 20‑year‑old methodology. 20‑year‑old 35 00:03:29,880 --> 00:03:33,460 methodology. 20 years ago and it's not anymore. How many people in here have some kind of 36 00:03:33,460 --> 00:03:37,280 smart device? Smart phones, iPods, iPads, droid tablets, something like that? Are there 37 00:03:37,280 --> 00:03:41,520 any spinny drives in there? No. It's going to be all cloud‑based. So looking at the 38 00:03:41,520 --> 00:03:44,760 direction technology is moving, we're not going to be dealing with spinny hard drives 39 00:03:44,760 --> 00:03:47,660 anymore. You're not going to be able to pull those out, stick them in a write blocker, 40 00:03:47,680 --> 00:03:54,020 image them and do postmortem analysis. You're going to be imaging the cloud. So good luck 41 00:03:54,020 --> 00:03:59,000 with that. Let me know how that goes. So you're going to be doing log analysis. You're 42 00:03:59,000 --> 00:03:59,860 going to be doing RAM analysis. You're going to be doing log analysis. You're going to be 43 00:03:59,880 --> 00:04:06,160 doing data analysis. That is where technology is moving. So instead of being stuck in the 44 00:04:06,160 --> 00:04:09,620 quagmire of 20‑year‑old technology, we need to move forward and look at the direction 45 00:04:09,620 --> 00:04:14,380 things are going. And that's really what we're working on. So I'm going to pass over 46 00:04:14,380 --> 00:04:24,100 to Tim now. TIM COOK, So good morning, DEF CON. I'm Tim. And from my point of view, the 47 00:04:24,100 --> 00:04:29,780 current state of penetration testing has some issues. I think, first of all, that we are 48 00:04:29,780 --> 00:04:39,600 exploit happy. And what I mean by that is that we're focused on exploits that involve memory 49 00:04:39,600 --> 00:04:49,260 corruption bugs. And I want to reappropriate the terminology there. So I think if you look 50 00:04:49,260 --> 00:04:53,320 at how people talk about this stuff in the industry right now, when people use the word 51 00:04:53,320 --> 00:04:58,240 exploit, they're really just talking about the kinds of attacks that involve throwing shell 52 00:04:58,240 --> 00:04:59,080 coat at that stuff. 53 00:04:59,780 --> 00:05:05,700 TIM COOK, But, you know, think about the real‑world use of that term and all the 54 00:05:05,700 --> 00:05:12,240 other things that exploits encompass. I want to reappropriate that, the word exploit, for 55 00:05:12,240 --> 00:05:18,220 all that other shit. And so I'm using the term exploit to kind of minimize and push 56 00:05:18,220 --> 00:05:21,280 to the corner the stuff that involves throwing shell coat at shit. 57 00:05:23,760 --> 00:05:29,460 And then, more importantly, though, I think that the penetration testing community is 58 00:05:29,460 --> 00:05:36,040 losing focus with or the connection to real attack patterns, how attacks actually occur 59 00:05:36,040 --> 00:05:44,540 in the wild. And so I think if we look at how we scope penetration tests, how we perform 60 00:05:44,540 --> 00:05:50,840 them, and how we document them, those are all ‑‑ I think we are in each of those 61 00:05:50,840 --> 00:05:57,200 cases drifting away from real attack patterns. And I want to switch things around back to 62 00:05:57,200 --> 00:05:59,440 what I'm calling real‑world penetration testing. 63 00:06:00,160 --> 00:06:08,180 TIM COOK, And so more of that later. But next, Chris is going to give us an intro 64 00:06:08,180 --> 00:06:09,200 into sniper forensics. 65 00:06:09,580 --> 00:06:12,280 CHRIS LEROUX, Okay. So some of you may have seen ‑‑ if you're in the forensics 66 00:06:12,280 --> 00:06:14,980 community, you may have seen or heard of sniper forensics. I actually wrote it on a 67 00:06:14,980 --> 00:06:18,540 plane. So it's kind of like sting right and message in a bottle in the back of a bus. 68 00:06:18,800 --> 00:06:22,420 So I kind of wrote it in the back of a plane, but it makes sense. And just a little bit 69 00:06:22,420 --> 00:06:27,280 of background, comic nerds and computer nerds kind of flock together and are kind of some 70 00:06:27,280 --> 00:06:27,880 of the same people. 71 00:06:27,960 --> 00:06:29,420 TIM COOK, So one of my best friends is a comic book author. He's a comic book author. 72 00:06:29,440 --> 00:06:32,200 He's a comic book artist. So I want to give him a shout out for drawing this for me. 73 00:06:32,540 --> 00:06:36,500 This is the official sniper forensics logo written by a gentleman named Dan Christensen 74 00:06:36,500 --> 00:06:40,980 who is a fantastic comic artist. So if you're a comic nerd, please check out Dan's stuff. 75 00:06:41,520 --> 00:06:48,100 Shameless plug. Done. Okay. So sniper forensics is, again, we ‑‑ it's the concept of 76 00:06:48,100 --> 00:06:51,560 going after the data that's necessary. Right? And we use the term indicators of compromise 77 00:06:51,560 --> 00:06:55,800 for that. It's not going after a bunch of crap that you probably don't need. Right? 78 00:06:55,860 --> 00:06:59,140 You don't need full disk images to see what's happening in memory. You don't need full 79 00:06:59,140 --> 00:07:02,660 disk images to create a forensic timeline. Right? You have to know what the data is 80 00:07:02,660 --> 00:07:07,080 that you're going after and why you need it. And this is why I don't like point and click 81 00:07:07,080 --> 00:07:10,620 monkey forensics is because you don't know what's happening in the background. You load 82 00:07:10,620 --> 00:07:14,060 in an end case, you click sweep case, and you ask, what did that just do? Well, I'm 83 00:07:14,060 --> 00:07:17,860 generating output. That's awesome. What kind of output are you generating and why are you 84 00:07:17,860 --> 00:07:23,040 generating it and how is it doing it? I don't know. Right? So open source tools in my opinion 85 00:07:23,040 --> 00:07:27,020 are so much better because I get what's happening with the ones and zeros. And I'm making that 86 00:07:27,020 --> 00:07:27,360 decision. 87 00:07:27,660 --> 00:07:29,120 Not a developer for us. I'm not a developer for us. I'm not a developer for us. I'm not a 88 00:07:29,140 --> 00:07:33,660 software company that a sales guy told me I needed. Right? It's me as the engineer going, 89 00:07:33,800 --> 00:07:37,880 here's what I want to see. Right? So we have ‑‑ you hear about the APT and that's awesome 90 00:07:37,880 --> 00:07:43,100 marketing by Mandiant. So if anyone here is from Mandiant, great marketing for APT. And I 91 00:07:43,100 --> 00:07:47,520 think that was born out of the AFOSI, actually. So anyways, we have the OPT, right? The 92 00:07:47,520 --> 00:07:51,920 organic persistent threat. Because attackers don't attack something and go, damn, that 93 00:07:51,920 --> 00:07:57,340 didn't work. And then walk away. Right? It's a constantly evolving attack surface. And 94 00:07:57,340 --> 00:07:59,120 the attackers are constantly going after it. They're constantly going after it. They're 95 00:07:59,120 --> 00:08:01,940 constantly going after stuff. And if it doesn't work, they're not packing up shop and walking 96 00:08:01,940 --> 00:08:06,940 away. Right? They're trying new things, trying new exploits. And Microsoft is certainly helping 97 00:08:06,940 --> 00:08:10,740 that, right, by having so many, you know, vulnerabilities in ‑‑ you know, embedded 98 00:08:10,740 --> 00:08:15,160 within their code. With applications as well. So it's constantly moving organic threat. 99 00:08:15,800 --> 00:08:20,580 They're highly motivated, highly funded and organized. Right? The days of bad guys being 100 00:08:20,580 --> 00:08:24,360 kids down the street, like y'all ‑‑ I'm from Oklahoma, so if I say y'all, it's okay. 101 00:08:24,480 --> 00:08:29,100 I'm allowed. You know, like y'all or ‑‑ you know, someone doing something that's not 102 00:08:29,100 --> 00:08:32,320 doing it, tagging for, you know, for the heck of it to say, oh, look what I did. It's 103 00:08:32,320 --> 00:08:35,420 not the case anymore. Right? The majority of cases that we work with, both local, state 104 00:08:35,420 --> 00:08:39,780 and federal law enforcement, are dealing with organized crime. Hacking has become 105 00:08:39,780 --> 00:08:44,600 a high dollar crime. Right? It's a syndicate. There's components to it. There's moving parts 106 00:08:44,600 --> 00:08:49,140 just like any business model. And they really understand return on investment. And they're 107 00:08:49,140 --> 00:08:53,820 really good at it. Right? Not necessarily the cleanest attacks in the world, but the 108 00:08:54,520 --> 00:08:58,900 end result is the accomplishment of something that can be extracted and monetized. And we 109 00:08:58,900 --> 00:09:04,260 see it all the time. I think last year it was a $250 billion industry just in credit 110 00:09:04,260 --> 00:09:09,780 card theft. Right? Not to count, you know, the theft of PHI or PII or other types of information 111 00:09:09,780 --> 00:09:13,920 that has, no kidding, like drugs, it has street value. So it's really pretty cool to 112 00:09:13,920 --> 00:09:19,340 see how that moves. Additionally, it's a laser versus a big rock. Right? I can kill you by 113 00:09:19,340 --> 00:09:24,220 smashing you in the head with a rock. It's effective. Right? It does its job. Versus 114 00:09:24,220 --> 00:09:28,780 if I shoot you with a laser beam from space, you're still going to be dead. But the method 115 00:09:28,900 --> 00:09:33,600 that I used and how clean and efficient it is are exponentially greater. Right? So that's 116 00:09:33,600 --> 00:09:38,460 kind of another analogy I like for sniper forensics. And target selection. Right? I 117 00:09:38,460 --> 00:09:42,600 can look at whatever data, right, I think the bad guys are going to go after. Right? 118 00:09:42,640 --> 00:09:46,040 And you all know as pen testers, you don't pen test for the sake of pen testing. When 119 00:09:46,040 --> 00:09:52,100 I was a pen tester, my customers would give me a target and say, go get this. See if 120 00:09:52,100 --> 00:09:56,380 you can get to that data over there. And they'd put me, you know, seven miles away, three 121 00:09:56,380 --> 00:09:58,880 different subnets away, and you have to jump. And, you know, you're going to have to go 122 00:09:58,880 --> 00:10:03,260 and pivot. But that was the end goal. So who cares how I went through it because the 123 00:10:03,260 --> 00:10:07,440 end goal was I extracted that data that I could then monetize. So that's where we start. 124 00:10:07,680 --> 00:10:11,720 And then we move outwards because that's the logical sequence of an attack. Right? 125 00:10:11,840 --> 00:10:15,440 So and then you get the best return on the investment both for the attackers and for 126 00:10:15,440 --> 00:10:20,920 us as investigators. And then obviously pivot attacks lead to deeper, you know, penetrations. 127 00:10:21,180 --> 00:10:26,280 Which is just fun to say. Right? So advanced attacks need an equally advanced investigation 128 00:10:26,280 --> 00:10:28,220 approach. And that's what sniper forensics is. 129 00:10:28,880 --> 00:10:33,020 Right? We don't image everything. I've been on cases, no kidding, both when I was in the 130 00:10:33,020 --> 00:10:37,300 military and as a civilian where, you know, the lead case agent comes in and says, okay, 131 00:10:37,400 --> 00:10:43,740 image everything. I'm like, what is everything? He said any server, any system, image them 132 00:10:43,740 --> 00:10:49,000 all. I've been on cases where I've taken over 250 forensic images. What the hell am 133 00:10:49,000 --> 00:10:54,180 I going to do with 250 forensic images of servers? Going to load them into NK so I'm 134 00:10:54,180 --> 00:10:58,700 going to cross my fingers and hope to find evil, right? No, it's a terrible idea. Right? 135 00:10:58,880 --> 00:11:03,960 That's old school. It relies on something we call autopilot forensics. Click, open book, 136 00:11:04,120 --> 00:11:09,180 start reading. Right? Again, that's a horrible way of conducting an investigation. And in 137 00:11:09,180 --> 00:11:13,700 the real world, you would never see a police officer come into a crime scene and conduct 138 00:11:13,700 --> 00:11:16,220 an investigation like that. Okay? It just doesn't work. 139 00:11:16,820 --> 00:11:21,240 And an additional component that I was talking to a police officer friend of mine saying, 140 00:11:21,360 --> 00:11:27,420 look, what about tools that are court ‑‑ you know, are court‑certified or vetted in court? 141 00:11:27,620 --> 00:11:28,720 People always say, well, in case. 142 00:11:28,880 --> 00:11:35,340 Court‑certified. No, it's not. Tools cannot be certified. Investigators can perform and 143 00:11:35,340 --> 00:11:38,960 do certification, right? Because that's the one doing the investigation, not the tool. 144 00:11:39,340 --> 00:11:43,480 And saying that one tool is court‑certified versus another is like saying if you take 145 00:11:43,480 --> 00:11:48,340 crime scene photos with a Nikon, those are accepted. If you use a Canon, no, we can't 146 00:11:48,340 --> 00:11:54,260 accept that. Right? It doesn't make any sense. So sniper forensics uses logic. Go figure. 147 00:11:55,240 --> 00:11:58,860 Most of us in this room are kind of outside the box, stamp on it, bring it in. You know, 148 00:11:58,860 --> 00:12:02,680 we're in the ashes, thinkers, anyways. But we're all logical. There's a logical path 149 00:12:02,680 --> 00:12:07,900 of progression in the way our thought process works. So applying sound logic, using low 150 00:12:07,900 --> 00:12:11,620 cards exchange principle, Occam's razor and something we've dubbed the elect you principle 151 00:12:11,620 --> 00:12:17,380 are really how we go at that data. We extract only what needs to be extracted. I don't take 152 00:12:17,380 --> 00:12:23,660 250 images because that's not where the target data resides. I go after the target. I allow 153 00:12:23,660 --> 00:12:27,560 the data to provide answers. I can't tell you how many investigations I've worked on where 154 00:12:28,900 --> 00:12:32,620 any evidence is analyzed, the investigator walks in and he's got an idea of what he 155 00:12:32,620 --> 00:12:37,260 thinks happened. So all the evidence that he gets, he crams into this box of what he 156 00:12:37,260 --> 00:12:44,100 thinks took place and ignores everything that he ‑‑ that doesn't fit his idea of what 157 00:12:44,100 --> 00:12:48,740 happened. And, again, that's terrible science. Right? That's not how we conduct experimentations 158 00:12:48,740 --> 00:12:52,840 or investigations. We report on what was done and like math class, right, you provide 159 00:12:52,840 --> 00:12:58,000 your ‑‑ you know, you show your work and you provide your answers. So the way we've 160 00:12:58,000 --> 00:12:58,800 broken this down ‑‑ 161 00:12:58,860 --> 00:13:03,040 To non‑technical audiences, which I know you're not, but just hear me out because it'll 162 00:13:03,040 --> 00:13:07,200 give you a solid understanding of how we approach an investigation. Right? There's three components. 163 00:13:07,400 --> 00:13:11,460 We call them the breach triad. Think of a bank robbery, right? Old school, you know, 164 00:13:11,460 --> 00:13:14,920 black and white movies. You've got the bank robbery. He's got to do three things. He's 165 00:13:14,920 --> 00:13:18,200 got to break into the bank. He's got to get his white bag with the dollar sign on it, 166 00:13:18,240 --> 00:13:21,920 right, stuff all the money in it, throw it over his shoulder, make his getaway. Seems 167 00:13:21,920 --> 00:13:27,180 pretty easy, right? Infiltration. Aggregation. Exfiltration. Cyberattacks are no different. 168 00:13:27,860 --> 00:13:32,720 You've got to gain access to the target network. You've got to identify the data of value and 169 00:13:32,720 --> 00:13:36,920 aggregate it somehow. And you've got to get it from a system controlled by the target 170 00:13:36,920 --> 00:13:42,080 to a system controlled by the attacker. Very simple. So, when we approach an investigation, 171 00:13:42,400 --> 00:13:46,700 that's how we approach. How did the bad guys get in? What did they jack? How did they get 172 00:13:46,700 --> 00:13:51,900 out? Very simple. So, the guiding principles, if you don't know, the guiding principles, 173 00:13:51,920 --> 00:13:55,080 are low cards exchange principle. Everyone has seen CSI, right? Everyone has heard Gil 174 00:13:55,080 --> 00:14:00,120 Grissom talk about low cards exchange principle. Occam's razor was by William of Occam and 175 00:14:00,120 --> 00:14:05,920 a gentleman who I used to work for when I was with the X force at ISS developed this 176 00:14:05,920 --> 00:14:09,140 but he never documented it. So I asked him if I could document it and he said yes. So 177 00:14:09,140 --> 00:14:13,620 that's where that came from. So basically Edmond Locard was the founder of the feast 178 00:14:13,620 --> 00:14:18,800 in our world. He was kind of the father of the modern forensic sciences. And he said, 179 00:14:18,800 --> 00:14:22,900 look, use deductive reasoning, right? It's very simple. There's answers for things and you 180 00:14:22,900 --> 00:14:26,920 just have to follow logically those paths. So Locard's exchange principle kind of boiled 181 00:14:26,920 --> 00:14:31,300 down. Has anyone ever seen the glitter test? You put glitter on your hands and you shake 182 00:14:31,300 --> 00:14:33,660 someone's hand and now they have glitter on it and you have glitter on it and everyone 183 00:14:33,660 --> 00:14:38,000 else shakes hands and the whole room is full of glitter. Anyone ever seen that? If you 184 00:14:38,000 --> 00:14:42,800 put glitter on your hand and you shake someone's hand, rinse, repeat. So that's kind of 185 00:14:42,800 --> 00:14:47,120 the concept. If I touch your shirt, I have fibers from your shirt on my hand, you have 186 00:14:47,120 --> 00:14:48,140 oil from my hand on your shirt. 187 00:14:48,800 --> 00:14:53,160 So think about how that applies to computers. If you log in interactively through the shell, 188 00:14:53,340 --> 00:14:59,760 do you leave a trace? Yes. You leave a type 10 login in the Windows and Matlogs. Or if 189 00:14:59,760 --> 00:15:02,820 you log in through the command shell, is it a different type of indicator of compromise? 190 00:15:03,180 --> 00:15:09,160 Well, yes. If you launch a program, do you leave residual traces behind? Yes. There is 191 00:15:09,160 --> 00:15:13,440 no way around it. You can reduce the amount that you leave behind, but it's always going 192 00:15:13,440 --> 00:15:17,960 to be there. So that's Locard's exchange principle. The other one is Occam's razor. In the Army 193 00:15:17,960 --> 00:15:18,780 we called this the killer's razor. The killer's razor is the one that's going to be there for 194 00:15:18,780 --> 00:15:24,440 this principle. Anyone ever heard that? Keep it simple, stupid. The answer with the least 195 00:15:24,440 --> 00:15:29,520 number of assumptions is probably correct. So you having crappy passwords and getting 196 00:15:29,520 --> 00:15:36,500 owned or someone writing code on the fly, which is probably more likely? Bad passwords 197 00:15:36,500 --> 00:15:40,960 requires less assumptions. So that's kind of Occam's razor in a nutshell. 198 00:15:42,040 --> 00:15:46,000 Now the elect you principle is really pretty cool and in my case notes when we conduct 199 00:15:46,000 --> 00:15:47,620 investigations we actually have this broken down. 200 00:15:47,620 --> 00:15:51,780 So what question are you trying to answer? You're there for a reason. You're conducting 201 00:15:51,780 --> 00:15:56,640 an investigation for a reason. Why? What data or is the customer afraid it was extracted 202 00:15:56,640 --> 00:16:02,180 or what happened to the victim? What data do you need to answer that question? I don't 203 00:16:02,180 --> 00:16:06,240 need a mail server image to determine if credit card data was stolen from a database server. 204 00:16:06,480 --> 00:16:10,420 So why would I take an image of a mail server, right? It makes no sense. So that's not the 205 00:16:10,420 --> 00:16:14,780 data I need. How do I extract and analyze that data? Running sweep case on it is not 206 00:16:14,780 --> 00:16:17,500 going to tell me if there's credit card data on it. It's not going to tell me if the C 207 00:16:17,620 --> 00:16:20,960 SQL injection took place. It's not going to tell me if RFI was present, PHP shells 208 00:16:20,960 --> 00:16:26,060 were present. I'm doing what makes sense. And then what does the data tell you? Very 209 00:16:26,060 --> 00:16:37,180 simple. So I'm going to introduce what I call real 210 00:16:37,180 --> 00:16:42,220 world penetration testing, though this term is kind of out there in the wild. First what 211 00:16:42,220 --> 00:16:47,560 I mean by real world is, well, we have to remember that a penetration test is a model. 212 00:16:47,620 --> 00:16:53,360 It's a model of something else. And its value is related to how close or far away that thing 213 00:16:53,360 --> 00:17:00,820 is from reality. So by real world, I don't mean like pen testing like the real pen testers 214 00:17:00,820 --> 00:17:08,200 do it. I mean pen testing like the real attackers do it. So let's think for a bit about how 215 00:17:08,200 --> 00:17:14,860 black hats go about choosing their methods. Well, first let's think about how white hats 216 00:17:14,860 --> 00:17:17,600 do it. Because, you know, the assumption here is, you know, if you're going to do this, 217 00:17:17,600 --> 00:17:25,340 wear white hats. So how do we choose exploits? Well, we put metrics on stuff. We look at 218 00:17:25,340 --> 00:17:30,080 vulnerabilities and we measure them according to various things. There's been a number of 219 00:17:30,080 --> 00:17:35,360 standards over the years. Different vendors, different industries have come up with lots 220 00:17:35,360 --> 00:17:40,080 of systems of measuring, you know, risk of vulnerabilities. But, you know, we've come 221 00:17:40,080 --> 00:17:44,920 a long way. We've all grown up and now there's one standard to rule them all, CVSS, Common 222 00:17:44,920 --> 00:17:46,220 Vulnerability Scoring System. 223 00:17:46,220 --> 00:17:51,900 Which I'm sure you're all familiar with. But basically you've got measurements of things 224 00:17:51,900 --> 00:18:00,640 like is the vulnerability remote or local? Is it simple or complicated? Does it require 225 00:18:00,640 --> 00:18:09,300 authentication? And what kind of impact does it have to the target system? Right? But by 226 00:18:09,300 --> 00:18:15,800 looking at kind of an exercise I conducted with my teammates over the last couple years, 227 00:18:15,800 --> 00:18:21,480 looking at the kind of attacks we use in penetration tests and which ones are most 228 00:18:21,480 --> 00:18:26,160 successful, which ones give us the best bang for the buck, and then kind of integrating 229 00:18:26,160 --> 00:18:31,220 into that some, you know, what I see of what's going on in the real world from the incident 230 00:18:31,220 --> 00:18:35,420 response community in terms of what attackers are really doing, kind of look at that data 231 00:18:35,420 --> 00:18:41,840 and I think that these values kind of bubble up to the top of, you know, if I were a black 232 00:18:41,840 --> 00:18:43,940 hat, these were the things I'd be focused on. 233 00:18:44,780 --> 00:18:45,140 Safety. 234 00:18:46,300 --> 00:18:51,200 Meaning is this attack safe to the target? Can I conduct it in such a way that I'm not 235 00:18:51,200 --> 00:18:57,940 going to knock the target over? That gives me stealth because if you knock the target 236 00:18:57,940 --> 00:19:04,380 over, that's going to ring alarms. But just as importantly, it gives me reusability. I 237 00:19:04,380 --> 00:19:11,400 can attack the same target over and over again. So that's, I think, crucial. And power, I 238 00:19:11,400 --> 00:19:14,720 mean, what kind of leverage does this attack give me over the target? 239 00:19:16,040 --> 00:19:19,840 Invisibility is simply stealth. Again, we want to get in and out and not get caught. 240 00:19:20,820 --> 00:19:29,780 And frequency, meaning we want to spend our time attacking commonly found systems. We're 241 00:19:29,780 --> 00:19:33,080 a vulnerability that's common in the wild and not some strange one‑off system. 242 00:19:36,380 --> 00:19:41,140 So one thing to notice, though, if you look at these metrics is they don't ‑‑ none 243 00:19:41,140 --> 00:19:45,780 of these appear in any form in CVSS. So that was one of the things that started me thinking, 244 00:19:45,800 --> 00:19:50,300 struck me when I put this data together first was just that there seems to be this disconnect 245 00:19:50,300 --> 00:19:56,320 between how, as an attacker, I go about choosing exploits and how defenders go about choosing 246 00:19:56,320 --> 00:20:00,740 which things to defend against. It seems like we would want those things to line up. 247 00:20:04,000 --> 00:20:08,660 So to reiterate, the white hat metrics are based on vulnerabilities and the black hat 248 00:20:08,660 --> 00:20:12,540 methods are based on attacks. It's kind of which your mind set is attack or defense. 249 00:20:12,940 --> 00:20:15,780 I think, though, there's, again, another landmark. 250 00:20:15,800 --> 00:20:21,560 Language thing going on here. If you spend a lot of time in CVE data, I think you can 251 00:20:21,560 --> 00:20:30,420 get warped into this view that a vulnerability is equivalent to something that can be patched. 252 00:20:30,640 --> 00:20:34,300 But this is kind of related to what I was talking about with exploits and exploits. 253 00:20:34,480 --> 00:20:39,260 I think that there's lots of vulnerabilities out there that can't be patched. Here's a 254 00:20:39,260 --> 00:20:44,960 trivial example. You can't patch stupidity. You can exploit stupidity. So therefore there's 255 00:20:45,820 --> 00:20:47,460 vulnerabilities out there that can't be patched. 256 00:20:50,580 --> 00:20:57,080 I think another difference when you contrast these things is if you look at CVE and stuff 257 00:20:57,080 --> 00:21:05,220 that's scored in CVSS, it seems well attuned to public facing vulnerabilities and the 258 00:21:05,220 --> 00:21:09,380 stuff that's public facing is, you know, scored a lot higher for kind of obvious reasons. 259 00:21:09,540 --> 00:21:14,500 But I think it tends to push internal only vulnerabilities kind of down the stack. I 260 00:21:14,500 --> 00:21:15,060 think that's wrong. 261 00:21:17,980 --> 00:21:22,380 And even more importantly, though, the white hat metrics are atomic. They're kind of atomic 262 00:21:22,380 --> 00:21:27,900 by definition. If you go in to like read the rules on how to do CVSS scoring, you can't 263 00:21:27,900 --> 00:21:34,920 put two different vulnerabilities together and give it a CVSS score. It's just not built 264 00:21:34,920 --> 00:21:39,740 to support that. But that's kind of the bread and butter of what attackers do is they exploit 265 00:21:39,740 --> 00:21:43,240 this little thing and then this little thing and this little thing and maybe it's a bunch 266 00:21:43,240 --> 00:21:45,400 of low risk vulnerabilities. But you chain them all together. 267 00:21:45,400 --> 00:21:50,620 And you get some, you know, comprehensive systemic compromise. 268 00:21:55,540 --> 00:22:01,420 Just a quick sidebar here. I think CVSS needs some work. It's actually undergoing a process 269 00:22:01,420 --> 00:22:09,480 right now to get to CVSS version 3. But here's some things I think it needs to better support. 270 00:22:09,680 --> 00:22:15,380 So it needs to ‑‑ the basis of CVSS and CVE data needs to ‑‑ you know, it needs 271 00:22:15,400 --> 00:22:22,140 to look at stuff that's obviously vulnerabilities that's not being scored. So just to give you 272 00:22:22,140 --> 00:22:26,840 a trivial example, ARP cache poisoning. That's one of my favorite vulnerabilities. I use 273 00:22:26,840 --> 00:22:36,960 it every freaking day. And it's not ‑‑ it doesn't have a CVE. It's been a CVE candidate 274 00:22:37,370 --> 00:22:44,100 since 1999. But it's never advanced past that. So that's an example of a vulnerability that's 275 00:22:44,100 --> 00:22:44,860 in the big bubble. 276 00:22:44,860 --> 00:22:46,680 It's not in the little bubble. Why is that? 277 00:22:49,200 --> 00:22:55,960 I think the most critical attack surface is internal. So I want to see scoring that kind 278 00:22:55,960 --> 00:23:00,000 of prioritizes that and brings attention to that. And I want to see a scoring system 279 00:23:00,000 --> 00:23:05,620 that allows us to put vulnerabilities together and, you know, put some kind of conglomerate 280 00:23:05,620 --> 00:23:11,920 score on it so we actually line up where attackers are going with what defenders react 281 00:23:11,920 --> 00:23:12,180 to. 282 00:23:13,120 --> 00:23:13,640 Okay. 283 00:23:19,420 --> 00:23:24,140 So just to quickly move through this stuff so we can get to more of the meat, I think 284 00:23:24,140 --> 00:23:29,000 our new goals are going to be based on stealth and safety. If your focus is stealth, you 285 00:23:29,000 --> 00:23:34,400 kind of get safety for free, and I think that's cool. And the demonstration of multi‑step 286 00:23:34,400 --> 00:23:39,360 attacks. I don't necessarily mean ‑‑ I kind of think the classic, what you probably 287 00:23:39,360 --> 00:23:44,080 ‑‑ your mind is going to pivoting. Well, pivoting is cool. Yeah, it's important sometimes, 288 00:23:44,080 --> 00:23:52,220 but I think it's somewhat blown out of proportion. I'm talking, though, about simply using multiple 289 00:23:52,220 --> 00:23:56,600 vulnerabilities in succession to achieve greater exploitation. 290 00:23:58,540 --> 00:24:02,860 And then less importantly, blended methods, the demonstration of blended methods, the 291 00:24:02,860 --> 00:24:07,960 demonstration of data exfiltration and potentially even the use of black hat tools and methods. 292 00:24:10,720 --> 00:24:13,220 So just to summarize, here's the old goal. 293 00:24:14,840 --> 00:24:15,800 Here's the new goal. 294 00:24:18,880 --> 00:24:29,840 So black hats don't heart shells, I don't think. I think they heart, well, RSA secrets 295 00:24:29,840 --> 00:24:34,300 and product designs and credit card numbers and things that can be monetized. 296 00:24:35,320 --> 00:24:43,040 So one of the things that you get when you focus on the data, where the money is, instead 297 00:24:43,040 --> 00:24:48,660 of how many shells you can pop, is ‑‑ I mean, you're going to be more efficient. 298 00:24:48,880 --> 00:24:51,820 You're going to do less stuff to get more data. 299 00:24:54,620 --> 00:25:02,400 So by having this safety first, stealth first focus, you're going to put the focus on the 300 00:25:02,400 --> 00:25:08,280 data, where I think it belongs. You're going to give ‑‑ if you're doing joint exercises 301 00:25:08,280 --> 00:25:13,020 with incident responders, you're going to give them realistic data to analyze. And you're 302 00:25:13,020 --> 00:25:16,800 going to be more efficient. And as a kind of work‑a‑day penetration tester, most 303 00:25:16,800 --> 00:25:22,400 important for me is if I can focus on safety first and I can convince my clients about 304 00:25:22,400 --> 00:25:27,760 the principle of safety first, I can actually set realistic scopes on my tests and not be 305 00:25:27,760 --> 00:25:32,960 restricted from looking at certain systems or restricted from looking at certain network 306 00:25:32,960 --> 00:25:37,020 layers and all that kind of shit. I mean, that's all our fault, I think, ultimately, 307 00:25:37,140 --> 00:25:42,100 because over the years we've fucked things up and we've knocked systems over and pissed 308 00:25:42,100 --> 00:25:42,920 our clients off. 309 00:25:43,020 --> 00:25:48,840 And so, naturally, they want to restrict where we go. But I think we can fix that. 310 00:25:49,580 --> 00:25:56,820 So let me just quickly cover ‑‑ you know, I'm not the first person to talk about trying 311 00:25:56,820 --> 00:26:00,880 to push pen testing to more real‑world methods. I mean, I've been heavily influenced by a 312 00:26:00,880 --> 00:26:08,420 lot of folks, not the least of which are these guys here, H.D. Velsmith and others, going 313 00:26:08,420 --> 00:26:13,000 back to DEF CON 15, if not earlier. I'm not going to kind of summarize this. I'm going 314 00:26:13,020 --> 00:26:16,000 to summarize what they talked about. But, you know, go find these presentations if you're 315 00:26:16,000 --> 00:26:21,580 not familiar with them, read the white papers. And here's some more recent stuff. 316 00:26:26,180 --> 00:26:31,740 If you look at kind of this history of dialogue around real‑world penetration testing, there 317 00:26:31,740 --> 00:26:38,240 seems to be a focus on things like binary exploit versus other kinds of exploits, which 318 00:26:38,240 --> 00:26:42,460 I referred to earlier. Also, you know, the importance of zero days. Are they critical? 319 00:26:42,460 --> 00:26:47,420 Are they irrelevant? Well, that's all kind of interesting. But what I want to highlight 320 00:26:47,420 --> 00:26:51,960 is kind of the fundamental focus around real‑world penetration testing is the focus on stealth 321 00:26:51,960 --> 00:27:02,240 and safety. So let's take a quick look at what someone 322 00:27:02,240 --> 00:27:06,900 who's not applying these methods looks like. So we're going to run a couple of scenarios 323 00:27:06,900 --> 00:27:11,380 past you. We've got the lazy pen tester and then the real‑world pen tester. We're going 324 00:27:11,380 --> 00:27:11,980 to look at things. 325 00:27:12,460 --> 00:27:16,320 First, real quickly from kind of a network point of view. And then Chris is going to 326 00:27:16,320 --> 00:27:23,940 take a deeper dive from a host‑level analysis. So, of course, the lazy pen tester is none 327 00:27:23,940 --> 00:27:33,180 other than pen test John. And just so that I don't have just a list of kind of attack 328 00:27:33,180 --> 00:27:40,120 types, I went ahead and threw up some, you know, a network IDS, configured it with some 329 00:27:40,120 --> 00:27:41,540 default signatures. 330 00:27:42,460 --> 00:27:46,380 You know, and ran some of this stuff just to give you ‑‑ I'm kind of starting to 331 00:27:46,380 --> 00:27:51,460 scratch the surface of what a deeper analysis of this might look like from the network layer. 332 00:27:51,800 --> 00:28:00,120 So here's kind of a trivial example. Nmap is going to trigger a bunch of alerts. You'll 333 00:28:00,120 --> 00:28:04,700 hear me say later I'm kind of down on the whole port scanning thing. And this is one 334 00:28:04,700 --> 00:28:10,260 reason why. Triggering alerts, yes. But also if you've been doing this for a long time, 335 00:28:10,340 --> 00:28:12,440 I'm sure you've run into systems that actually fall. And you can see that there's a lot of 336 00:28:12,440 --> 00:28:20,680 all over when they get scanned. And why? Why are you doing that? Well, so here's another 337 00:28:20,680 --> 00:28:28,640 one. Specific to a particular protocol, this is SMB taking advantage of NetBios Null Sessions 338 00:28:28,640 --> 00:28:33,380 or SMB Null Sessions and enumerating lots of stuff maybe from a domain controller like 339 00:28:33,380 --> 00:28:38,900 users and groups and password policies and shit. And, you know, it's just a ‑‑ it's 340 00:28:38,900 --> 00:28:47,200 low‑level alerts, but it's going to potentially trigger a lot. Another example, password brute 341 00:28:47,200 --> 00:28:57,260 forcing. Trying to guess, you know, weak passwords in this case against SMB again. In this case 342 00:28:57,900 --> 00:29:02,780 you're not going to potentially see a lot of alerts, but password failure alerts tend 343 00:29:02,780 --> 00:29:08,640 to get high severity. So a few alerts, but they're red. Again, not what you want. 344 00:29:08,640 --> 00:29:18,660 And then here's a exploit, classic example, Metasploit, MSO867, and again, lots of red 345 00:29:18,660 --> 00:29:26,760 events. So I don't like these. So what's it look like from the other end? 346 00:29:28,200 --> 00:29:33,220 Right. Okay. So what we're going to look at now is what the lazy pen tester is going 347 00:29:33,220 --> 00:29:38,560 to leave behind. Now, understand the caveat of this was a lab, right? I knew what Tim 348 00:29:38,560 --> 00:29:42,080 was ‑‑ well, I knew when he was going to attack. I knew what box he was going to 349 00:29:42,080 --> 00:29:48,300 attack. So, okay, there's a certain degree of unrealisticism, right, going into this. 350 00:29:49,900 --> 00:29:55,240 But you should get what we're trying to infer. Right? So the first thing I used was a tool 351 00:29:55,240 --> 00:29:59,180 called WinAlysis. Anyone ever used WinAlysis? It's an awesome tool. It's not supported 352 00:29:59,180 --> 00:30:04,240 anymore. But what it does is it basically takes a snapshot of your system, right, on 353 00:30:04,240 --> 00:30:07,960 a Windows system, and then you run malware against it or run an attack or whatever, you 354 00:30:08,560 --> 00:30:11,380 scan, and it shows you the deltas, which is really pretty cool. It's a quick and dirty 355 00:30:11,380 --> 00:30:14,980 way to find out what happened quickly. So as you can see, I've got some pretty big numbers 356 00:30:14,980 --> 00:30:19,960 there. Right? I've got some red stuff and some squares. Right? So basically what that 357 00:30:19,960 --> 00:30:24,960 means is all of those are changes to the system. Right? So Tim did what he did, and 358 00:30:24,960 --> 00:30:30,940 I've got 180 critical registry warnings. I've got some activity on file systems, and I've 359 00:30:30,940 --> 00:30:35,540 got some activity to users. So immediately I can start looking at what he did and how 360 00:30:35,540 --> 00:30:38,360 noisy his attack was. I don't know if you can see that. I'm going to ‑‑ 361 00:30:38,560 --> 00:30:45,400 That works on my system, not yours. Crap. Okay. Well, it sucks. But what that is is 362 00:30:45,400 --> 00:30:52,580 I'm able to show that that is RDP being enabled. Right? I see through ‑‑ this is from 363 00:30:52,580 --> 00:30:55,980 a forensic timeline. If you're not familiar with them, there's a really great tool called 364 00:30:55,980 --> 00:30:59,880 log to timeline by Kristen Gunderson that will allow you to take master file table, 365 00:31:00,160 --> 00:31:07,200 event logs, registry last write times, throw them all into one big body file, create a 366 00:31:07,200 --> 00:31:10,480 forensic timeline with that, and then it will allow you to perform different types 367 00:31:10,480 --> 00:31:14,400 of searches, chronological searches, keyword searches. It's a really, really great way 368 00:31:14,400 --> 00:31:19,260 for us to look at data in mass in a really tight, compact way. 369 00:31:19,640 --> 00:31:23,300 Additionally, it kind of throws time stomping out the window. I know that ‑‑ I wrote 370 00:31:23,300 --> 00:31:27,220 a blog post called Time Stomping is for Suckers. So if you really want to know how easy it 371 00:31:27,220 --> 00:31:31,620 is to detect timeline modification, go read my blog post on the digital standard, and 372 00:31:31,620 --> 00:31:35,980 I explain it in depth. So I'm not going to go into it here. So immediately I see that 373 00:31:36,660 --> 00:31:37,180 RDP is ‑‑ RDP is ‑‑ RDP is ‑‑ RDP is ‑‑ RDP is ‑‑ RDP is ‑‑ RDP is ‑‑ 374 00:31:37,180 --> 00:31:37,400 RDP is ‑‑ RDP is ‑‑ RDP is ‑‑ RDP is ‑‑ RDP is ‑‑ RDP is ‑‑ RDP 375 00:31:37,400 --> 00:31:42,820 has been enabled. RDP, remote desktop protocol, remote administration, there's my infiltration 376 00:31:42,820 --> 00:31:47,600 mechanism, right? So I did not draw that with a crayon, just 377 00:31:47,600 --> 00:31:51,780 in case you're wondering. That's a tool called Zoom It. It's pretty cool for presentations, 378 00:31:52,000 --> 00:31:56,540 but I circled. Some additional activities. So I see the SAM Hive being modified. Okay. 379 00:31:56,620 --> 00:32:00,680 And I see a new entry being created on the SAM Hive within the Windows registry. So for 380 00:32:00,680 --> 00:32:06,000 all the Windows people, new entry in SAM Hive equals what? New user. Wow, that's awesome. 381 00:32:06,100 --> 00:32:07,160 Good job, hacker. Thanks for creating that. 382 00:32:07,180 --> 00:32:14,640 me a new user. And you called it hacker. H-A-X-0-R. Which is kind of easy to spot. Now, I have 383 00:32:14,640 --> 00:32:19,660 never actually seen a user ID called hacker in the wild. What they're usually named when an 384 00:32:19,660 --> 00:32:24,260 attacker tries to create himself a back door is like a system account. The Internet user 385 00:32:24,260 --> 00:32:30,280 account. Something that looks kind of cool because we know all end users are what? They're 386 00:32:30,280 --> 00:32:36,420 stupid. Right? All of them. And so unfortunately they don't catch something like that. And 387 00:32:36,420 --> 00:32:40,140 realistically how many end users know how to parse the SAM hive, look at the last write times 388 00:32:40,140 --> 00:32:44,780 in the registry and see when a file was created? Right? Probably not many. So we do see this 389 00:32:44,780 --> 00:32:50,220 user activity being created from the registry hives. Right? And we can see that through the 390 00:32:50,220 --> 00:32:54,480 forensic timeline, I know exactly when this took place. So now we call this the window of 391 00:32:54,480 --> 00:32:58,280 intrusion. So now through my timeline and through my analysis, instead of looking 392 00:32:58,280 --> 00:33:03,980 everywhere, I've got about a, oh, I don't know, 5 minute period that the attack actually 393 00:33:03,980 --> 00:33:06,400 took place. I'm not taking massive forensics. I'm not taking the type of data that the 394 00:33:06,400 --> 00:33:11,140 images. I'm not looking at, you know, images and images and images and massive amounts 395 00:33:11,140 --> 00:33:16,560 of data. I'm looking through a timeline and then through my volatile data at about a ten 396 00:33:16,560 --> 00:33:21,860 minute period. Okay? And I was able to do all that very, very quickly. Right? So one 397 00:33:21,860 --> 00:33:26,440 of the things I did is in my forensic timeline, I knew I had a user ID called hacker. So that's 398 00:33:26,440 --> 00:33:32,500 my keyword that I'm going to search on. And so what I did is I grepped through that forensic 399 00:33:32,500 --> 00:33:38,760 timeline and I did a grep dash ‑‑ what did I do? I did a grep dash I for hacker and 400 00:33:38,760 --> 00:33:43,020 then I piped that to word count minus L to get a full listing of how many files actually 401 00:33:43,020 --> 00:33:47,960 had that thing on it. And there was 406. So through Tim's creation of that user ID, 402 00:33:48,200 --> 00:33:54,640 right, Windows then created ‑‑ or made 406 modifications to existing files or created 403 00:33:54,640 --> 00:34:00,140 new files. Okay? So then I piped that to only look for files that had been born. Right? 404 00:34:00,160 --> 00:34:02,080 It's an attribute, a Mac B attribute. 405 00:34:02,220 --> 00:34:02,480 Okay? So then I piped that to only look for files that had been born. Right? It's an 406 00:34:02,480 --> 00:34:08,260 NTFS file system. That B is birth. New files on the system. 133 new files from the creation 407 00:34:08,260 --> 00:34:14,700 of a single user ID. Very, very noisy. Very easy for us to pick up on. Okay? So if you're 408 00:34:14,700 --> 00:34:20,520 trying to employ stealth, not the way to do it. Okay? Because it leaves behind over 409 00:34:20,520 --> 00:34:26,760 530 residual trace data elements. Pretty cool. Okay. So the other thing I can see through 410 00:34:26,760 --> 00:34:30,460 my forensic timeline, remember I said there's different ways to search through this data. 411 00:34:30,660 --> 00:34:31,640 There's keyword searching. 412 00:34:31,640 --> 00:34:36,980 Which, eh, if I have keywords to go off of, okay. What's better that I like more is chronological 413 00:34:37,320 --> 00:34:41,300 searches. When I have a window of intrusion that I'm looking for, now I can look at all 414 00:34:41,300 --> 00:34:46,200 activity in that window. I can add registry lapse right times. I can add event logs. 415 00:34:46,540 --> 00:34:50,660 And really in log to timeline, what's cool is there's like, I don't know, like 30 different 416 00:34:50,660 --> 00:34:54,980 supported log file elements. And you can e‑mail Kristen if you find one that's not there and 417 00:34:54,980 --> 00:34:58,900 he'll add it for you. So it's a really, really great tool. So I can add all of this log data 418 00:34:58,900 --> 00:35:01,620 and then say, show me everything that took place in this 10‑minute time frame. And 419 00:35:01,620 --> 00:35:11,480 I can look at all of the activity. So I see this download, right, of IP scan win32-3.0-beta6.exe. 420 00:35:11,500 --> 00:35:17,700 Does everyone know what that is? It's the angry IP scanner. Again, not necessarily the 421 00:35:17,700 --> 00:35:23,340 downloading of the IP scanner is noisy, but the download of a utility onto the system 422 00:35:23,340 --> 00:35:27,880 is going to leave residual trace data, not only in the Internet access logs that's going 423 00:35:27,880 --> 00:35:31,600 to show that taking place, but if it were FTP. Let's say he didn't use the FTP. Let's 424 00:35:31,620 --> 00:35:36,340 say he used the web or the Internet. Well, he did. But HTTP, right, he uses FTP. What's 425 00:35:36,340 --> 00:35:41,620 that going to create? The execution of FTP.exe is going to create a prefetch file. So I know 426 00:35:41,620 --> 00:35:48,280 that he executed FTP prior to the file or what API, the URL download to file API being 427 00:35:48,280 --> 00:35:53,180 invoked and a file appearing on the system with a new birth date. All of that sequentially, 428 00:35:53,280 --> 00:35:57,080 like Tim said, a small thing here and a small thing here and a small thing here, chain those 429 00:35:57,080 --> 00:36:01,120 together, and I've got a story of what took place that's really pretty good. So I can 430 00:36:01,620 --> 00:36:06,340 see that that file was downloaded and then I can grep through that and I can see file 431 00:36:06,340 --> 00:36:10,400 execution as well. Because the first time a file is executed on a Windows system, what 432 00:36:10,400 --> 00:36:15,320 gets created? Prefetch, right? I can parse out prefetch data. I can see the original 433 00:36:15,320 --> 00:36:19,780 location of the file. I can see the last time that file was executed. It really gives 434 00:36:19,780 --> 00:36:25,200 me a great deal of information. So by him being sloppy, kind of intentionally, but to 435 00:36:25,200 --> 00:36:29,300 show what can take place and what kind of residual data elements you leave behind by 436 00:36:29,300 --> 00:36:30,620 not employing stealth. 437 00:36:30,620 --> 00:36:34,720 Maybe as a pen tester now, you can say to yourself, wow, I didn't know I created 438 00:36:34,720 --> 00:36:39,680 that much data behind what I was doing. Maybe I can employ a better method that's not going 439 00:36:39,680 --> 00:36:44,880 to leave gobs and gobs and gobs of data behind. Or as a forensics investigator, we can all 440 00:36:44,880 --> 00:36:48,360 look at that and go, wow, I didn't know that much data was left behind. That gives me something 441 00:36:48,360 --> 00:36:54,040 to look at when I'm forming my window of intrusion on a specific investigation. So we've got 442 00:36:54,040 --> 00:36:54,660 a new one now. 443 00:36:55,140 --> 00:37:00,600 Okay. So let's reset and run the scenario again from the beginning. 444 00:37:01,400 --> 00:37:10,220 So we've got a real world pen tester at the controls. So like I said, in my view of real 445 00:37:10,220 --> 00:37:17,900 world pen testing, port scanning is passe. It's not cool. So what are you going to do 446 00:37:17,900 --> 00:37:22,020 instead? Well, the first thing you do is total passive network analysis. This screen 447 00:37:22,020 --> 00:37:28,860 is an example of how to do that. This is a module called pig. It was written by a colleague, 448 00:37:28,940 --> 00:37:29,440 Ryan Lynn. 449 00:37:30,620 --> 00:37:40,920 presented on this DEF CON 19. And it's just a way of monitoring broadcast traffic, multicast 450 00:37:40,920 --> 00:37:48,740 traffic and if it's got a protocol parser for it, it will suck that data in and populate 451 00:37:49,200 --> 00:37:54,660 elements of the Metasploit database so that you could potentially, you know, take these 452 00:37:54,660 --> 00:38:01,760 things up into, you know, next stages of the attack. So, I mean, but you're identifying 453 00:38:01,760 --> 00:38:07,900 hosts on the network, right? And maybe what kind of hosts they are. And you're not generating 454 00:38:07,900 --> 00:38:15,180 any packets at all, so of course you're leaving no trace. That reminds me of a sidebar discussion 455 00:38:15,180 --> 00:38:21,100 we could have later in Q&A about detecting promiscuous mode. That's really a red herring. 456 00:38:22,120 --> 00:38:24,640 So if we wanted to take that to the next slide. 457 00:38:24,660 --> 00:38:29,820 We could start getting a little bit active. We can get active at layer 2. And we can do 458 00:38:29,820 --> 00:38:35,800 our cache poisoning and start middling traffic on the local network. And we can, you know, 459 00:38:35,800 --> 00:38:40,080 tie that in to the kind of analysis that we could do through PIG. And now we're learning 460 00:38:40,080 --> 00:38:43,560 new things because we're not just looking at broadcast traffic, we're looking at unicast 461 00:38:43,560 --> 00:38:49,240 traffic that's destined to other people that we are intercepting. And so now we're learning 462 00:38:49,240 --> 00:38:52,340 more stuff about the network. Who else is on it? What kind of protocols are flowing 463 00:38:52,340 --> 00:38:52,740 over it? 464 00:38:54,560 --> 00:39:01,160 This couple of slides or the screen shot here, the stuff below is DTEX from ARP alert, 465 00:39:01,380 --> 00:39:05,760 just to give you an example of what ARP cache poisoning might look like if there happened 466 00:39:05,760 --> 00:39:11,780 to be some sensor on the network paying attention to ARP traffic. You know, really in the real 467 00:39:11,780 --> 00:39:20,680 world I've maybe seen ARP defenses in maybe 2% of the clients I've worked with. The tool 468 00:39:20,680 --> 00:39:22,720 at the top is part of a spider web. It's a little bit more complex. It's a little bit 469 00:39:22,740 --> 00:39:26,340 better than a spider web. It is called thick net. Vamp is the part that actually does 470 00:39:26,340 --> 00:39:33,920 the ARP spoofing. But the thick net module is what you would actually use to intercept 471 00:39:33,920 --> 00:39:40,420 and take over in particular Oracle and Microsoft SQL server database transactions so that you 472 00:39:40,420 --> 00:39:46,060 can inject your own commands into the database streams and take over databases. And it's 473 00:39:46,620 --> 00:39:47,220 really cool. 474 00:39:50,500 --> 00:39:52,720 So that's one way we could capture those data. There are other ways you could do that. 475 00:39:52,740 --> 00:39:57,100 kind of take it to the next level and start getting active at layers above layer 2 is 476 00:39:57,100 --> 00:40:08,880 take over sessions. Another way to do it is through NetBIOS name service response spoofing. 477 00:40:09,220 --> 00:40:13,120 So this is just a quick little video. This is just an attack that I ‑‑ it's just 478 00:40:13,120 --> 00:40:21,080 so stupid easy. The top third shows Wireshark filtering on UDP 137. The middle window shows 479 00:40:21,080 --> 00:40:27,300 where I'm going to be launching Metasploit and, you know, running the modules to actually 480 00:40:27,300 --> 00:40:33,160 do the response spoofing. And the bottom third is Windows Explorer and basically someone 481 00:40:33,160 --> 00:40:38,100 is going to go and enter an address that doesn't resolve into the address bar. And I think 482 00:40:38,100 --> 00:40:51,060 if I can manage to click play here somewhere. So once Metasploit launches, I'm going to 483 00:40:51,080 --> 00:40:55,240 see the victim in Windows Explorer is going to start entering an address. And as soon 484 00:40:55,240 --> 00:40:59,800 as they're going to hit whack whack foobar, when they hit the third whack, you're immediately 485 00:40:59,800 --> 00:41:08,300 going to see the request come through Wireshark in the top. So there's foobar getting entered. 486 00:41:08,700 --> 00:41:14,700 The final whack. Boom, a request. Boom, a hash. I mean, that's how fast it happens. 487 00:41:15,160 --> 00:41:20,820 And the user didn't even hit enter. They didn't even go to some bogus site. Maybe they 488 00:41:20,820 --> 00:41:26,760 see the typo and they correct it and they're none the wiser. At this point, though, you 489 00:41:26,760 --> 00:41:31,100 have hashes. It's like one of the easiest ways you can acquire a hash. And the import there 490 00:41:31,100 --> 00:41:37,980 is that now you can go native. And that's the goal. You want to as quickly as possible 491 00:41:37,980 --> 00:41:43,240 impersonate real user traffic on the network because then everything you leave behind is 492 00:41:43,240 --> 00:41:47,560 going to be really hard to distinguish from everything else on the normal network. So 493 00:41:47,560 --> 00:41:50,620 for example, you can start querying other servers. 494 00:41:50,820 --> 00:41:55,460 With those credentials you have and finding all kinds of useful data about the rest of 495 00:41:55,460 --> 00:42:02,920 the network. Or you can, you know, interact and run arbitrary commands. Maybe you can 496 00:42:02,920 --> 00:42:10,180 run GSEC dump and grab hashes. Or, you know, that might be dangerous. You're going to want 497 00:42:10,180 --> 00:42:16,080 to figure out whether antivirus is, you know, is on the target first and do some analysis 498 00:42:16,080 --> 00:42:20,460 of that. But what I like to do is, first, 499 00:42:20,820 --> 00:42:26,320 you know, grab netstat data from the targets I have compromised and, again, without the 500 00:42:26,320 --> 00:42:30,040 use of port scanning I'm now building up a very detailed profile of everything that is 501 00:42:30,040 --> 00:42:33,880 on the network and what kind of services are employed and to go from there. 502 00:42:39,920 --> 00:42:40,360 CHRISTIAN JORDAN, OPERATOR, GSEC DEPARTMENT OF ENGINEERING AND RESEARCH 503 00:42:40,360 --> 00:42:44,140 OK, so we're going to smoke through this last example because we've got about seven minutes 504 00:42:44,140 --> 00:42:49,740 to get off the stage. So in the next example Tim used a stealthy approach. He was able 505 00:42:49,740 --> 00:42:56,280 able to execute win EXE, which is kind of like PS exec, didn't leave any residual traces 506 00:42:56,280 --> 00:43:02,380 on the target system except for prefetch files. Which he went from creating over 500 files 507 00:43:02,380 --> 00:43:07,320 to still accomplishing the same goal, right, just using a different methodology and using 508 00:43:07,320 --> 00:43:11,540 a different tool to execute commands on the native system and leave me two prefetch files 509 00:43:11,540 --> 00:43:16,340 to look at, which was awesome, versus 530 additional files. The other thing that this 510 00:43:16,340 --> 00:43:20,360 did is it did create entries in the event logs. So provided that it's awesome enough 511 00:43:20,360 --> 00:43:23,740 that we have event logs in the investigation, which any investigator will tell you is about 512 00:43:23,740 --> 00:43:28,780 a third of the time, we do see a successful start control, we see the service entering 513 00:43:28,780 --> 00:43:34,380 the running state and we see the stop control. So going from over 500 entries to like less 514 00:43:34,380 --> 00:43:42,180 than ten. Okay. Really good. Additionally, I can see that the NTU user.dat file was accessed 515 00:43:42,180 --> 00:43:46,260 when he executed the command as the remote user. Yes, that is Sterling Archer. 516 00:43:46,260 --> 00:43:53,320 We see host being executed for the prefetch which enabled Win EXE to be executed and 517 00:43:53,320 --> 00:43:58,620 then GSD.EXE. So GSEC dump was kicked off. I see the prefetch for that. And there goes 518 00:43:58,620 --> 00:44:04,400 my hashes. So Tim just went native that fast. So in conclusion, right, attack number one 519 00:44:04,400 --> 00:44:10,160 touched more than 400 files, created 433 new ones and showed indicators of compromise indicating 520 00:44:10,160 --> 00:44:15,740 downloads and program execution. Very noisy, very sloppy, very easy to find. Attack number 521 00:44:15,740 --> 00:44:22,960 Number two, access of a single user ID and only creating two prefetch files and a few 522 00:44:22,960 --> 00:44:24,740 entries in the event logs but not a whole lot. 523 00:44:24,920 --> 00:44:29,440 His attack surface for me to investigate was so much smaller that he still accomplished 524 00:44:29,440 --> 00:44:31,760 the same goal through an exponentially better attack. 525 00:44:32,480 --> 00:44:39,160 So I'm going to ‑‑ So to summarize what I've been saying about 526 00:44:39,160 --> 00:44:41,980 real world pen testing, here's my top five ways to get caught. 527 00:44:42,600 --> 00:44:44,480 Number five, create new user accounts. 528 00:44:44,480 --> 00:44:46,580 I don't see the point in that. 529 00:44:46,740 --> 00:44:47,260 Don't do it. 530 00:44:47,480 --> 00:44:50,000 Number four, use password brute forceers. 531 00:44:50,060 --> 00:44:54,680 That's a really great way to lock accounts and otherwise trigger or announce your presence. 532 00:44:54,980 --> 00:44:59,860 Number three, push shellcode or port scan past a network monitor or in general use port 533 00:44:59,860 --> 00:45:00,120 scanning. 534 00:45:01,580 --> 00:45:03,820 Number two, let antivirus see your password dumper. 535 00:45:03,980 --> 00:45:04,700 Don't do that. 536 00:45:05,640 --> 00:45:07,100 Number one, crash your target. 537 00:45:07,260 --> 00:45:10,440 Didn't give a demo of that but that's a common problem. 538 00:45:11,040 --> 00:45:13,940 So in summary, do the least. 539 00:45:14,140 --> 00:45:14,460 Okay. 540 00:45:14,480 --> 00:45:18,200 Let's talk about this stuff that you can do to accomplish your mission. 541 00:45:18,920 --> 00:45:23,760 So now what we've really been demoing here is what you can think of as an info sec mashup. 542 00:45:23,860 --> 00:45:25,000 We've got these different domains. 543 00:45:25,280 --> 00:45:28,820 We're trying to put them together to train each other and make ourselves better. 544 00:45:29,020 --> 00:45:30,200 So we've got this space in the middle. 545 00:45:30,320 --> 00:45:31,280 We want to grow it. 546 00:45:31,880 --> 00:45:35,140 So what other ways can we think of to do that? 547 00:45:36,020 --> 00:45:40,480 So predominantly, right, so JTF missions, right, joint task force missions, working 548 00:45:40,480 --> 00:45:44,460 with your pen testers, forensicators, and forensicators working with your pen testers. 549 00:45:44,460 --> 00:45:48,260 To figure out what it is that real world attacks actually look like. 550 00:45:48,360 --> 00:45:50,760 What do exploits really look like in memory? 551 00:45:50,980 --> 00:45:52,800 What do they really look like on a disk system? 552 00:45:53,080 --> 00:45:54,640 You're not going to find that with encase. 553 00:45:54,820 --> 00:45:56,260 You're not going to find it with FTK. 554 00:45:56,520 --> 00:46:01,420 You're only going to find it by doing analysis real time with labs with, you know, your friends 555 00:46:01,420 --> 00:46:02,160 in the pen test community. 556 00:46:02,540 --> 00:46:02,820 Right? 557 00:46:02,840 --> 00:46:04,300 And then MREs, everyone's had those. 558 00:46:04,380 --> 00:46:04,700 They're delicious. 559 00:46:04,920 --> 00:46:05,080 Right? 560 00:46:05,120 --> 00:46:05,760 Meals ready to eat. 561 00:46:06,300 --> 00:46:07,400 15,000 calories. 562 00:46:07,520 --> 00:46:08,480 Bind you up for four days. 563 00:46:08,660 --> 00:46:09,400 It's great stuff. 564 00:46:09,980 --> 00:46:12,080 So we have incidents ready to eat. 565 00:46:12,240 --> 00:46:12,640 Right? 566 00:46:12,640 --> 00:46:17,480 When Tim comes with a new exploit, we have a pre‑canned virtual machine that he can 567 00:46:17,480 --> 00:46:17,700 attack. 568 00:46:18,020 --> 00:46:20,080 It's got all of my detection tools built into it. 569 00:46:20,280 --> 00:46:22,780 It's got the tools that he needs to conduct his exploits. 570 00:46:22,860 --> 00:46:25,860 So we can kind of do that, extract the data and analyze what it's going to look like. 571 00:46:25,980 --> 00:46:27,620 Then we can take that information and move it outwards. 572 00:46:28,120 --> 00:46:32,640 And then future projects, right, further analysis of common penetration ‑‑ 573 00:46:34,700 --> 00:46:40,500 Actually, I was referring to where we've actually shipped these virtual training labs out to 574 00:46:40,500 --> 00:46:40,900 customers. 575 00:46:41,160 --> 00:46:41,400 Right? 576 00:46:41,400 --> 00:46:46,240 So we can build a virtual training lab for folks that want incident response training. 577 00:46:47,480 --> 00:46:51,540 And give them a pre‑hacked virtual lab to work in. 578 00:46:52,120 --> 00:46:56,500 Other future projects, we need to do further analysis of common methods. 579 00:46:56,720 --> 00:47:00,120 And we need to develop stealthier attacks. 580 00:47:00,440 --> 00:47:04,920 And then that pushes the bar for the other side of the community to develop better response 581 00:47:04,920 --> 00:47:06,660 capabilities and detection capabilities. 582 00:47:07,060 --> 00:47:11,140 And I have some places that I want to go in terms of pen test automation. 583 00:47:11,140 --> 00:47:14,620 But I'm not ready to share those yet. 584 00:47:14,760 --> 00:47:17,200 But that's ‑‑ there's some things I'm thinking about along those lines. 585 00:47:18,380 --> 00:47:20,820 And that's all we have time for today. 586 00:47:21,720 --> 00:47:26,260 And we thank you very much for being here at 10 a.m.