1 00:00:00,000 --> 00:00:05,760 Our speaker today, we have Brian on generating labeled data from adversary simulations with MITRE ATT&CK. 2 00:00:05,900 --> 00:00:06,800 Please give it up for him. 3 00:00:14,240 --> 00:00:17,620 Thank you very much for coming so early on Sunday morning. 4 00:00:17,720 --> 00:00:18,320 That's awesome. 5 00:00:19,240 --> 00:00:22,020 I appreciate you guys coming and listening to this for a little bit. 6 00:00:22,080 --> 00:00:29,040 I wanted to talk to you about a couple of things and just give you a little bit of background on how I see this problem set. 7 00:00:30,300 --> 00:00:44,700 So the general premise here is that whatever I'm looking at, whether it's bro logs or whatever the problem is that I'm trying to solve, I try to recognize the biases that I have, right? 8 00:00:44,760 --> 00:00:46,740 So I looked at this last week. 9 00:00:46,780 --> 00:00:48,700 I looked at this last month, that kind of idea. 10 00:00:49,080 --> 00:00:59,980 So if I can abstract away some of that bias and have a repeatable methodology, something that's based on math, maybe I can find some insights. 11 00:01:00,000 --> 00:01:06,080 And the interesting thing about what I'm talking about today is, for me, it's not theoretical at all. 12 00:01:07,660 --> 00:01:11,580 We have an internal red team that's really proficient. 13 00:01:11,660 --> 00:01:13,340 Is anyone here from the red team? 14 00:01:16,820 --> 00:01:22,980 We have a red team that sometimes will perform some activities based on MITRE ATT&CK. 15 00:01:23,180 --> 00:01:29,840 And whether that's DNS exfiltration like we're talking about today or some other technique, they'll hit a canary URL. 16 00:01:30,000 --> 00:01:37,060 So think about white box and overt out in the open versus black box. 17 00:01:37,380 --> 00:01:49,060 So if you heard of the threat hunting, the hypothesis, you know, I think that there might be DNS exfiltration and therefore you come up with a plan and look for the artifacts. 18 00:01:49,160 --> 00:01:50,240 We'll get into that in a minute. 19 00:01:50,360 --> 00:01:52,260 But for me, it's not theoretical at all. 20 00:01:52,620 --> 00:01:58,780 I know, based on what I saw here, that those guys, my friends that I drink beer and bourbon with. 21 00:01:59,380 --> 00:02:00,740 That they ripped us off. 22 00:02:00,820 --> 00:02:04,640 They broke in and they stole some stuff on May 18th, 2018. 23 00:02:04,940 --> 00:02:09,180 And that was the white box overt time where they hit the canary URL. 24 00:02:09,340 --> 00:02:17,640 And I know from patterns, that means that they probably broke in again in a covert black box way. 25 00:02:17,980 --> 00:02:24,840 So when we talk about assumed breach, completely not theoretical, whether you believe in that philosophy or not, which I do. 26 00:02:25,000 --> 00:02:28,500 You know, I know that these guys that bought me a beer the other night. 27 00:02:28,780 --> 00:02:31,780 They're probably sitting on some data that they exfilt. 28 00:02:31,860 --> 00:02:36,800 So that's kind of the background that we'll get into here with the threat hunting and how this ties in. 29 00:02:37,180 --> 00:02:39,220 But here's the quick agenda. 30 00:02:39,760 --> 00:02:40,960 Do a very quick intro. 31 00:02:42,420 --> 00:02:44,900 Believe it or not, the MITRE attack, it's going to be real quick. 32 00:02:46,300 --> 00:02:47,200 Love MITRE attack. 33 00:02:47,400 --> 00:02:48,000 Absolutely do. 34 00:02:48,320 --> 00:02:53,980 But I think a lot of CFPs, a lot of cons, a lot of stuff's getting saturated, right? 35 00:02:54,060 --> 00:02:58,640 So if anybody wants more information that I'm going to provide in the slides. 36 00:02:58,780 --> 00:03:06,600 Here, please come up, I'll talk about it as long as you want to afterwards, but I'm going to trim that down just a little bit because I think everyone's probably heard a lot about it recently. 37 00:03:08,120 --> 00:03:25,140 So harvesting labeled training data, we'll get into what I mean by that EDA exploratory data analysis, machine learning, worked example, and I'll talk about just very candidly some challenges that I've run into and a little bit about future work. 38 00:03:25,220 --> 00:03:28,760 So before I do that, I just wanted to get a quick sense of what the. 39 00:03:28,760 --> 00:03:30,100 The background is in the room. 40 00:03:30,340 --> 00:03:35,640 So if we could just start here and we'll go around and tell everybody what you do and name. 41 00:03:35,900 --> 00:03:36,360 Okay. 42 00:03:36,440 --> 00:03:38,260 Well, how about, could I just see a show of hands? 43 00:03:38,360 --> 00:03:40,700 How many people do something like threat hunting? 44 00:03:41,120 --> 00:03:45,880 How many people do any kind of data analytics outside of Excel? 45 00:03:46,460 --> 00:03:46,960 Awesome. 46 00:03:50,180 --> 00:03:58,080 And how many people have some sort of a program where you're doing adversary. 47 00:03:58,880 --> 00:04:01,860 Simulation where you've got actual purple team, both folks internal. 48 00:04:02,040 --> 00:04:02,480 Okay, cool. 49 00:04:02,580 --> 00:04:03,360 Thank you very much. 50 00:04:03,860 --> 00:04:04,880 That's a terrible idea. 51 00:04:04,960 --> 00:04:05,560 I don't know what I was thinking. 52 00:04:06,440 --> 00:04:07,040 All right. 53 00:04:07,060 --> 00:04:08,380 So real quickly about me. 54 00:04:08,440 --> 00:04:09,060 My name is Brian. 55 00:04:09,980 --> 00:04:13,300 I'm a threat hunting lead at a Fortune 100 financial services company. 56 00:04:13,520 --> 00:04:22,600 I also help out with the threat intelligence and now security orchestration automation response or sore. 57 00:04:24,460 --> 00:04:28,140 But the bottom line for me is that there's one prime directive. 58 00:04:28,220 --> 00:04:28,560 It's. 59 00:04:28,560 --> 00:04:29,120 Find evil. 60 00:04:29,340 --> 00:04:33,080 You know, Rob Lee from Sands talks about no normal. 61 00:04:33,160 --> 00:04:33,660 Find evil. 62 00:04:33,860 --> 00:04:38,440 I mean, I, I think about this all day, sometimes all night. 63 00:04:38,560 --> 00:04:42,280 I hear about that a little bit from my wife sometimes, but she's been very patient with that. 64 00:04:42,800 --> 00:04:44,240 It's almost an obsession. 65 00:04:44,860 --> 00:04:56,860 So MITRE ATT&CK framework, we're probably mostly familiar with it, but just to level set, it's tactics, techniques, common knowledge. 66 00:04:57,520 --> 00:04:58,480 And it's a cure. 67 00:04:58,560 --> 00:05:11,040 It's a curated knowledge base and model for cyber adversary behavior, reflecting the various phases of adversaries lifecycle and the platforms they're known to target. 68 00:05:11,280 --> 00:05:18,820 So my buddy Zach, the lead red team guy at our place in Milwaukee, we did a talk at Derby Con in 2016. 69 00:05:19,200 --> 00:05:20,060 It's a small world. 70 00:05:20,200 --> 00:05:22,180 Anybody see that talk in 2016 Derby Con? 71 00:05:22,300 --> 00:05:27,120 So we were just talking about very open kimono, very transparent. 72 00:05:27,560 --> 00:05:28,540 Here's what we were talking about. 73 00:05:28,540 --> 00:05:33,400 We're trying to do with limited resources and budget and everything else, because there's a lot of techniques. 74 00:05:34,120 --> 00:05:35,340 Here's what we tried. 75 00:05:35,440 --> 00:05:36,480 Here's why we're doing it. 76 00:05:36,540 --> 00:05:37,600 And here were the results. 77 00:05:38,100 --> 00:05:44,920 So I didn't put the ATT&CK timeline on here, but I know that we have pre-ATT&CK now. 78 00:05:45,020 --> 00:05:49,160 But at that point, we were just primarily focusing on the later stages of ATT&CK. 79 00:05:49,260 --> 00:05:53,160 So that's the context in which I'm talking about some of these techniques. 80 00:05:53,260 --> 00:05:56,060 So in particular, and. 81 00:05:57,320 --> 00:05:58,100 We're talking about. 82 00:05:58,100 --> 00:06:00,280 Exfiltration over alternative protocol. 83 00:06:01,140 --> 00:06:03,960 You know, I didn't blow this up because I wanted to fit everything on there. 84 00:06:04,080 --> 00:06:05,500 So you don't need to see what's on there. 85 00:06:05,580 --> 00:06:05,980 I will. 86 00:06:06,220 --> 00:06:10,620 I will make sure that I have my Twitter handle, which is just at Brian Gens. 87 00:06:11,220 --> 00:06:19,360 If anybody wants to watch that, I'll have all these slides up by Tuesday, Tuesday, midnight, Central Daylight Time. 88 00:06:19,580 --> 00:06:22,800 So exfiltration over alternative protocol here. 89 00:06:22,860 --> 00:06:24,180 I'm focused on DNS. 90 00:06:24,640 --> 00:06:27,800 So is anybody think of any tools that you might use for. 91 00:06:27,800 --> 00:06:28,840 DNS exfiltration? 92 00:06:29,080 --> 00:06:30,000 Go ahead and shout it out. 93 00:06:32,040 --> 00:06:32,960 Somebody said iodine. 94 00:06:33,180 --> 00:06:33,540 Yeah. 95 00:06:33,640 --> 00:06:34,360 Anybody else? 96 00:06:34,600 --> 00:06:37,560 Cobalt Strike fans or write your own. 97 00:06:37,740 --> 00:06:39,460 So there's a lot of different ways you can do this, right? 98 00:06:40,860 --> 00:06:44,260 Interestingly, I don't want to create an overfitted model. 99 00:06:44,500 --> 00:06:45,560 Anybody ever see that thing? 100 00:06:45,960 --> 00:06:49,800 There was some kind of picture I saw on Twitter from the Bay Area and it was talking about overfitting a model. 101 00:06:50,260 --> 00:06:55,580 I can't verify whether this is true or not, but maybe somebody in the back can tell me if you heard about this. 102 00:06:56,720 --> 00:06:57,440 Essentially that. 103 00:06:57,440 --> 00:07:00,480 A lot of the models were trained on roads. 104 00:07:00,720 --> 00:07:03,900 The Tesla's with the self-driving car mode in the Bay Area. 105 00:07:04,160 --> 00:07:08,800 And then when they were driving on roads, they were outside of that area. 106 00:07:08,920 --> 00:07:12,280 That didn't fit the initial kind of things that was used to. 107 00:07:12,480 --> 00:07:18,000 There were five salt lines that were laid down by a salt truck and that that was just messing with that. 108 00:07:18,140 --> 00:07:20,780 So if anybody heard about that, cool. 109 00:07:21,080 --> 00:07:26,320 If not, it's one example in my mind of how. 110 00:07:26,420 --> 00:07:27,260 If I try. 111 00:07:27,440 --> 00:07:35,760 To detect my buddies that are breaking in and stealing data, because if I can't detect them, I can't detect somebody else doing it, right? 112 00:07:36,840 --> 00:07:40,220 If I focus only on what it looks like with cobalt strike. 113 00:07:41,160 --> 00:07:42,280 That's too narrow, right? 114 00:07:42,420 --> 00:07:43,440 You use iodine. 115 00:07:43,440 --> 00:07:44,120 Maybe I'll catch it. 116 00:07:44,180 --> 00:07:44,700 Maybe I won't. 117 00:07:44,780 --> 00:07:55,520 So the point is that this is one of many techniques, but it's one that we focused on because we had the instrumentation and the telemetry to dig into. 118 00:07:55,520 --> 00:08:01,400 So really for me, all MITRE ATT&CK is, it's a true north. 119 00:08:01,720 --> 00:08:12,280 It's a true north where I and we can sit in front of our CISO and executive leadership and say, certainly there are compliance requirements. 120 00:08:12,700 --> 00:08:15,880 There are other things that we have to do and boxes that need to be checked. 121 00:08:16,080 --> 00:08:19,120 Well, let's focus on what the attackers are doing. 122 00:08:19,720 --> 00:08:23,600 They don't have to do something off the menu, on the menu, off the menu. 123 00:08:23,660 --> 00:08:24,300 It's up to them. 124 00:08:24,300 --> 00:08:31,840 But let's start with known TTPs and tighten up our monitoring and our detection engineering efforts. 125 00:08:34,680 --> 00:08:36,740 So I'm not going to spend a lot of time on this. 126 00:08:36,860 --> 00:08:43,180 If you follow this stuff, you're probably familiar with Katie Nichols and there's a couple other folks that have that. 127 00:08:43,240 --> 00:08:44,460 MITRE's got Caldera. 128 00:08:44,760 --> 00:08:46,520 Red Canary's got Atomic Red Team. 129 00:08:47,520 --> 00:08:48,620 Uber's got Meta. 130 00:08:49,080 --> 00:08:50,640 Endgame's got Red Team Automation. 131 00:08:50,800 --> 00:08:54,280 There are varying degrees of what they're offering. 132 00:08:54,280 --> 00:08:54,700 They're automating. 133 00:08:54,740 --> 00:08:57,360 But it's essentially helping teams. 134 00:08:57,500 --> 00:08:58,320 These are open source. 135 00:08:58,580 --> 00:09:04,940 Helping teams figure out how to do repeatable processes for adversary simulation. 136 00:09:05,440 --> 00:09:06,920 And then Cyber War Dog. 137 00:09:09,120 --> 00:09:13,920 Roberto Rodriguez, I think, is at Spectre Ops now and Devon Care, Endgame, right? 138 00:09:14,260 --> 00:09:19,380 Had an article that this will be linked to if you want to go to it when I send the slides out. 139 00:09:20,340 --> 00:09:24,260 Basically, they were using the API and hooking it in with the API. 140 00:09:25,420 --> 00:09:28,200 Basically, letting you dig in and do that. 141 00:09:28,280 --> 00:09:29,060 Hang on just a minute. 142 00:09:29,200 --> 00:09:30,080 Get some more vodka. 143 00:09:30,240 --> 00:09:30,740 Just kidding. 144 00:09:32,780 --> 00:09:37,080 And then that talk that we did is online if you want to look at that. 145 00:09:37,300 --> 00:09:39,740 So there I was, minding my own business. 146 00:09:40,940 --> 00:09:42,160 Red Team's sitting here. 147 00:09:42,300 --> 00:09:43,280 I'm sitting on the right. 148 00:09:43,600 --> 00:09:46,660 And Red Team is lighting things up. 149 00:09:47,000 --> 00:09:48,700 Probably Cobalt Strike at the time. 150 00:09:49,360 --> 00:09:51,500 And honestly, I can see them. 151 00:09:51,580 --> 00:09:52,520 They hit enter. 152 00:09:52,680 --> 00:09:54,260 And they're waiting for something. 153 00:09:54,260 --> 00:09:54,940 A callback. 154 00:09:55,180 --> 00:09:56,540 And then it starts popping up. 155 00:09:56,720 --> 00:10:01,240 I think that they're counting the milliseconds to, boom, okay, I got a callback here. 156 00:10:01,420 --> 00:10:05,720 And then they're kind of looking at me like, are your systems lighting up yet? 157 00:10:05,740 --> 00:10:07,820 Why aren't you guys hunting for this? 158 00:10:07,900 --> 00:10:12,500 Why aren't you guys looking at a ticket from Splunk or whatever sim you use? 159 00:10:13,360 --> 00:10:21,220 I look back at it and there were 300 rows that were specifically related to what my buddy Matt and Zach had done. 160 00:10:22,260 --> 00:10:23,600 Has anybody heard of? 161 00:10:23,600 --> 00:10:25,660 Low-cards exchange principle. 162 00:10:26,720 --> 00:10:29,240 So every contact leaves a trace. 163 00:10:29,540 --> 00:10:41,680 If a burglar breaks in, it might break a window, might leave some skin, might leave some hair, some kind of sample that law enforcement could use to trace back, get a DNA sample. 164 00:10:42,480 --> 00:10:44,940 You know, footprints outside of its muddy. 165 00:10:45,340 --> 00:10:48,680 This is what we're trying to do with MITRE ATT&CK. 166 00:10:48,800 --> 00:10:53,080 To identify, you know, Chris Sanders, who has the investigation theory course. 167 00:10:53,080 --> 00:11:20,980 We brought him in in December to do some training for our folks, and he talks about a triangle, a pyramid he's got of four different kinds of evidence sources, and he breaks it down like network, host, memory, and OSINT, and I want to know what are the digital artifacts that are left when my buddies or somebody else breaks in and steals stuff, and our architecture is not like yours. 168 00:11:23,080 --> 00:11:35,540 Your architecture probably isn't exactly like it was six months ago or a year ago, so I think there's a lot of value in seeing what this looks like, and why is everything moving on the screen? Because it's early. 169 00:11:35,940 --> 00:11:51,860 I know how this goes. It was slightly amusing to do that because it's parallax, and that's better than PowerPoint animation, so I think that counts. I don't think that's against the rules, but something that moves, you know. 170 00:11:52,180 --> 00:11:53,060 So how many people... 171 00:11:53,080 --> 00:11:55,480 How many people have heard of EDA, Exploratory Data Analysis? 172 00:11:58,360 --> 00:12:19,700 Well, let's start with, and again, don't worry about trying to read the small text here. What I wanted to show is the entirety of this rectangle, which is from Coralite's Brochi sheet, and this is all the DNS log fields, and the type, and the description of that. 173 00:12:19,920 --> 00:12:22,740 So in a minute, when we're trying to figure out... 174 00:12:23,080 --> 00:12:32,580 How do we represent the knowledge of what we're seeing on the network? How do we represent that and convert it into a feature? Or think of a column in a spreadsheet, right? 175 00:12:34,680 --> 00:12:49,260 How do we convert that into a feature that we can kind of hook into, and just in the same way that, you know, maybe you're training a child in some experiment, I don't know, to classify a fork versus a spoon. 176 00:12:49,680 --> 00:12:52,980 If none of that's labeled, if you don't know what the... 177 00:12:53,080 --> 00:13:00,780 If none of that's labeled, if you don't know what the ground truth is, you're dependent on somebody coming and doing that. Otherwise, all you can do is kind of cluster them based on similarities, right? 178 00:13:00,980 --> 00:13:07,780 But the first thing we have to do before we make those decisions is understand what AA is. You know, what does that mean in your environment? 179 00:13:09,060 --> 00:13:14,680 You know, protocol, proto, and then there's some other stuff we'll get into in a minute. 180 00:13:14,860 --> 00:13:17,340 But when I say ADA, I'm talking about starting with that. 181 00:13:18,440 --> 00:13:20,560 Jupyter Notebook used to be IPython Notebook. 182 00:13:24,480 --> 00:13:27,960 This is actually from Clarence's book that I've got here. 183 00:13:29,140 --> 00:13:29,820 Shameless plug. 184 00:13:32,000 --> 00:13:37,600 But I say that because this is from Chapter 2 of one of my new favorite books. 185 00:13:37,840 --> 00:13:41,380 Did anybody else buy Data-Driven Security in 2014, like the day it came out? 186 00:13:41,540 --> 00:13:41,960 Yeah. 187 00:13:43,820 --> 00:13:47,500 This is something I've been digging into, and it's very helpful. 188 00:13:47,840 --> 00:13:50,740 And it just reminds me that, you know, there's always something to learn. 189 00:13:51,040 --> 00:13:53,060 And I always... 190 00:13:53,080 --> 00:13:56,280 I always find it extremely valuable to get somebody else's perspective here. 191 00:13:56,420 --> 00:13:59,020 So this is actually from the O'Reilly GitHub. 192 00:13:59,400 --> 00:14:08,640 And it's just an example of, you know, we're bringing in some imports, loading the data, and just kind of standard pieces there. 193 00:14:09,080 --> 00:14:12,420 Pandas, DataFrame, just to oversimplify if you haven't heard of it before. 194 00:14:12,500 --> 00:14:14,220 But you can... 195 00:14:14,740 --> 00:14:17,940 I like to think of it visually as an Excel spreadsheet. 196 00:14:18,260 --> 00:14:21,760 I'm probably going to have pitchforks and torches after that comment. 197 00:14:21,800 --> 00:14:22,920 But I think it's a... 198 00:14:23,080 --> 00:14:25,560 It's tabular, so you can think of it right now. 199 00:14:25,640 --> 00:14:26,840 But it does much, much more. 200 00:14:27,000 --> 00:14:33,060 Has anybody heard of Kitware's Bro Analysis Tools, BAT? 201 00:14:34,700 --> 00:14:36,160 So there's a guy named Brian. 202 00:14:37,540 --> 00:14:39,200 He's one of the developers there. 203 00:14:39,760 --> 00:14:42,940 And I just can't say enough good things about these folks, too. 204 00:14:43,700 --> 00:14:45,960 Because I wasn't at BroCon last year. 205 00:14:46,640 --> 00:14:48,280 I saw the video that he'd done. 206 00:14:48,440 --> 00:14:52,060 And again, there'll be a link in this one at the bottom. 207 00:14:53,920 --> 00:14:58,920 And I contacted Brian because I was stuck on something, on his open source code. 208 00:14:59,080 --> 00:14:59,960 And I don't like to do that. 209 00:15:00,120 --> 00:15:03,400 I don't like to ask people to Google stuff for me to figure something out. 210 00:15:03,700 --> 00:15:07,440 I just, you know, a few weeks ago, I was playing around with something. 211 00:15:07,480 --> 00:15:09,840 I said, you know, I'll figure this out. 212 00:15:09,920 --> 00:15:11,380 I'm just not sure how long it's going to take. 213 00:15:11,920 --> 00:15:13,740 And I just sent him my question. 214 00:15:13,880 --> 00:15:18,360 And without getting into the details, it was essentially around, why can't I join two of these DataFrames together? 215 00:15:18,940 --> 00:15:23,060 And it was because of something on the back end, the way they were doing the preprocessing. 216 00:15:23,080 --> 00:15:27,680 With BroAnalysis tools, which they describe as a software bridge. 217 00:15:28,020 --> 00:15:34,880 So you can get from Bro to Pandas, and then from Pandas to Scikit-learn, which we'll talk about in a minute. 218 00:15:36,420 --> 00:15:42,060 But he appreciated the feedback from somebody kind of in the field, in the trenches, saying, this is what I'm trying to do. 219 00:15:42,160 --> 00:15:48,340 And he explained to me what the workaround was, because it was a different data type. 220 00:15:50,940 --> 00:15:52,840 So just another great example. 221 00:15:53,080 --> 00:15:54,780 People, you know, pitching in the open source community. 222 00:15:55,040 --> 00:16:01,200 And, I mean, I sent the dude an email at like 9 or 10 at night, and he responded that night by midnight. 223 00:16:01,380 --> 00:16:06,100 So it's really encouraging when you're kind of working through something and somebody else helps you out a little bit. 224 00:16:06,740 --> 00:16:15,460 So feature engineering, again, we're trying to figure out what are the things that we can use to categorize something. 225 00:16:15,740 --> 00:16:19,920 You know, this is, you could talk about height, diameter, top. 226 00:16:20,360 --> 00:16:22,980 So in the same way, we want to find ways to represent. 227 00:16:23,080 --> 00:16:28,160 The knowledge to describe what's going on on the network with DNS. 228 00:16:29,920 --> 00:16:39,560 And hopefully that's going to allow us to figure out what features we can hook into, and then train a model so we can catch my buddies the next time they break in. 229 00:16:41,040 --> 00:16:41,340 Okay. 230 00:16:42,680 --> 00:16:44,500 Griffin Data Science Virtual Environment. 231 00:16:44,680 --> 00:16:45,760 This is Charles Gibray. 232 00:16:45,880 --> 00:16:52,920 He does a class here with Austin Taylor and sometimes with Jay Jacobs from Data Driven Security. 233 00:16:52,920 --> 00:16:54,720 Awesome folks. 234 00:16:55,120 --> 00:17:00,860 He's got, I don't know if this is accurate, I've always thought of it as the Kali Linux for data science. 235 00:17:01,380 --> 00:17:02,900 So I use this. 236 00:17:03,260 --> 00:17:05,120 It's pretty decent. 237 00:17:06,900 --> 00:17:08,240 And, again, there will be a link there. 238 00:17:14,200 --> 00:17:19,020 So I said we're going to do a machine learning worked example. 239 00:17:19,440 --> 00:17:22,060 I pulled some stuff out of this. 240 00:17:22,220 --> 00:17:22,740 Okay. 241 00:17:22,740 --> 00:17:22,900 Okay. 242 00:17:22,920 --> 00:17:32,100 I'm going to listen to some of the other talks just because I wanted to make sure that I don't cram some kind of crazy algorithm in and try to show everything that I'm doing. 243 00:17:32,720 --> 00:17:35,980 Because, again, I mentioned I'm doing a little bit of orchestration automation. 244 00:17:36,560 --> 00:17:47,520 So I want to kind of have that cycle going where I'm getting an internal IP address, you know, going forward, and then enriching that with friendly intelligence or, okay, here's the IP address. 245 00:17:47,860 --> 00:17:49,240 Which host grabbed that? 246 00:17:49,340 --> 00:17:51,280 Let's assume 24-hour lease for a minute. 247 00:17:51,420 --> 00:17:51,880 Okay. 248 00:17:51,940 --> 00:17:52,480 Which host? 249 00:17:52,480 --> 00:17:54,900 Which internal host name has it? 250 00:17:55,000 --> 00:17:56,400 Who's the last logged in user? 251 00:17:56,580 --> 00:17:58,820 With that, then go collect some other stuff. 252 00:17:58,980 --> 00:18:08,100 The more you can find out and the faster you can find out, feed that back in, there might be a feature or a column that you can compute or some other insight. 253 00:18:09,160 --> 00:18:10,560 I'm going to say reputation score. 254 00:18:10,780 --> 00:18:17,720 I know it's a terrible example, but some other verifiable piece of information that you can create another column about. 255 00:18:22,480 --> 00:18:24,280 And a very fine print in the bottom. 256 00:18:24,660 --> 00:18:31,960 I'm being very explicit about giving credit to Charles Gevery because I literally lifted this from his slide. 257 00:18:32,040 --> 00:18:33,140 I just made it different colors. 258 00:18:33,220 --> 00:18:34,260 So thank you, Charles. 259 00:18:35,980 --> 00:18:38,560 There's different descriptions of how this works. 260 00:18:38,640 --> 00:18:45,320 I like this from his training class because it's consumable for me. 261 00:18:45,420 --> 00:18:47,560 You get and you clean the data. 262 00:18:47,720 --> 00:18:51,520 You pre-process, do the feature engineering. 263 00:18:51,520 --> 00:18:56,120 Now, some of this stuff, this is naive of me. 264 00:18:56,320 --> 00:19:00,060 When I thought bro logs, I'm like, ah, bro logs are pretty structured, right? 265 00:19:00,860 --> 00:19:02,040 I'm not going to have a lot of this. 266 00:19:02,100 --> 00:19:02,200 No. 267 00:19:02,700 --> 00:19:08,920 Because there's a lot of getting it from where it is to where it needs to go, a lot of the data engineering and the pipeline, that kind of stuff. 268 00:19:09,280 --> 00:19:20,020 And believe it or not, id.orig underscore h, that's the one I'm going to think of as the source IP. 269 00:19:20,520 --> 00:19:21,440 Then initiate that. 270 00:19:21,520 --> 00:19:32,700 Just the fact, can anybody think of a problem when you start doing stuff in Python and the label, the field or column name is called dot something? 271 00:19:34,040 --> 00:19:35,740 So you're going to throw an error, right? 272 00:19:36,080 --> 00:19:43,860 And it's just simple things like that where you'll see that in a few minutes here where we have a column that's renamed. 273 00:19:44,000 --> 00:19:44,620 Not a big deal. 274 00:19:44,740 --> 00:19:46,680 But I wouldn't have thought that I'd run into that. 275 00:19:46,900 --> 00:19:50,460 It's just a different use than maybe we originally thought of for it. 276 00:19:52,660 --> 00:19:58,360 But then with the preprocessing feature engineering, bro analysis tools, again, 277 00:19:59,040 --> 00:20:06,300 Kitware describes that as an open source software bridge that's going to kind of do some of the behind the scenes heavy lifting. 278 00:20:06,840 --> 00:20:11,020 So you can just use it kind of as a gray box and move forward with what you're trying to analyze. 279 00:20:11,460 --> 00:20:13,240 And then advanced feature selection. 280 00:20:14,400 --> 00:20:19,640 Then we have the data that we're going to split into train and test. 281 00:20:21,520 --> 00:20:22,740 And then we'll build the model. 282 00:20:22,920 --> 00:20:24,300 We'll evaluate the model. 283 00:20:24,440 --> 00:20:26,300 And I tried a couple of different things. 284 00:20:26,560 --> 00:20:28,220 So I'll show you a couple of differences. 285 00:20:29,340 --> 00:20:40,720 But the main thing that popped into my head when we started talking about this is if I have labeled data, if I can use labeled data when we train that model, 286 00:20:42,340 --> 00:20:47,360 now I can move from unsupervised, which is clustering, to supervised. 287 00:20:48,040 --> 00:20:48,960 Now we've got. 288 00:20:49,280 --> 00:20:50,700 . . 289 00:20:50,700 --> 00:20:57,520 I know from the 300 records that are from the DNS exfiltration, from Cobalt Strike or whatever it is. 290 00:20:57,600 --> 00:20:59,920 I know what they did and when they did it on May 18th. 291 00:21:00,660 --> 00:21:06,920 So I have another column where it's one if it's known malicious and it's zero if it's not. 292 00:21:07,960 --> 00:21:09,500 Does that solve everything? 293 00:21:09,840 --> 00:21:17,060 No, there's some issues there because what do the attackers and red team want to do? 294 00:21:17,120 --> 00:21:17,860 You want to be stealthy? 295 00:21:18,500 --> 00:21:20,640 And the better your tradecraft is. 296 00:21:20,700 --> 00:21:29,580 The more stealthy you are, the more stealthy you are, and the quieter you are, the fewer artifacts that I have, which leads to something we call class imbalance. 297 00:21:31,340 --> 00:21:32,860 And you can correct for that. 298 00:21:33,020 --> 00:21:34,300 You can adjust for that. 299 00:21:34,800 --> 00:21:37,240 But I kind of wonder sometimes, do I want to? 300 00:21:37,420 --> 00:21:43,840 Do I want to make that seem like it's a bigger part of the log data than it really is? 301 00:21:49,100 --> 00:21:49,500 So. 302 00:21:49,700 --> 00:21:50,100 . . 303 00:21:50,100 --> 00:21:50,680 . . 304 00:21:50,700 --> 00:21:55,360 I'm importing pandas, and then we just have a as PD. 305 00:21:55,600 --> 00:22:07,500 I'm importing NumPy, get in the matrix, and then from bat, bro analysis tools, which he's going to change the name after they change the name at some point. 306 00:22:07,580 --> 00:22:18,980 So keep in mind that this will be called something else because bro itself is changing the name of their offering, but import log to DataFrame. 307 00:22:19,300 --> 00:22:20,040 And then. 308 00:22:20,700 --> 00:22:22,240 A lot of times you'll see DF equals. 309 00:22:22,360 --> 00:22:35,140 I just put DNS underscore DF equals, and I'm calling log to DataFrame dot log to DataFrame path to this is one hour's worth of logs. 310 00:22:36,440 --> 00:22:43,440 One hour's worth of logs, and then next I see DNS DF dot rename columns. 311 00:22:43,840 --> 00:22:46,880 So you see what I was talking about, the ID dot origin. 312 00:22:47,120 --> 00:22:49,800 So if you have something dot ID dot origin. 313 00:22:50,700 --> 00:22:51,340 You're going to throw an error. 314 00:22:51,460 --> 00:22:55,900 And anything I say there's two or three ways you could probably get around that. 315 00:22:56,020 --> 00:22:57,200 This is the quickest for me. 316 00:23:00,380 --> 00:23:01,340 Filtered DNS. 317 00:23:01,500 --> 00:23:01,720 DF. 318 00:23:02,520 --> 00:23:06,240 All I'm saying there is the DataFrame. 319 00:23:06,820 --> 00:23:08,240 We call the DNS DF. 320 00:23:08,500 --> 00:23:10,500 The DataFrame is after the equal sign. 321 00:23:10,640 --> 00:23:12,700 So we're saying DNS underscore DF. 322 00:23:12,840 --> 00:23:15,120 We're referencing that pandas DataFrame. 323 00:23:15,300 --> 00:23:19,660 And then in the square brackets we're saying ID underscore origin. 324 00:23:20,700 --> 00:23:27,920 underscore h that's the host that initiated that dns request that string contains and you know i 325 00:23:27,920 --> 00:23:35,060 masked this but there is a there is a large subnet that wasn't relevant to this and i won't get into 326 00:23:35,060 --> 00:23:40,400 that for opposite reasons of course but the point is you know you might segment that through you 327 00:23:40,400 --> 00:23:46,360 might go through and convert the ips to integers you might you know you can do ranges you can do a 328 00:23:46,360 --> 00:23:49,120 lot of different stuff with that and i think that's actually covered in the data-driven 329 00:23:49,120 --> 00:23:59,440 security book among other places and then i did the type um filtered just to make sure you know 330 00:23:59,440 --> 00:24:04,820 after i talked to brian from kitware so i'm kind of leaving myself some breadcrumbs and going 331 00:24:04,820 --> 00:24:09,880 through i pulled all the comments out of this just to make it easier to have less on the screen 332 00:24:10,740 --> 00:24:16,200 so this is just a nuance but filter dns df dot is copy equals false 333 00:24:17,800 --> 00:24:19,100 um it's trying to make it easier to have less on the screen 334 00:24:19,100 --> 00:24:23,060 it's trying to be helpful if you don't do that and say hey you keep slicing these things off and 335 00:24:23,060 --> 00:24:27,580 you're trying to do things on a copy so i had to google that and it turns out if you just 336 00:24:27,580 --> 00:24:33,580 do equals false then it stops throwing those errors it sounds pretty scientific right 337 00:24:35,640 --> 00:24:46,480 it worked filter dns df uh query length so here what i'm doing this is the the current version 338 00:24:46,480 --> 00:24:49,080 of the data frame or the tabular data frame and i'm going to go ahead and do that and i'm going to 339 00:24:49,100 --> 00:24:54,820 go over the data structure that we're dealing with and then i say query length in quotes 340 00:24:56,460 --> 00:25:05,240 equals and then i'm saying add a new column and what i want in that column for each row 341 00:25:05,240 --> 00:25:12,940 is the data frame and then give me the length of what's in the query so again when you start 342 00:25:12,940 --> 00:25:17,080 talking about malicious urls when you start talking about message length and that kind of 343 00:25:17,080 --> 00:25:19,080 stuff this might seem a little bit too much but it's not and so i'm going to go ahead and do that 344 00:25:19,100 --> 00:25:25,640 like one of the go-to things however I took a bunch of the other stuff off 345 00:25:25,640 --> 00:25:29,140 because originally you know when I'm trying to do this in a production 346 00:25:29,140 --> 00:25:34,400 environment I want to know for that IP address for that time period or maybe 347 00:25:34,400 --> 00:25:40,720 expanded it to longer like 24 hours does that IP address and what does that look 348 00:25:40,720 --> 00:25:45,560 like in terms of the con dot log a lot of you I'm sure familiar with con dot 349 00:25:45,560 --> 00:25:51,280 log but if you're not I think of con dot log and bro as the closest I'm gonna 350 00:25:51,280 --> 00:25:56,120 get to a hundred percent net flow right so basically just the phone record 351 00:25:56,120 --> 00:26:02,520 instead of the phone conversation so I'm trying to take an entity based view of 352 00:26:02,520 --> 00:26:11,000 this a user 360 and a device 360 and essentially understand what behaviors 353 00:26:12,040 --> 00:26:15,080 are being exhibited by that host during that time 354 00:26:15,080 --> 00:26:15,360 frame 355 00:26:15,560 --> 00:26:20,020 so just real quick aside how many people have heard of Black Hills information 356 00:26:20,020 --> 00:26:27,320 security is Rita anybody using Rita I think I've got a link in there I'll make 357 00:26:27,320 --> 00:26:30,100 sure it is before I send it out but I've been using that for a while basically 358 00:26:30,100 --> 00:26:35,920 you pipe in the bro logs to it you import a bro log for a day and you're 359 00:26:35,920 --> 00:26:41,320 a directory full of bro logs for 124 hour period I should be more precise and 360 00:26:41,840 --> 00:26:44,700 from there you import it it creates a MongoDB collection 361 00:26:44,700 --> 00:26:51,560 and then you run analyze and it's going to tell you beaconing in John strand 362 00:26:51,560 --> 00:26:56,940 couple guys did a talk at Derby Khan a couple places they're using some kind of 363 00:26:56,940 --> 00:27:00,740 crazy math behind the scenes like fast for you transform and looking at the 364 00:27:00,740 --> 00:27:05,560 signals and what you get I just use the command line but they've got a AI Hunter 365 00:27:05,560 --> 00:27:12,700 product what you get is basically a table or a CSV and when I cut it out on 366 00:27:12,700 --> 00:27:16,140 On the command line, what I see is a score on the left. 367 00:27:16,360 --> 00:27:18,960 Yeah, we're 99% sure this thing's beaconing. 368 00:27:19,140 --> 00:27:20,900 Well, there's other stuff that looks like beaconing, right? 369 00:27:21,020 --> 00:27:24,100 So I don't ever want to have one view into something. 370 00:27:24,320 --> 00:27:30,620 I want to have a more holistic approach and enrich these things by either computing new features, 371 00:27:31,120 --> 00:27:35,220 add a column, perform an operation on a different column, 372 00:27:35,300 --> 00:27:39,700 and now I know something else about that entity in that record. 373 00:27:43,740 --> 00:27:50,860 So the next one, 22, in 22, I'm just, you have to put percent matplotlib inline 374 00:27:50,860 --> 00:27:54,840 so that you can have the plot actually display in a minute here. 375 00:27:56,120 --> 00:28:01,340 And the rest of this is just, in 22, just the formatting for how I want that plot to look. 376 00:28:01,480 --> 00:28:05,720 There's a lot of cleaner and more sophisticated looking things. 377 00:28:05,780 --> 00:28:07,420 I just wanted to have the basics out there. 378 00:28:07,720 --> 00:28:12,140 And then in 23, we're just saying import math, and we're going to look at entropy. 379 00:28:12,700 --> 00:28:20,320 So entropy, you might have something along the lines of base 64, base 32 encoded, 380 00:28:20,340 --> 00:28:22,360 or you might have some encryption. 381 00:28:23,680 --> 00:28:26,780 So either way, I find that to be pretty helpful. 382 00:28:28,180 --> 00:28:31,920 Filter DNS, again, we're creating a new column entropy. 383 00:28:32,180 --> 00:28:34,140 We're running lambda. 384 00:28:34,340 --> 00:28:39,820 So in the data frame, you don't have to do four loops, shouldn't do four loops. 385 00:28:40,400 --> 00:28:42,620 You want to, you know, 386 00:28:42,700 --> 00:28:47,160 map or apply or use a lambda function, and you're hitting it on that series, 387 00:28:47,260 --> 00:28:49,100 which is that column, right? 388 00:28:49,620 --> 00:28:56,500 So essentially, very quickly, I'm populating the value of this new column entropy 389 00:28:57,080 --> 00:29:00,680 with the results of that mathematical function. 390 00:29:00,840 --> 00:29:04,640 And now I know two more things about each of these rows. 391 00:29:04,900 --> 00:29:08,940 I know the message length, and I know the entropy. 392 00:29:12,700 --> 00:29:15,400 When I look at the length, after I filtered out that other, 393 00:29:16,140 --> 00:29:18,980 those segments I didn't need were at 14,000. 394 00:29:21,100 --> 00:29:24,300 In 27, do you remember I was talking about that canary URL? 395 00:29:24,700 --> 00:29:26,500 It's not actually called canary URL. 396 00:29:27,000 --> 00:29:30,860 I did a sophisticated find and replace, and I masked it. 397 00:29:31,600 --> 00:29:32,880 That's also scientific. 398 00:29:33,360 --> 00:29:37,800 So I'm trying to understand length of all of that inside the parentheses, 399 00:29:39,520 --> 00:29:41,760 which means, just to zoom back out for a minute, 400 00:29:41,760 --> 00:29:48,120 that my friends on the red team internally have 121 records 401 00:29:48,120 --> 00:29:56,520 or DNS message requests or messages that were logged during 8 to 9 a.m. 402 00:29:56,580 --> 00:29:59,360 Well, look at that, 121 out of 14,000. 403 00:29:59,380 --> 00:30:02,000 That's what I'm talking about in terms of class imbalance. 404 00:30:03,840 --> 00:30:07,500 So MITRE ATT&CK, here's one of the ways this fits in. 405 00:30:11,760 --> 00:30:14,500 I can help do the detection engineering. 406 00:30:14,680 --> 00:30:16,120 I can help look for those artifacts. 407 00:30:16,460 --> 00:30:18,120 Every contact leaves a trace. 408 00:30:18,320 --> 00:30:19,280 I can help. 409 00:30:20,400 --> 00:30:23,120 That will help me dig in and start dissecting things. 410 00:30:23,400 --> 00:30:25,680 And I have one goal in mind. 411 00:30:25,740 --> 00:30:26,940 I'm trying to protect this house. 412 00:30:27,080 --> 00:30:30,520 I'm trying to find how they did the X fill 413 00:30:30,520 --> 00:30:34,840 and then see if there's any similarities that I can come up with. 414 00:30:34,940 --> 00:30:36,520 And if that works out mathematically, 415 00:30:37,080 --> 00:30:41,440 then maybe I can run that against everything else from May 18th 416 00:30:41,440 --> 00:30:44,680 until yesterday and see what I find. 417 00:30:44,860 --> 00:30:48,100 So, you know, the point is I keyed in on that canary URL, 418 00:30:48,300 --> 00:30:51,580 and now I can isolate the traces that they left 419 00:30:51,580 --> 00:30:54,940 based on that overt white box attack. 420 00:30:55,960 --> 00:30:59,480 And from there, this is a little bit early. 421 00:30:59,560 --> 00:31:01,960 You know, I don't really need to add this column just yet, 422 00:31:02,000 --> 00:31:04,260 but that's where it was, and I didn't want to mess around with it. 423 00:31:04,500 --> 00:31:05,040 Excuse me. 424 00:31:05,900 --> 00:31:09,680 So essentially what I'm doing is filter DNSDF. 425 00:31:09,740 --> 00:31:11,140 I'm creating a new column called, 426 00:31:11,440 --> 00:31:11,940 is malicious. 427 00:31:12,380 --> 00:31:13,940 This is my label. 428 00:31:14,060 --> 00:31:16,300 I'm going to have essentially it's, 429 00:31:16,780 --> 00:31:18,620 if it contains this canary URL, 430 00:31:20,800 --> 00:31:23,220 is malicious is going to have a value of one. 431 00:31:23,440 --> 00:31:24,780 Notice I did a dot map. 432 00:31:25,000 --> 00:31:26,060 It's going to hit everything. 433 00:31:27,380 --> 00:31:29,320 The other interesting thing that I saw, 434 00:31:29,540 --> 00:31:33,520 has anybody ever seen bro logs with DNS, 435 00:31:34,120 --> 00:31:35,200 with DNS X fill, 436 00:31:35,840 --> 00:31:39,400 where once in a while you'll see an API dot encrypted string, 437 00:31:39,980 --> 00:31:41,160 200 characters long, 438 00:31:41,440 --> 00:31:43,100 and then a post dot. 439 00:31:43,300 --> 00:31:46,440 Anybody have any ideas what that is or yeah. 440 00:31:48,600 --> 00:31:49,120 Yes, sir. 441 00:31:50,880 --> 00:31:52,860 No, I was hoping you'd tell me, man. 442 00:31:53,140 --> 00:31:53,500 No. 443 00:31:53,580 --> 00:31:56,680 So basically, again, this is a pattern. 444 00:31:56,740 --> 00:31:57,960 So I don't know this. 445 00:31:58,300 --> 00:32:00,460 That's kind of a Hail Mary when I throw that out there. 446 00:32:01,420 --> 00:32:02,940 Normally I'm going to look at the, 447 00:32:03,300 --> 00:32:05,940 make sure that these variables aren't related. 448 00:32:06,600 --> 00:32:09,920 I'm going to make sure that I look at the feature importance. 449 00:32:10,240 --> 00:32:11,240 We're not going to get into, 450 00:32:11,240 --> 00:32:12,560 we're not going to get into that right now because of time. 451 00:32:16,100 --> 00:32:17,460 Someone hurry up just a little bit. 452 00:32:18,860 --> 00:32:20,460 If it has post in it. 453 00:32:20,600 --> 00:32:22,620 Now I'm looking for a string, right? 454 00:32:22,760 --> 00:32:25,200 So this is the thing about the, 455 00:32:25,200 --> 00:32:26,800 the spy versus spy. 456 00:32:27,200 --> 00:32:30,500 Anybody in here in the room that sees how I'm doing this, 457 00:32:30,640 --> 00:32:32,860 you're going to come up with a different way around it. 458 00:32:32,980 --> 00:32:39,320 It's so that's why I have to keep doing this and making sure that the model doesn't degrade. 459 00:32:39,360 --> 00:32:41,100 And I don't get lazy in the detection. 460 00:32:41,240 --> 00:32:42,860 Here are, 461 00:32:43,000 --> 00:32:44,300 we talked about query length. 462 00:32:44,920 --> 00:32:49,380 So I just said for the data frame filter D and SDF. 463 00:32:49,880 --> 00:32:55,420 And then I want to know about the column that has the values that we computed, 464 00:32:55,520 --> 00:32:56,580 which is the query length. 465 00:32:57,140 --> 00:33:00,960 So we computed a feature populated the column for each row. 466 00:33:01,980 --> 00:33:03,400 And now we have a histogram. 467 00:33:04,300 --> 00:33:06,260 So it might be kind of hard to see in the back. 468 00:33:06,300 --> 00:33:07,220 I didn't blow this up. 469 00:33:07,420 --> 00:33:10,100 There's some different things you can do on the scale here. 470 00:33:10,180 --> 00:33:10,860 And that, 471 00:33:11,240 --> 00:33:14,100 that visualization didn't look much better, 472 00:33:14,160 --> 00:33:16,560 but you see a preponderance. 473 00:33:16,600 --> 00:33:17,760 Try to work that one, 474 00:33:17,760 --> 00:33:19,660 that word in on a Sunday morning, 475 00:33:19,740 --> 00:33:25,080 every possible chance you see a high number over, 476 00:33:25,240 --> 00:33:25,660 you know, 477 00:33:26,320 --> 00:33:27,280 14,000, 478 00:33:27,280 --> 00:33:32,340 it looks like of DNS requests that are what 25, 479 00:33:32,500 --> 00:33:32,920 30. 480 00:33:33,640 --> 00:33:35,660 And then way over there on the right, 481 00:33:35,740 --> 00:33:37,160 you see just a few, 482 00:33:37,300 --> 00:33:38,360 just a few, 483 00:33:38,460 --> 00:33:41,060 I'm guessing like not 120, 484 00:33:41,060 --> 00:33:41,340 21, 485 00:33:41,580 --> 00:33:44,360 maybe like 106 or something that are 200. 486 00:33:45,960 --> 00:33:47,260 Can you write a signature? 487 00:33:47,580 --> 00:33:48,780 Can you write a rule that says, 488 00:33:48,880 --> 00:33:48,980 Hey, 489 00:33:49,000 --> 00:33:56,020 anything that's got a message length and DNS over 40 is malicious and flag it. 490 00:33:56,060 --> 00:33:57,300 What's going to happen when you do that? 491 00:33:58,040 --> 00:33:58,520 Yeah, 492 00:33:58,680 --> 00:33:59,320 it's going to light up, 493 00:33:59,380 --> 00:33:59,520 right? 494 00:33:59,580 --> 00:33:59,980 Cause there's, 495 00:33:59,980 --> 00:34:03,160 there's stuff that looks like that. 496 00:34:03,240 --> 00:34:05,300 Now we computed two things though. 497 00:34:06,140 --> 00:34:08,140 We figured out the entropy entropy. 498 00:34:09,460 --> 00:34:10,080 You know, 499 00:34:10,080 --> 00:34:12,920 what's the degree of randomness and in a moment I'll, 500 00:34:12,920 --> 00:34:15,540 I'll show what the ranges are for the values, 501 00:34:17,120 --> 00:34:18,760 but in the upper right hand corner, 502 00:34:19,420 --> 00:34:20,100 that's weird, 503 00:34:20,200 --> 00:34:20,380 right? 504 00:34:20,440 --> 00:34:21,280 So we've got, 505 00:34:21,340 --> 00:34:24,780 when we look at entropy against query length, 506 00:34:25,980 --> 00:34:27,680 something's definitely unique about those. 507 00:34:31,560 --> 00:34:34,980 So I'm going to bust through a lot of this short on time. 508 00:34:35,060 --> 00:34:35,460 Thank you. 509 00:34:35,520 --> 00:34:36,120 I'll get it. 510 00:34:37,320 --> 00:34:39,040 Anybody has any questions about this again? 511 00:34:39,040 --> 00:34:42,480 I'll have the slides up by Tuesday at Brian Gans on Twitter. 512 00:34:42,680 --> 00:34:43,840 I'll put out the link there. 513 00:34:44,320 --> 00:34:45,760 I'm going to push through the rest of this. 514 00:34:45,820 --> 00:34:46,640 So I said, 515 00:34:46,660 --> 00:34:49,700 here are the columns that I want for features. 516 00:34:50,320 --> 00:34:52,220 So now I made a new data frame. 517 00:34:52,420 --> 00:34:53,040 I said, 518 00:34:53,100 --> 00:34:55,080 I may have a new tabular data structure here, 519 00:34:55,180 --> 00:34:58,580 but only give me the data that's in these columns series. 520 00:34:59,400 --> 00:35:00,940 And that's my new features. 521 00:35:01,380 --> 00:35:02,060 Underscore DF. 522 00:35:03,780 --> 00:35:05,300 We imported some other things. 523 00:35:05,360 --> 00:35:05,640 And again, 524 00:35:05,760 --> 00:35:06,900 the scikit learn, 525 00:35:07,060 --> 00:35:08,960 we had a software bridge from, 526 00:35:08,960 --> 00:35:09,120 bro, 527 00:35:09,320 --> 00:35:13,000 the pandas to scikit learn and bro analysis tools. 528 00:35:13,900 --> 00:35:18,420 And bro analysis tools is doing a lot of this transformation for us. 529 00:35:21,980 --> 00:35:22,540 Again, 530 00:35:22,720 --> 00:35:25,020 without us doing adversary simulation, 531 00:35:25,360 --> 00:35:29,960 I'm stuck with clustering because I don't have any ground truth labels, 532 00:35:30,220 --> 00:35:30,400 right? 533 00:35:31,720 --> 00:35:33,320 So where's the evil? 534 00:35:33,460 --> 00:35:34,280 Where's Waldo? 535 00:35:35,340 --> 00:35:36,280 Where's my buddies, 536 00:35:36,320 --> 00:35:36,880 Zach and Matt, 537 00:35:37,000 --> 00:35:37,760 anybody have any idea? 538 00:35:37,760 --> 00:35:39,000 Which one's malicious? 539 00:35:40,980 --> 00:35:42,520 You shouldn't be able to tell. 540 00:35:46,580 --> 00:35:47,540 I mean, 541 00:35:47,560 --> 00:35:48,380 you might have some ideas, 542 00:35:48,540 --> 00:35:54,800 but this is one issue that I run into with just clustering stuff. 543 00:35:56,460 --> 00:35:58,080 So with MITRE ATT&CK, 544 00:35:58,320 --> 00:35:59,360 I've got a column. 545 00:35:59,420 --> 00:36:00,100 It's got one. 546 00:36:00,140 --> 00:36:01,300 If it's no malicious, 547 00:36:01,540 --> 00:36:02,600 cause my buddy just did it. 548 00:36:02,820 --> 00:36:03,960 And there's a zero. 549 00:36:04,020 --> 00:36:05,100 If I don't know, 550 00:36:05,160 --> 00:36:05,420 right? 551 00:36:05,580 --> 00:36:06,980 I don't know that it's. 552 00:36:07,020 --> 00:36:07,340 So, 553 00:36:07,400 --> 00:36:07,740 you know, 554 00:36:09,080 --> 00:36:15,100 what I'm doing here is creating another data frame. 555 00:36:15,280 --> 00:36:18,120 And I'm going to push past that. 556 00:36:19,000 --> 00:36:19,560 Essentially, 557 00:36:20,920 --> 00:36:24,200 I'm going to split that into train and test sets, 558 00:36:25,440 --> 00:36:27,080 train the classifier model, 559 00:36:27,260 --> 00:36:28,120 make predictions. 560 00:36:28,680 --> 00:36:30,360 I'm using logistic regression, 561 00:36:30,680 --> 00:36:34,380 not maybe the kind you might think about from stats. 562 00:36:34,820 --> 00:36:36,020 And then I'm saying, 563 00:36:36,100 --> 00:36:36,260 Hey, 564 00:36:36,260 --> 00:36:36,840 predict, 565 00:36:37,260 --> 00:36:37,820 you know, 566 00:36:37,840 --> 00:36:43,120 how well is this model going to do once we get to the results? 567 00:36:43,400 --> 00:36:45,240 And in this case, 568 00:36:45,240 --> 00:36:48,760 it was 99.85% accurate. 569 00:36:48,840 --> 00:36:51,620 When we look at the model evaluation or model results. 570 00:36:51,900 --> 00:36:53,360 But that's not the whole story. 571 00:36:56,400 --> 00:36:56,960 Overall, 572 00:36:58,080 --> 00:37:01,120 it had in the 2775, 573 00:37:02,600 --> 00:37:03,360 you know, 574 00:37:03,360 --> 00:37:05,540 we're okay with the top left and the bottom right. 575 00:37:06,280 --> 00:37:07,820 The four on the bottom left. 576 00:37:08,100 --> 00:37:13,780 That means there were four malicious ones that I told the model that those 577 00:37:13,780 --> 00:37:14,220 are malicious. 578 00:37:15,140 --> 00:37:16,060 And we, 579 00:37:16,100 --> 00:37:17,560 we missed those. 580 00:37:17,680 --> 00:37:18,440 So again, 581 00:37:18,540 --> 00:37:22,360 it has to do with your threshold and how it works. 582 00:37:22,360 --> 00:37:22,640 So again, 583 00:37:22,700 --> 00:37:24,740 that's the model we looked at. 584 00:37:25,480 --> 00:37:27,740 We need newsflash, 585 00:37:27,760 --> 00:37:27,960 right? 586 00:37:28,080 --> 00:37:28,920 More signal, 587 00:37:29,040 --> 00:37:29,880 less noise. 588 00:37:30,580 --> 00:37:31,720 And this is, 589 00:37:31,720 --> 00:37:31,940 you know, 590 00:37:31,940 --> 00:37:33,340 this is just something that I've come across. 591 00:37:33,460 --> 00:37:35,840 If anybody has any other perspectives on it, 592 00:37:35,840 --> 00:37:36,680 come see me afterwards. 593 00:37:36,800 --> 00:37:38,060 I'd be interested to hear your perspective. 594 00:37:38,140 --> 00:37:41,700 But I just think that the more stealthy attackers are, 595 00:37:43,180 --> 00:37:44,360 the fewer footprints, 596 00:37:44,960 --> 00:37:46,460 the fewer contacts are going to leave, 597 00:37:46,520 --> 00:37:48,780 which makes it harder for me to hook into something. 598 00:37:49,780 --> 00:37:50,500 Future work, 599 00:37:50,540 --> 00:37:51,340 I'll just push through that. 600 00:37:51,520 --> 00:37:52,700 But like I said, 601 00:37:52,720 --> 00:37:53,600 looking at other bro logs, 602 00:37:53,900 --> 00:37:57,580 I want to generate some features based on the presence or absence of 603 00:37:57,580 --> 00:37:57,960 beaconing. 604 00:37:58,160 --> 00:38:01,560 So take the insight that I'm getting out of Rita from Black Hills 605 00:38:01,560 --> 00:38:02,340 Information Security, 606 00:38:02,360 --> 00:38:03,560 your offensive countermeasures now, 607 00:38:03,680 --> 00:38:05,820 and enrich that and then do some other things. 608 00:38:06,200 --> 00:38:08,240 Some other enriching IP addresses. 609 00:38:08,700 --> 00:38:13,340 Also very excited to look at some Neo4j and some graph history 610 00:38:13,340 --> 00:38:14,120 stuff as well. 611 00:38:15,220 --> 00:38:17,520 So thank you very much for coming out on a Sunday morning. 612 00:38:17,680 --> 00:38:18,280 I appreciate your time. 613 00:38:18,420 --> 00:38:20,400 I'll be in the back and I hope you have a great rest of the 614 00:38:20,400 --> 00:38:20,640 conference.