1 00:00:00,000 --> 00:00:01,000 Welcome to DEF CON. 2 00:00:04,420 --> 00:00:06,220 Let's do something crazy. 3 00:00:07,600 --> 00:00:08,720 Okay, that's the name of the talk. 4 00:00:09,040 --> 00:00:10,860 I was feeling really ballsy the first time I wrote it, 5 00:00:10,900 --> 00:00:11,560 and then I backed off. 6 00:00:13,320 --> 00:00:13,960 Here's our agenda. 7 00:00:14,120 --> 00:00:14,820 Here's what we're going to do. 8 00:00:14,860 --> 00:00:15,780 We're going to start very simple. 9 00:00:15,920 --> 00:00:16,980 We're going to cover some basics. 10 00:00:17,360 --> 00:00:19,700 So if you're really advanced and it's too easy, sit tight, 11 00:00:19,860 --> 00:00:23,520 because we're going to get some cool stuff on the third bullet. 12 00:00:26,480 --> 00:00:28,240 By the way, I don't read the slides to you, 13 00:00:28,240 --> 00:00:30,960 so I kind of assume everybody reads as well as I talk. 14 00:00:32,100 --> 00:00:34,840 So this is the story of a project that I did, 15 00:00:35,320 --> 00:00:36,720 because I was really interested in it. 16 00:00:36,780 --> 00:00:38,240 I spent about two and a half years on it. 17 00:00:40,740 --> 00:00:42,660 I got really interested in DNS tunnels, 18 00:00:42,840 --> 00:00:46,300 and what fascinated me about them is that you can look at a DNS tunnel 19 00:00:46,300 --> 00:00:47,800 and immediately pick it out. 20 00:00:47,980 --> 00:00:49,440 If you know that there's one there, 21 00:00:49,540 --> 00:00:51,760 you can immediately pick it out of DNS traffic. 22 00:00:52,440 --> 00:00:53,620 There's no mystery to it, 23 00:00:53,720 --> 00:00:56,380 and yet they work amazingly well everywhere 24 00:00:56,380 --> 00:00:57,620 because no one can find them. 25 00:00:58,780 --> 00:01:01,080 So what I wanted to do was automate that, 26 00:01:01,100 --> 00:01:02,840 that ability to just look at traffic 27 00:01:02,840 --> 00:01:04,460 and pick out a DNS tunnel. 28 00:01:06,580 --> 00:01:09,820 As I said, this is the story of that project. 29 00:01:10,040 --> 00:01:12,960 So this talks about a lot more than that, hopefully. 30 00:01:13,660 --> 00:01:15,340 So first of all, when I'm talking about AI, 31 00:01:15,620 --> 00:01:17,580 I'm not talking about anything fantastic. 32 00:01:18,060 --> 00:01:19,640 I'm talking about real AI, 33 00:01:19,860 --> 00:01:21,360 like what you see in video games, 34 00:01:21,520 --> 00:01:24,160 what you see in spam filters. 35 00:01:24,400 --> 00:01:27,500 Spam filters are an amazing application of AI. 36 00:01:27,620 --> 00:01:28,220 They work tremendously. 37 00:01:28,240 --> 00:01:29,040 They work tremendously well. 38 00:01:30,460 --> 00:01:32,880 And that's the kind of AI I'm talking about. 39 00:01:33,000 --> 00:01:36,380 I'm talking about getting a machine to make a sophisticated decision. 40 00:01:38,680 --> 00:01:42,600 So the decision in particular that we're going to try to make 41 00:01:42,600 --> 00:01:44,880 to pick out a DNS tunnel is classification. 42 00:01:46,840 --> 00:01:50,780 So to get our minds on how this AI works, 43 00:01:51,140 --> 00:01:55,480 we're actually going to talk about how your brain works a little bit. 44 00:01:55,640 --> 00:01:57,780 We're not going to talk about the internals, 45 00:01:58,240 --> 00:01:58,380 we're going to talk about the AI. 46 00:01:58,720 --> 00:01:59,660 Because that stuff's boring, 47 00:01:59,760 --> 00:02:01,720 and you don't need to know it to write AI applications. 48 00:02:04,100 --> 00:02:05,780 Okay, so if you see this picture, 49 00:02:05,860 --> 00:02:07,240 and I said, which is the apple, 50 00:02:07,300 --> 00:02:07,960 which is the orange, 51 00:02:07,980 --> 00:02:08,600 and which is the banana, 52 00:02:09,140 --> 00:02:12,320 most normal people would look at the red globe there 53 00:02:12,320 --> 00:02:13,980 and assign apple to that. 54 00:02:14,920 --> 00:02:16,580 Most people would look at the orange globe 55 00:02:16,580 --> 00:02:17,820 and assign an orange to that. 56 00:02:17,880 --> 00:02:19,860 They'd look at the yellow and assign a banana to that. 57 00:02:20,020 --> 00:02:21,340 So what did your brain do there? 58 00:02:22,940 --> 00:02:24,160 Here's kind of how your brain works. 59 00:02:25,260 --> 00:02:26,760 You looked at... 60 00:02:28,240 --> 00:02:35,440 I'm sorry. Let me start over. You thought about the real objects, like an apple, and you said, 61 00:02:35,560 --> 00:02:40,560 well, an apple's red, and it's delicious, and it's sweet, and it's crunchy, and it's round, 62 00:02:40,740 --> 00:02:45,700 okay? And then you thought, uh, three of those don't even matter, so you threw those three away, 63 00:02:45,860 --> 00:02:50,240 right? For that classification decision, we don't care what the apple tastes like, we don't care 64 00:02:50,240 --> 00:02:54,540 that it's crunchy, so you discarded those, and you took two traits, you took color and shape, 65 00:02:54,540 --> 00:02:58,540 and you assigned a weight to those, right? You said one of those is much more important than the 66 00:02:58,540 --> 00:03:03,900 other. So even if you didn't realize it, that's how your brain works. You took an abstract concept, 67 00:03:04,160 --> 00:03:07,820 right? And you pulled the weights and traits out of it. 68 00:03:10,800 --> 00:03:13,020 So we're going to talk about traits and weights a lot. 69 00:03:14,740 --> 00:03:20,240 So that was a really easy example, right? You only had a couple traits. Color, right? But here's 70 00:03:20,240 --> 00:03:24,400 actually one trait, we're still talking about color, but it's much more complex. 71 00:03:24,540 --> 00:03:30,040 Because what if we ask you to just tell me, um, when does green end, and when does blue start? 72 00:03:30,380 --> 00:03:34,640 Now that's a lot harder, right? Because everyone has a different opinion on that. 73 00:03:36,120 --> 00:03:40,440 So that's where thresholding comes in. So thresholds would be 74 00:03:41,900 --> 00:03:45,960 your personal threshold of when it turned, when it, when green becomes blue, right? 75 00:03:47,560 --> 00:03:51,920 So the whole point of this slide is really so I could, like, get a naked dude up on the screen 76 00:03:51,920 --> 00:03:54,460 at DEF CON, but it worked. 77 00:03:57,160 --> 00:04:02,700 So here's a really complicated class, classification decision, all right? When, which one is modern 78 00:04:02,700 --> 00:04:07,340 man? Well, people just debate this all the time, and we still can't decide, because there's, 79 00:04:07,340 --> 00:04:12,300 you know, hundreds or thousands of traits, right? And everyone assigns weights to those traits 80 00:04:12,300 --> 00:04:17,480 differently, and we still can't figure it out. Okay, so let's talk about neural nets for a 81 00:04:17,480 --> 00:04:22,700 minute. So there's a few key terms, and if you grasp these key terms, then you're good to go. 82 00:04:23,300 --> 00:04:24,420 Okay, nonlinear statistics. 83 00:04:24,540 --> 00:04:28,920 Statistical data modeling. Okay, so for our purposes in this room, nonlinear statistical, 84 00:04:29,160 --> 00:04:35,160 just think math, okay? Numbers. Data modeling. Okay, we're going to take something from real 85 00:04:35,160 --> 00:04:39,260 life, and we're going to model it. Pretty simple, right? So we're going to model something in math. 86 00:04:40,440 --> 00:04:43,900 Adaptive. So this is key. This is, this is really the point of the whole IDS project, 87 00:04:44,020 --> 00:04:48,940 is that it should learn. It has this ability to learn. It makes a mistake, 88 00:04:49,200 --> 00:04:53,900 you can tell it that was a mistake, it should go back and not make the same mistake again, okay? 89 00:04:55,340 --> 00:05:00,320 It can be used to model concept relationships between inputs and outputs. So it's got inputs, 90 00:05:00,640 --> 00:05:05,180 it's got to give outputs. Our inputs are going to be DNS packets. Our outputs will be, hey, 91 00:05:05,240 --> 00:05:15,300 I think this might be a DNS channel. So don't be scared of AI, because for whatever reason, 92 00:05:15,340 --> 00:05:18,320 if you're going to do firewalls, you go to the bookstore and you pick up a book on firewalls, 93 00:05:18,340 --> 00:05:22,360 and it's how to use firewalls. But if you want to use AI and you go to the bookstore and you pick 94 00:05:22,360 --> 00:05:24,520 up a book on AI, it's how to write your own AI. So if you're going to do firewalls, you go to the 95 00:05:24,540 --> 00:05:30,660 which is not useful for anyone, right? We're not going to do that. We're going to go use someone 96 00:05:30,660 --> 00:05:36,020 else's AI code. We're not going to do everything from scratch. So I used FAN, which is Fast 97 00:05:36,020 --> 00:05:42,880 Artificial Neural Network. It's fairly popular. It's C. So at that point, all the AI stuff's 98 00:05:42,880 --> 00:05:48,620 pretty much done, right? What I'm going to do at that point on is, is I'm going to pick my inputs, 99 00:05:48,840 --> 00:05:52,820 which are the traits. Remember we talked about traits? We're going to give them some values, 100 00:05:53,420 --> 00:05:54,220 right? Weights. 101 00:05:54,540 --> 00:05:59,940 Some traits are worth more than others. Then we're going to adapt our decisions until they give us 102 00:05:59,940 --> 00:06:03,720 the output that we want, right? So basically what that means is we're going to tell this neural 103 00:06:03,720 --> 00:06:12,080 network, learn to do what I want. And supervised learning is actually the AI term for what we're 104 00:06:12,080 --> 00:06:16,560 doing there. That means that we're going to give the neural network some answers so that it can 105 00:06:16,560 --> 00:06:22,900 crunch its numbers and know when it's right. That's how it's going to learn. So again, we're not going 106 00:06:22,900 --> 00:06:24,380 to go into the nuts and bolts of our 107 00:06:24,540 --> 00:06:31,900 artificial neural networks. That's boring. I hated it. So. And again, you don't need to know how they 108 00:06:31,900 --> 00:06:37,480 work. Go get someone else's artificial neural network package. The reason why the slides are so repetitive 109 00:06:37,480 --> 00:06:42,100 and verbose is because I tried to write slides that you could come back to later and learn the whole 110 00:06:42,100 --> 00:06:48,340 thing over again if you forget. So we're clicking along on the agenda. That's neural network basics. 111 00:06:48,620 --> 00:06:54,300 That's all you really need to know to write a neural network application. Okay. What's a DNS 112 00:06:54,300 --> 00:07:01,940 tunnel? So DNS is the domain name system. Its primary purpose is to assign IP addresses or to relate IP 113 00:07:01,940 --> 00:07:08,540 addresses to domain names. Okay. And DNS tunnels are such a problem because they're a covert 114 00:07:08,540 --> 00:07:14,100 channel that works anywhere. And even though this project is really about DNS tunnels, I'm hoping that 115 00:07:14,100 --> 00:07:22,080 audience members will see that there's a little bit more here than that. So let's walk through a real basic 116 00:07:22,720 --> 00:07:23,360 DNS tunnel. 117 00:07:23,480 --> 00:07:24,280 I don't know if anybody's... 118 00:07:24,300 --> 00:07:28,200 can see this from where you're at. But in the lower left-hand corner, we've got 119 00:07:28,200 --> 00:07:32,020 a host, and he makes a request. Who is 120 00:07:32,020 --> 00:07:36,240 data.badguy.com? And that request goes to his DNS 121 00:07:36,240 --> 00:07:40,120 server, and the DNS server says, I don't know who data.badguy.com is. 122 00:07:40,400 --> 00:07:44,200 Let me ask a root server. So that same request then gets passed to the root 123 00:07:44,200 --> 00:07:48,120 server. Root server says, I don't know either. Let me go 124 00:07:48,120 --> 00:07:51,920 ask badguy.com. Who's authoritative for that? So he goes to the actual 125 00:07:51,920 --> 00:07:55,480 authoritative badguy.com server. He sends a packet 126 00:07:55,480 --> 00:07:59,780 data.badguy.com. Badguy.com takes data 127 00:07:59,780 --> 00:08:03,920 off, right? That was the actual request. And then he can either 128 00:08:03,920 --> 00:08:07,860 just eat it if it's data exfiltration, or he can respond back with an 129 00:08:07,860 --> 00:08:11,040 IP address or a CNAME record or whatever for command and control tunnels. 130 00:08:11,520 --> 00:08:14,720 But as far as exfiltration goes, that's the gist of it. 131 00:08:15,820 --> 00:08:18,900 Everybody clear on that? Because we just explained that really fast. And if you've never 132 00:08:18,900 --> 00:08:21,000 heard it before, I want to make sure you get it. 133 00:08:23,680 --> 00:08:27,860 Okay. So key points are this. It basically gives you a high level 134 00:08:27,860 --> 00:08:31,360 way out of a network, right? We're just requesting things in an application 135 00:08:31,360 --> 00:08:35,500 layer, and they're magically delivered across the globe. We don't have to 136 00:08:35,500 --> 00:08:38,700 worry about routing. We don't really have to worry about firewalls. We don't have to worry about ports, 137 00:08:38,920 --> 00:08:43,340 IP addressing, none of it. It's all application layer, and it just magically 138 00:08:43,340 --> 00:08:49,200 happens. And then, of course, DNS requests that are not 139 00:08:49,200 --> 00:08:51,460 cached get routed. That seems pretty obvious. 140 00:08:53,380 --> 00:08:57,920 So this is just another verbose explanation of how to turn 141 00:08:57,920 --> 00:09:02,040 DNS requests into a tunnel. I'm not going to repeat it, unless you 142 00:09:02,040 --> 00:09:07,980 want me to. Okay. So now that we know 143 00:09:07,980 --> 00:09:11,520 what a tunnel is, here's a little bit of a takeaway. Like I said, there's a little bit more to this talk than 144 00:09:11,520 --> 00:09:16,060 just catching DNS tunnels. So IDS and IPS are signature-based 145 00:09:16,060 --> 00:09:19,780 almost everywhere, right? And I'm not saying that's 146 00:09:19,780 --> 00:09:21,360 broken, because we use it and it works. 147 00:09:21,920 --> 00:09:29,340 But it's not enough. And it hasn't been enough for a long time, and the returns it's giving are less and less every year, right? 148 00:09:30,140 --> 00:09:35,620 So almost everybody I know who does a lot of IDS or IPS work ends up looking at egress traffic. 149 00:09:36,080 --> 00:09:39,380 They spend a lot of time looking at egress traffic. What's leaving your network, right? 150 00:09:39,580 --> 00:09:40,800 Where are the tools to do that? 151 00:09:44,820 --> 00:09:46,960 I'll take your silence to me, and you can't find them either. 152 00:09:48,820 --> 00:09:51,760 Okay. So we spend a lot of time looking 153 00:09:51,760 --> 00:09:51,900 for DNS. We spend a lot of time looking for DNS. 154 00:09:51,920 --> 00:09:53,540 We spend a lot of time looking for egress command and control tunnels. 155 00:09:53,760 --> 00:09:56,280 We spend a lot of time looking for data exfiltration, right? 156 00:09:56,720 --> 00:10:01,000 And the reason for that is if someone gets into a network, they have to have a way to get out. 157 00:10:01,240 --> 00:10:04,840 Okay? So all we want to do for this specific project 158 00:10:04,840 --> 00:10:07,460 is block off one pathway out. 159 00:10:15,060 --> 00:10:17,840 Okay. So we've covered neural network basics. 160 00:10:18,040 --> 00:10:21,220 We've covered DNS tunnel basics. Let's do some fun stuff. 161 00:10:23,400 --> 00:10:26,320 So why use an artificial neural network to look for tunnels? 162 00:10:26,580 --> 00:10:28,560 I mean, what's the point, right? Why use AI? 163 00:10:30,440 --> 00:10:33,420 So I wanted to get away from packet counting, which is how most things work. 164 00:10:33,940 --> 00:10:36,900 Packet counting has very limited returns. It does work a little bit, 165 00:10:37,460 --> 00:10:41,120 but it doesn't give us really what we want. It doesn't give me what I wanted. 166 00:10:42,700 --> 00:10:45,780 I wanted to turn away from packets into traits, weights, and thresholds. 167 00:10:46,700 --> 00:10:50,260 And guess what? If you're using a neural network, all I have to worry about are traits. 168 00:10:50,260 --> 00:10:55,800 The neural network will self-adjust the weights. It will self-adjust thresholds during the learning phase. 169 00:10:56,180 --> 00:10:59,820 So all we have to do is come up with good traits, feed it to a neural network, 170 00:11:00,520 --> 00:11:04,380 give it an answer sheet so that it can learn what it's doing, right? Correctly. 171 00:11:04,560 --> 00:11:05,880 And it should do the rest itself. 172 00:11:08,520 --> 00:11:09,780 That's the adaptive abilities. 173 00:11:14,400 --> 00:11:18,940 So again, this is just to drive home the way it should work, right? 174 00:11:19,020 --> 00:11:19,540 Which is, 175 00:11:19,540 --> 00:11:25,720 let's say that we're feeding our neural network a bunch of DNS traffic, and it's not catching a DNS tunnel, okay? 176 00:11:25,880 --> 00:11:30,580 Well, when we discover it later, we pull the traits out of it, 177 00:11:30,660 --> 00:11:33,680 we refeed that to the neural network, and we say, hey, you missed one. 178 00:11:33,900 --> 00:11:37,780 It should automatically learn how to catch it the next time. It should not get fooled again. 179 00:11:38,720 --> 00:11:40,360 And we'll demo that here at the end. 180 00:11:43,740 --> 00:11:49,180 And of course, it's also to get us out of signature writing. Let's leave that to vendors. It's a chore. 181 00:11:49,660 --> 00:11:51,940 So this slide used to be really snotty. 182 00:11:51,960 --> 00:11:58,360 I was really fired up, and I was tearing into some vendors, and then I realized that may not be a very smart thing to do, so. 183 00:11:59,440 --> 00:12:01,260 This slide's been neutered quite a bit. 184 00:12:02,100 --> 00:12:05,700 All the IDS and IPS out there aren't very good at finding DNS tunnels. 185 00:12:06,060 --> 00:12:09,880 It's just not the vendor's fault. It's just how they work. 186 00:12:10,200 --> 00:12:12,460 And I don't see a fix to that. 187 00:12:15,880 --> 00:12:18,860 And then this last bullet is just something I wanted to address in the talk. 188 00:12:19,100 --> 00:12:19,520 And then this last bullet is just something I wanted to address in the talk. 189 00:12:19,520 --> 00:12:23,880 And that is, if you do searches on the web for artificially intelligent intrusion detection, 190 00:12:24,620 --> 00:12:28,340 you'll find a lot of papers and lots of projects. 191 00:12:28,760 --> 00:12:32,720 Okay. Those are mostly graduate school projects. They're terrible. They don't work. 192 00:12:34,600 --> 00:12:38,200 You'll find a lot of academics talking about it. But they make two big mistakes. 193 00:12:38,600 --> 00:12:42,000 Number one, they're too focused on packet counting. 194 00:12:42,320 --> 00:12:45,060 So they're packet counting, and then they're passing that to a neural network. 195 00:12:45,320 --> 00:12:47,500 But we don't need a neural network to do packet counting, right? 196 00:12:47,560 --> 00:12:49,500 We can do that with a bash script or a prl script or something like that. 197 00:12:49,520 --> 00:12:50,060 or something, right? 198 00:12:50,940 --> 00:12:53,340 So why involve artificial intelligence in that? 199 00:12:53,460 --> 00:12:55,780 And secondly on that matter, who cares if you get scanned? 200 00:12:56,040 --> 00:12:56,540 Who cares? 201 00:12:56,900 --> 00:12:57,780 Everybody gets scanned. 202 00:13:00,220 --> 00:13:01,740 The other thing that's wrong with their scheme 203 00:13:01,740 --> 00:13:03,840 is that they keep trying to come up with 204 00:13:03,840 --> 00:13:05,880 artificial intelligence schemes to look at 205 00:13:05,880 --> 00:13:09,540 the output of signature-based IDS. 206 00:13:09,980 --> 00:13:12,740 Well, again, if the signature-based IDS 207 00:13:12,740 --> 00:13:14,440 isn't catching what we're looking for, 208 00:13:15,020 --> 00:13:17,220 coming up with a new way to look at the output 209 00:13:17,220 --> 00:13:20,240 of the IDS box isn't going to help, right? 210 00:13:22,660 --> 00:13:24,720 There are some good research. 211 00:13:25,160 --> 00:13:28,720 There's one in particular where they came up 212 00:13:28,720 --> 00:13:31,840 with a neural network scheme to catch NUSHU. 213 00:13:32,180 --> 00:13:33,300 It's a pretty well-known paper. 214 00:13:33,880 --> 00:13:35,840 One of the problems with that is they don't release 215 00:13:35,840 --> 00:13:37,000 the details of their scheme, 216 00:13:37,180 --> 00:13:39,100 and they don't release their software, okay? 217 00:13:39,520 --> 00:13:41,520 So my scheme may be flawed, 218 00:13:42,260 --> 00:13:43,520 but I brought it to DEF CON, 219 00:13:43,660 --> 00:13:44,740 and I released it with software. 220 00:13:47,840 --> 00:13:52,180 Okay, so step one in our DNS IDS project. 221 00:13:52,460 --> 00:13:54,460 You've got to frame the question correctly, okay? 222 00:13:54,720 --> 00:13:57,220 So don't start out trying to tackle a big problem. 223 00:13:57,360 --> 00:13:58,660 You solve a little problem. 224 00:13:58,880 --> 00:14:00,800 And the problem that we want to get is, 225 00:14:02,320 --> 00:14:05,300 is this DNS request part of a tunnel, okay? 226 00:14:05,500 --> 00:14:06,620 That's pretty much all we care about. 227 00:14:06,820 --> 00:14:09,020 So if we were to take this and apply it to other 228 00:14:12,420 --> 00:14:13,160 exfiltration methods, 229 00:14:13,580 --> 00:14:15,620 like let's say we wanted to look at HTTP traffic. 230 00:14:16,060 --> 00:14:17,060 Is this HTTP? 231 00:14:17,060 --> 00:14:17,200 Is this HTTP? 232 00:14:17,220 --> 00:14:19,540 Is this HTTP traffic being used to exfiltrate data? 233 00:14:19,840 --> 00:14:20,980 That one's a lot harder. 234 00:14:21,140 --> 00:14:22,300 We're going to have to break that down 235 00:14:22,300 --> 00:14:23,720 into lots of different decisions. 236 00:14:24,200 --> 00:14:26,080 So we're probably going to have multiple neural networks 237 00:14:26,520 --> 00:14:28,700 making multiple decisions about the destination 238 00:14:28,700 --> 00:14:30,740 and about the content and all that kind of stuff. 239 00:14:30,980 --> 00:14:31,720 That one's hard. 240 00:14:32,340 --> 00:14:34,560 I chose DNS because it's fairly cut and dry. 241 00:14:34,840 --> 00:14:36,540 There's not a whole lot we have to consider. 242 00:14:37,360 --> 00:14:39,200 So again, all we care about, 243 00:14:39,260 --> 00:14:40,980 all we're asking this neural network to decide is, 244 00:14:41,100 --> 00:14:42,440 is this part of a tunnel or not? 245 00:14:44,980 --> 00:14:46,040 So we're going to pull traits, 246 00:14:46,280 --> 00:14:47,060 because we already talked about 247 00:14:47,060 --> 00:14:47,220 what traits. 248 00:14:47,900 --> 00:14:50,100 These are pretty straightforward for the most part 249 00:14:50,100 --> 00:14:51,020 to begin with, right? 250 00:14:51,260 --> 00:14:53,500 We're going to pull every domain name 251 00:14:53,500 --> 00:14:54,800 that goes past this. 252 00:14:55,280 --> 00:14:57,260 We're going to count how many packets to that domain. 253 00:14:57,360 --> 00:14:59,200 I know I just ripped packet counting and now I'm doing it. 254 00:14:59,400 --> 00:15:00,020 Let it go. 255 00:15:01,040 --> 00:15:01,700 Let it go. 256 00:15:03,480 --> 00:15:05,380 We're going to count the average length of the packets. 257 00:15:05,580 --> 00:15:06,820 So we're still just packet counting. 258 00:15:06,940 --> 00:15:07,740 That's not terribly useful. 259 00:15:08,040 --> 00:15:10,560 Average number of distinct characters in the lowest level domain. 260 00:15:10,760 --> 00:15:13,680 So let me address the lowest level domain right now. 261 00:15:13,760 --> 00:15:15,460 I use this term a lot because I like it 262 00:15:15,460 --> 00:15:16,120 and I think it's descriptive. 263 00:15:16,400 --> 00:15:16,860 I have been, 264 00:15:16,860 --> 00:15:17,860 I've been corrected on it before. 265 00:15:18,200 --> 00:15:19,940 I'm still going to keep using it. 266 00:15:21,360 --> 00:15:25,140 What I mean by lowest level domain is the piece of the domain name 267 00:15:25,140 --> 00:15:27,040 that is the furthest to the left. 268 00:15:27,340 --> 00:15:29,700 The opposite of the top level domain. 269 00:15:30,220 --> 00:15:32,900 I like the term lowest level domain to describe that. 270 00:15:34,680 --> 00:15:36,520 And there's still something missing, right? 271 00:15:36,640 --> 00:15:37,060 I mean, we're still, 272 00:15:37,140 --> 00:15:39,660 we're not doing a whole lot better than packet counting. 273 00:15:39,900 --> 00:15:40,740 We don't have enough. 274 00:15:41,260 --> 00:15:42,480 We've got to do better than that. 275 00:15:44,180 --> 00:15:46,660 I would bring a packet counter to DEF CON anyway, right? 276 00:15:47,560 --> 00:15:50,000 And so I was told there'd be no math. 277 00:15:50,220 --> 00:15:51,420 This is where it starts to get bad. 278 00:15:53,360 --> 00:15:59,480 So my original plan was that words have a lower entropy than data. 279 00:15:59,800 --> 00:16:02,620 And I was going to figure out a scheme to measure this entropy. 280 00:16:03,020 --> 00:16:04,920 And then we were going to feed that to a neural network 281 00:16:04,920 --> 00:16:06,640 and let it make some decision based 282 00:16:06,640 --> 00:16:09,060 on this computer science equation of entropy. 283 00:16:09,300 --> 00:16:10,940 And I spent a long time on that. 284 00:16:11,280 --> 00:16:14,200 And the slide exists because I think there's some value there, 285 00:16:14,280 --> 00:16:15,280 but I couldn't get it to work. 286 00:16:16,980 --> 00:16:19,120 So that's pretty much there for historical reasons. 287 00:16:19,360 --> 00:16:21,060 It is not in the proof of concept. 288 00:16:22,340 --> 00:16:23,620 Okay, so this is a money slide. 289 00:16:28,880 --> 00:16:32,800 If we have two groups of DNS requests, like we do here, 290 00:16:32,880 --> 00:16:34,040 a top and a bottom, okay? 291 00:16:34,440 --> 00:16:37,120 And I told you one of those is being used 292 00:16:37,120 --> 00:16:38,620 to exfiltrate data from a network. 293 00:16:39,560 --> 00:16:41,060 Which would you think it is? 294 00:16:41,260 --> 00:16:44,100 I mean, you would intuitively think it's the bottom one, 295 00:16:44,260 --> 00:16:44,580 right? 296 00:16:44,700 --> 00:16:45,060 . 297 00:16:45,060 --> 00:16:45,260 . 298 00:16:45,280 --> 00:16:45,880 It's not the top one. 299 00:16:46,040 --> 00:16:46,400 Why? 300 00:16:47,340 --> 00:16:49,020 I mean, what is your brain doing there? 301 00:16:49,100 --> 00:16:51,160 And why can't we get a machine to make that same decision? 302 00:16:51,480 --> 00:16:52,880 It shouldn't be that hard, right? 303 00:16:53,740 --> 00:16:55,920 So I thought about this for a long, long time. 304 00:16:59,200 --> 00:17:00,540 And you'll see what I came up with. 305 00:17:02,180 --> 00:17:05,860 By the way, why would you think that the top one is legitimate 306 00:17:05,860 --> 00:17:07,040 and the bottom one is not? 307 00:17:08,500 --> 00:17:09,220 It's rhetorical. 308 00:17:09,240 --> 00:17:09,760 You don't have to answer. 309 00:17:10,620 --> 00:17:13,020 And furthermore, if I give you a fourth, 310 00:17:13,540 --> 00:17:15,080 if I give you a fourth domain, 311 00:17:15,280 --> 00:17:17,020 request in the top group, okay? 312 00:17:17,100 --> 00:17:20,960 And it is also www.meanypants.com. 313 00:17:21,980 --> 00:17:23,740 You're going to be even more sure 314 00:17:23,740 --> 00:17:26,320 that that's not a DNS tunnel, right? 315 00:17:26,460 --> 00:17:27,480 Why are you more sure? 316 00:17:28,120 --> 00:17:29,640 What happened in your brain? 317 00:17:29,780 --> 00:17:32,000 If I give you a fourth request on the bottom, 318 00:17:32,080 --> 00:17:35,220 that is some random string, .meanypants.com, 319 00:17:35,440 --> 00:17:38,520 you become more sure that those are not legitimate. 320 00:17:38,860 --> 00:17:39,380 Why? 321 00:17:39,760 --> 00:17:40,280 Why? 322 00:17:43,780 --> 00:17:45,020 So what I really wanted, 323 00:17:45,280 --> 00:17:48,920 was some way to compare LLDs in the same domain to each other. 324 00:17:49,040 --> 00:17:52,000 I want to see the difference between the LLDs, right? 325 00:17:53,220 --> 00:17:56,020 Here, the first two requests are exactly the same, 326 00:17:56,080 --> 00:17:59,140 and so that's probably not being used to smuggle data. 327 00:17:59,300 --> 00:18:00,220 I mean, it could, right? 328 00:18:00,500 --> 00:18:01,440 Probably not, though. 329 00:18:02,800 --> 00:18:03,700 The bottom ones? 330 00:18:03,900 --> 00:18:04,720 Hmm, different call. 331 00:18:04,940 --> 00:18:05,840 They're very different. 332 00:18:05,960 --> 00:18:07,360 They could be used for lots of things, right? 333 00:18:08,040 --> 00:18:10,000 So how much is the first request, 334 00:18:10,180 --> 00:18:12,380 like the second request, like the third request? 335 00:18:12,780 --> 00:18:13,900 That's what you're... 336 00:18:13,900 --> 00:18:15,140 I think that's what your brain, 337 00:18:15,280 --> 00:18:16,760 is doing when you immediately look at that, 338 00:18:16,880 --> 00:18:17,840 and make a decision there. 339 00:18:21,000 --> 00:18:23,980 And if data is moving via a DNS tunnel, 340 00:18:24,320 --> 00:18:26,400 you should see the LLDs change a great deal. 341 00:18:26,520 --> 00:18:27,940 There should be a great deal of change 342 00:18:28,640 --> 00:18:30,020 between requests that were crossed. 343 00:18:31,960 --> 00:18:34,560 So let's stop thinking of them as LLDs, right? 344 00:18:34,640 --> 00:18:35,820 Let's stop thinking of them as strings, 345 00:18:35,980 --> 00:18:38,340 and let's start thinking of them as geometric structures, okay? 346 00:18:38,720 --> 00:18:42,260 So here's a two-dimensional graph of dog and cat, right? 347 00:18:42,520 --> 00:18:43,840 You can see that they're different, 348 00:18:43,840 --> 00:18:47,320 and we can measure the difference between the two words, okay? 349 00:18:47,700 --> 00:18:48,660 Everybody with me now? 350 00:18:48,760 --> 00:18:51,380 We can measure how different they are. 351 00:18:51,480 --> 00:18:53,380 The problem with this is that we're measuring 352 00:18:53,380 --> 00:18:54,580 the difference between letters. 353 00:18:54,880 --> 00:18:57,300 This has no concept of a set. 354 00:18:57,400 --> 00:18:59,720 It has no concept of words, right? 355 00:18:59,820 --> 00:19:02,280 We're just simply measuring the difference between letters. 356 00:19:03,580 --> 00:19:04,700 So that wasn't good enough. 357 00:19:04,740 --> 00:19:05,660 I tried this, by the way. 358 00:19:05,720 --> 00:19:06,900 Everything I've talked about in here, 359 00:19:06,960 --> 00:19:08,180 I tried until I got it to work. 360 00:19:08,820 --> 00:19:09,540 That failed. 361 00:19:10,380 --> 00:19:11,800 So we need something more complex. 362 00:19:16,480 --> 00:19:17,860 So we're going to skip ahead a slide. 363 00:19:18,480 --> 00:19:19,520 So we end up with this. 364 00:19:20,040 --> 00:19:21,380 This is what we're going to use, right? 365 00:19:21,480 --> 00:19:24,360 So half the room just got nauseous, 366 00:19:24,360 --> 00:19:25,400 and the other half just got horny. 367 00:19:27,720 --> 00:19:30,480 And whichever half you're in, that says a lot about you. 368 00:19:32,620 --> 00:19:33,640 But don't be scared of that, 369 00:19:33,720 --> 00:19:36,520 because that's actually pretty straightforward once we get there. 370 00:19:37,040 --> 00:19:37,360 Okay. 371 00:19:39,380 --> 00:19:41,880 So LLDs can only have a limited number of characters anyway. 372 00:19:42,060 --> 00:19:43,540 So says the RFC, right? 373 00:19:43,840 --> 00:19:46,020 Everybody follows RFCs, or most people try. 374 00:19:46,520 --> 00:19:51,500 So that really breaks it down to about 36 possible values, right? 375 00:19:52,100 --> 00:19:55,540 A through Z, 0 through 9, null, 376 00:19:55,720 --> 00:19:57,660 and then a few oddball characters. 377 00:19:57,940 --> 00:19:59,780 I'm actually throwing all the oddball characters out, 378 00:19:59,840 --> 00:20:00,520 because I don't need them. 379 00:20:01,620 --> 00:20:04,240 And we're actually going to do some multi-ordinal vector math. 380 00:20:04,760 --> 00:20:05,280 Okay. 381 00:20:06,780 --> 00:20:08,780 So this is simply a slide to explain 382 00:20:09,340 --> 00:20:12,760 how we're breaking down the LLDs letters 383 00:20:12,760 --> 00:20:13,820 into numbers. 384 00:20:13,820 --> 00:20:14,440 Okay? 385 00:20:14,980 --> 00:20:15,980 Because we're taking characters, 386 00:20:17,320 --> 00:20:18,460 and we're going to do math on them. 387 00:20:18,580 --> 00:20:21,080 And I found it difficult to understand that 388 00:20:21,080 --> 00:20:23,640 if you don't understand how we're turning them into numbers. 389 00:20:25,580 --> 00:20:27,480 We're basically going to normalize all the characters 390 00:20:28,900 --> 00:20:30,180 into a numeric scheme, 391 00:20:30,960 --> 00:20:32,000 and then apply this. 392 00:20:32,280 --> 00:20:32,640 Okay? 393 00:20:32,740 --> 00:20:33,980 So I didn't make this up. 394 00:20:34,080 --> 00:20:34,840 I didn't come up with this. 395 00:20:35,040 --> 00:20:36,640 This is Euclidean geometry. 396 00:20:37,460 --> 00:20:43,560 And I stumbled across this reading a college professor's web page on statistics. 397 00:20:43,560 --> 00:20:43,800 Okay? 398 00:20:43,800 --> 00:20:46,700 And what he was doing is he was giving surveys 399 00:20:46,700 --> 00:20:49,880 and then measuring the difference in responses. 400 00:20:50,180 --> 00:20:50,480 Right? 401 00:20:50,520 --> 00:20:52,500 How different are these two groups of people, 402 00:20:52,540 --> 00:20:53,280 and how do they respond? 403 00:20:53,460 --> 00:20:55,600 I was like, ah, that might work for what I want to do, 404 00:20:55,640 --> 00:20:57,880 because I want to measure the distance between words. 405 00:20:58,000 --> 00:20:58,260 Right? 406 00:20:59,180 --> 00:21:06,960 So what we have here is actually a comprehension of set. 407 00:21:07,060 --> 00:21:10,760 We're actually measuring the distance between sets of words 408 00:21:10,760 --> 00:21:13,420 or sets of letters, not just characters. 409 00:21:13,420 --> 00:21:18,500 So we're going to turn each character into a number. 410 00:21:18,660 --> 00:21:19,120 Okay? 411 00:21:19,300 --> 00:21:23,860 We're going to subtract the position of one string from the other. 412 00:21:24,240 --> 00:21:25,320 We're going to square that. 413 00:21:25,820 --> 00:21:33,860 We're going to sum all those up for every character in the request. 414 00:21:34,140 --> 00:21:35,780 And then we're going to take the square root of that. 415 00:21:36,380 --> 00:21:37,380 And that was hideous. 416 00:21:37,500 --> 00:21:37,640 Right? 417 00:21:37,700 --> 00:21:38,440 Anybody understand that? 418 00:21:40,260 --> 00:21:42,040 If you meditate on that for a while, 419 00:21:42,040 --> 00:21:42,900 it will make perfect sense. 420 00:21:44,400 --> 00:21:46,980 This is the textual explanation of what I just said. 421 00:21:47,320 --> 00:21:50,120 Again, it's the summed squared subtraction 422 00:21:50,120 --> 00:21:52,480 of each letter's numeric value. 423 00:21:52,920 --> 00:21:54,860 So we're comparing strings. 424 00:21:56,340 --> 00:21:59,740 This allows us to measure the distance between LLDs. 425 00:22:00,900 --> 00:22:02,520 So in Euclidean geometry, 426 00:22:02,800 --> 00:22:06,880 another word for distance is similarity and dissimilarity. 427 00:22:07,240 --> 00:22:09,800 So we're actually measuring how similar 428 00:22:09,800 --> 00:22:12,020 different DNS regions are. 429 00:22:12,040 --> 00:22:15,840 So let's go back to our DNS request slide for a second. 430 00:22:17,320 --> 00:22:17,840 Okay. 431 00:22:18,140 --> 00:22:18,660 So, 432 00:22:20,260 --> 00:22:23,660 WWW and WWW2 are not the same, 433 00:22:23,780 --> 00:22:25,160 but they're not that different. 434 00:22:25,500 --> 00:22:26,020 Right? 435 00:22:26,820 --> 00:22:28,520 Compared to the bottom three, 436 00:22:28,620 --> 00:22:29,860 which are radically different. 437 00:22:30,620 --> 00:22:32,200 We need to be able to capture that. 438 00:22:36,900 --> 00:22:37,420 Okay. 439 00:22:39,360 --> 00:22:40,240 Power of cheese. 440 00:22:40,240 --> 00:22:40,860 Here we go. 441 00:22:41,740 --> 00:22:44,280 So now we're measuring the difference between two LLDs. 442 00:22:44,640 --> 00:22:45,700 How different are they? 443 00:22:45,800 --> 00:22:47,880 How different is LLD1 from LLD3? 444 00:22:48,040 --> 00:22:49,920 We're measuring the difference of these domains 445 00:22:49,920 --> 00:22:50,700 as they roll past. 446 00:22:52,100 --> 00:22:54,440 And hopefully some white bulbs are going off. 447 00:22:54,920 --> 00:22:56,220 So that's our list of traits. 448 00:22:56,540 --> 00:22:56,940 Right? 449 00:22:57,040 --> 00:22:58,320 We're doing some packet counting. 450 00:22:58,600 --> 00:23:01,580 And then we're coming up with this numeric representation 451 00:23:01,580 --> 00:23:04,500 of how different each of the domain requests are 452 00:23:04,500 --> 00:23:05,120 from each other. 453 00:23:06,220 --> 00:23:07,780 We're going to train the neural network 454 00:23:07,780 --> 00:23:10,220 to do what we want. 455 00:23:10,220 --> 00:23:11,120 Define what we want. 456 00:23:11,220 --> 00:23:12,760 We're going to give it positive and negative examples. 457 00:23:13,520 --> 00:23:15,180 Then we're going to run it on real data, 458 00:23:15,280 --> 00:23:15,820 see what it finds. 459 00:23:16,700 --> 00:23:18,720 The beauty of using a neural network 460 00:23:18,720 --> 00:23:20,000 is any time we have a false negative, 461 00:23:20,200 --> 00:23:21,940 which IDS always has false negatives, right? 462 00:23:22,480 --> 00:23:25,160 We can data mine our traits out, 463 00:23:25,320 --> 00:23:27,320 add it to our configuration file, 464 00:23:27,880 --> 00:23:29,600 let the artificial neural network know 465 00:23:29,600 --> 00:23:30,380 that it's a false, 466 00:23:30,500 --> 00:23:31,280 false false, 467 00:23:31,320 --> 00:23:32,240 false positive, 468 00:23:32,700 --> 00:23:33,240 and say, 469 00:23:33,300 --> 00:23:35,460 relearn this so that you don't give me 470 00:23:35,460 --> 00:23:36,460 that bad answer again. 471 00:23:38,460 --> 00:23:38,900 There's a, 472 00:23:39,340 --> 00:23:39,740 if, 473 00:23:40,220 --> 00:23:40,960 if you get real into AI, 474 00:23:41,220 --> 00:23:43,140 there's some concepts called overfitting and underfitting. 475 00:23:43,420 --> 00:23:45,160 And basically what those mean is you've over, 476 00:23:45,160 --> 00:23:46,740 you've over-trained the neural network 477 00:23:46,740 --> 00:23:48,420 until it can't make very clear decisions. 478 00:23:49,020 --> 00:23:49,400 Okay? 479 00:23:49,440 --> 00:23:51,820 And I reached that point during the testing several times. 480 00:23:53,980 --> 00:23:55,080 And so when you do that, 481 00:23:55,160 --> 00:23:56,540 you just have to eat some false positives. 482 00:23:56,720 --> 00:23:57,420 And that's just, 483 00:23:57,920 --> 00:23:59,780 until a better AI guy comes along, 484 00:23:59,900 --> 00:24:00,820 which there's lots of them out there, 485 00:24:01,900 --> 00:24:03,220 we're just going to eat false positives. 486 00:24:03,920 --> 00:24:04,300 Okay. 487 00:24:04,320 --> 00:24:05,040 So here's the tool. 488 00:24:05,640 --> 00:24:07,900 DNS Tunnel Trap 0.9. 489 00:24:07,940 --> 00:24:09,680 It is proof of concept only. 490 00:24:10,220 --> 00:24:13,280 So don't email me and tell me how it didn't save your enterprise or whatever. 491 00:24:14,380 --> 00:24:15,240 It's POC only. 492 00:24:15,540 --> 00:24:16,520 But it is real code. 493 00:24:16,680 --> 00:24:17,520 It exists on the web. 494 00:24:17,580 --> 00:24:18,680 Right now you can go download it. 495 00:24:19,240 --> 00:24:21,420 I'm not speaking at a conference about something theoretical 496 00:24:21,420 --> 00:24:22,580 that you can't get your hands on. 497 00:24:23,320 --> 00:24:24,960 It does not sniff off the wire. 498 00:24:25,100 --> 00:24:25,380 Right? 499 00:24:25,460 --> 00:24:26,520 It's not real time. 500 00:24:27,800 --> 00:24:29,040 That's because it's proof of concept. 501 00:24:29,180 --> 00:24:30,460 So you go out with your T-speed dump 502 00:24:30,460 --> 00:24:32,840 and you capture some big chunks of DNS traffic. 503 00:24:33,160 --> 00:24:36,100 And then you're going to run it on that. 504 00:24:36,700 --> 00:24:37,080 Incidentally, 505 00:24:37,220 --> 00:24:38,180 while I'm thinking about it, 506 00:24:38,220 --> 00:24:38,840 um, 507 00:24:39,480 --> 00:24:42,000 and we'll address this later when we talk about Heyoka, 508 00:24:42,140 --> 00:24:42,500 um, 509 00:24:43,400 --> 00:24:44,760 it is asymmetrical. 510 00:24:44,840 --> 00:24:47,880 I only care about your outgoing DNS requests. 511 00:24:48,220 --> 00:24:49,840 I don't pay any attention to responses. 512 00:24:50,180 --> 00:24:50,880 We don't need them. 513 00:24:50,980 --> 00:24:51,440 Right? 514 00:24:51,520 --> 00:24:54,560 All we're doing is measuring the difference in outgoing DNS requests 515 00:24:54,560 --> 00:24:55,800 along with some packet counting. 516 00:24:57,540 --> 00:24:59,120 It has three major functions. 517 00:24:59,300 --> 00:24:59,640 Uh, 518 00:24:59,800 --> 00:25:00,480 find tunnels. 519 00:25:00,760 --> 00:25:03,240 Basically here's a PCAP file I captured. 520 00:25:03,400 --> 00:25:05,000 Tell me if there's any tunnels in it. 521 00:25:05,340 --> 00:25:05,860 Uh, 522 00:25:05,980 --> 00:25:06,440 new data 523 00:25:06,440 --> 00:25:08,800 creates a new training file entry. 524 00:25:08,840 --> 00:25:11,320 Training file is what the neural network learns off of. 525 00:25:12,560 --> 00:25:13,320 And train, 526 00:25:13,420 --> 00:25:15,100 which is to train or retrain the neural network. 527 00:25:15,880 --> 00:25:17,720 I'm going to push the demo until the end. 528 00:25:17,780 --> 00:25:18,780 We have plenty of time. 529 00:25:19,880 --> 00:25:21,800 I'm excited and I'm talking too fast. 530 00:25:23,240 --> 00:25:23,620 Okay. 531 00:25:23,720 --> 00:25:24,460 So how's it work? 532 00:25:24,720 --> 00:25:25,100 Um, 533 00:25:25,120 --> 00:25:25,480 it works. 534 00:25:26,680 --> 00:25:27,460 I didn't crunch, 535 00:25:27,480 --> 00:25:28,420 I didn't crunch stats. 536 00:25:28,660 --> 00:25:30,780 That's like the first thing a lot of hardcore guys ask me. 537 00:25:30,900 --> 00:25:31,380 They're like, 538 00:25:31,500 --> 00:25:31,660 oh, 539 00:25:31,680 --> 00:25:32,380 what are the stats? 540 00:25:32,540 --> 00:25:33,440 Like how old does it work? 541 00:25:33,600 --> 00:25:33,760 I, 542 00:25:33,780 --> 00:25:34,140 I don't know. 543 00:25:34,320 --> 00:25:34,940 It works. 544 00:25:37,040 --> 00:25:37,400 Um, 545 00:25:37,440 --> 00:25:38,060 right off the bat, 546 00:25:38,180 --> 00:25:39,240 it catches iDyne, 547 00:25:39,440 --> 00:25:39,920 Ozyman, 548 00:25:40,120 --> 00:25:40,960 and T-Speedy DNS. 549 00:25:41,160 --> 00:25:42,200 Those are what we're going to demo today. 550 00:25:42,440 --> 00:25:43,360 It's going to catch all three of those. 551 00:25:43,820 --> 00:25:44,180 Um, 552 00:25:45,000 --> 00:25:45,360 easy. 553 00:25:45,560 --> 00:25:45,880 Those, 554 00:25:45,880 --> 00:25:46,300 those are easy. 555 00:25:46,480 --> 00:25:46,760 And, 556 00:25:46,820 --> 00:25:47,540 and we'll talk about why. 557 00:25:47,940 --> 00:25:48,300 Um, 558 00:25:48,380 --> 00:25:49,040 to test this, 559 00:25:49,140 --> 00:25:50,000 I wrote my own, 560 00:25:50,360 --> 00:25:50,720 um, 561 00:25:50,820 --> 00:25:52,160 DNS exfiltration. 562 00:25:52,600 --> 00:25:52,960 And, 563 00:25:53,700 --> 00:25:55,740 I tried to make it a little bit harder to catch. 564 00:25:55,880 --> 00:25:56,860 All it did was grab, 565 00:25:57,220 --> 00:25:57,580 um, 566 00:25:58,300 --> 00:25:59,420 eight bytes of data, 567 00:25:59,520 --> 00:26:00,100 encode them, 568 00:26:00,200 --> 00:26:02,060 and then ship them out in a DNS request. 569 00:26:02,360 --> 00:26:03,440 It was exfiltration only. 570 00:26:03,440 --> 00:26:04,320 Didn't care about response. 571 00:26:04,960 --> 00:26:09,260 And I was able to tune the neural network down until it caught that every time without a false positive. 572 00:26:10,040 --> 00:26:11,220 That's on a small network, 573 00:26:11,400 --> 00:26:11,760 by the way. 574 00:26:11,840 --> 00:26:12,120 Because remember, 575 00:26:12,280 --> 00:26:12,320 we're, 576 00:26:13,200 --> 00:26:14,460 scalability's an issue here. 577 00:26:15,640 --> 00:26:16,040 Again, 578 00:26:16,140 --> 00:26:17,380 it only works on TCP dump files. 579 00:26:17,780 --> 00:26:20,120 And it only works on up to X domains at a time. 580 00:26:20,280 --> 00:26:24,040 I don't have any experience in real time programming if you hadn't figured that out by now. 581 00:26:24,740 --> 00:26:26,700 So that's why it's not real time. 582 00:26:26,760 --> 00:26:27,940 It doesn't sniff off the line. 583 00:26:28,320 --> 00:26:30,140 And it only works on X domains at a time. 584 00:26:31,080 --> 00:26:32,780 And that's because the programmer sucks. 585 00:26:34,120 --> 00:26:34,520 Okay, 586 00:26:35,040 --> 00:26:35,220 so, 587 00:26:35,860 --> 00:26:39,840 so I just listed the three DNS tunnels that it catches without problem. 588 00:26:40,000 --> 00:26:40,740 What about Heyoka? 589 00:26:40,900 --> 00:26:42,060 So if you don't know what Heyoka is, 590 00:26:42,120 --> 00:26:45,820 Heyoka was a DNS tunnel tool released this year. 591 00:26:47,300 --> 00:26:48,360 I think it's ShmooCon. 592 00:26:48,520 --> 00:26:49,080 I'm not really sure. 593 00:26:49,760 --> 00:26:52,560 And the authors of Heyoka did not release the tool. 594 00:26:52,700 --> 00:26:53,760 So I can't stand up here and say, 595 00:26:53,800 --> 00:26:53,980 oh, 596 00:26:54,020 --> 00:26:55,400 we put them head to head and here's how they did. 597 00:26:55,680 --> 00:26:56,340 We don't know. 598 00:26:56,420 --> 00:26:57,040 We have to guess. 599 00:26:58,100 --> 00:26:58,500 Um, 600 00:26:58,660 --> 00:26:59,500 the real feature, 601 00:26:59,620 --> 00:27:02,760 the two real features of Heyoka was that they figured out how to, 602 00:27:02,760 --> 00:27:03,900 how to smuggle some data out, 603 00:27:04,380 --> 00:27:05,320 additional data out. 604 00:27:06,500 --> 00:27:08,520 I'm not sure that matters for what I'm doing. 605 00:27:09,240 --> 00:27:13,620 And they're spoofing source addresses to get more data out 606 00:27:13,620 --> 00:27:14,840 and make it harder to catch. 607 00:27:15,440 --> 00:27:16,160 but again, 608 00:27:16,820 --> 00:27:19,020 remember that I don't even care about source address. 609 00:27:19,220 --> 00:27:19,520 We're not, 610 00:27:19,580 --> 00:27:20,660 this tool doesn't look at that. 611 00:27:20,860 --> 00:27:22,220 I'm looking at actual data, 612 00:27:22,400 --> 00:27:22,620 right? 613 00:27:22,700 --> 00:27:24,020 And we're comparing the difference in data. 614 00:27:24,140 --> 00:27:25,840 You can spoof all the source addresses you want. 615 00:27:26,780 --> 00:27:29,700 So my guess is that we would still be able to catch it. 616 00:27:30,320 --> 00:27:30,960 That's a guess. 617 00:27:31,480 --> 00:27:32,340 And again, 618 00:27:32,460 --> 00:27:32,680 um, 619 00:27:32,800 --> 00:27:34,660 what we're doing is completely asymmetrical. 620 00:27:34,900 --> 00:27:35,360 Um, 621 00:27:35,440 --> 00:27:37,400 we don't care about the data coming back in. 622 00:27:42,440 --> 00:27:44,160 So it works as well as you can tune it. 623 00:27:44,280 --> 00:27:46,500 And that's just the way of neural networks, 624 00:27:46,640 --> 00:27:46,760 right? 625 00:27:47,160 --> 00:27:50,780 So a good example of a pretty well tuned neural network would be, 626 00:27:50,860 --> 00:27:51,540 um, 627 00:27:51,720 --> 00:27:52,140 Gmail, 628 00:27:52,320 --> 00:27:52,900 spam filter. 629 00:27:53,260 --> 00:27:53,960 Not bad. 630 00:27:54,640 --> 00:27:55,100 Um, 631 00:27:55,220 --> 00:27:57,620 this is nowhere near that sophistication. 632 00:27:58,200 --> 00:28:00,160 I want to make sure everybody understands that. 633 00:28:01,680 --> 00:28:02,040 Um, 634 00:28:02,200 --> 00:28:02,960 you're able to tune, 635 00:28:03,080 --> 00:28:03,280 uh, 636 00:28:03,640 --> 00:28:05,640 super low false positive on a small network, 637 00:28:06,160 --> 00:28:06,520 right? 638 00:28:08,120 --> 00:28:08,480 Um, 639 00:28:08,540 --> 00:28:10,080 overfitting results and false negatives. 640 00:28:10,260 --> 00:28:11,340 That's the way of it. 641 00:28:11,940 --> 00:28:12,300 Um, 642 00:28:13,640 --> 00:28:14,720 so you can tune it down. 643 00:28:15,100 --> 00:28:15,460 Uh, 644 00:28:15,560 --> 00:28:16,920 you just have to accept some false positives. 645 00:28:17,740 --> 00:28:18,100 Um, 646 00:28:18,280 --> 00:28:18,800 hopefully, 647 00:28:21,500 --> 00:28:23,200 hopefully you can tune it better than I did. 648 00:28:23,320 --> 00:28:25,080 Lots of AI guys are better than me. 649 00:28:26,260 --> 00:28:27,700 So it does have a few weaknesses. 650 00:28:27,800 --> 00:28:28,980 There are some ways to defeat it. 651 00:28:29,320 --> 00:28:29,680 Uh, 652 00:28:29,680 --> 00:28:30,940 number one is don't use the LLD. 653 00:28:30,940 --> 00:28:31,100 Right? 654 00:28:31,200 --> 00:28:32,220 Because that's all I'm looking at. 655 00:28:33,320 --> 00:28:34,440 That's actually kind of crappy, 656 00:28:34,560 --> 00:28:38,700 because you're actually attacking my programming ability more than the theory. 657 00:28:41,400 --> 00:28:41,960 so I, 658 00:28:42,000 --> 00:28:43,360 I don't really give you any points for that one. 659 00:28:45,340 --> 00:28:45,740 Uh, 660 00:28:45,900 --> 00:28:48,580 and the other one is you can make tons of requests to multiple domains. 661 00:28:48,820 --> 00:28:50,600 So you can go register thousands of domains, 662 00:28:50,840 --> 00:28:51,900 and send each one, 663 00:28:51,980 --> 00:28:52,880 one request, 664 00:28:53,100 --> 00:28:54,520 and you get a thousand packets out, 665 00:28:54,640 --> 00:28:59,780 and obviously there's no way for me to measure the difference in different packets to, 666 00:28:59,780 --> 00:29:00,740 to the same domain, 667 00:29:00,880 --> 00:29:01,900 because you never made, 668 00:29:01,920 --> 00:29:02,220 uh, 669 00:29:02,360 --> 00:29:04,960 a request more than once to its same domain. 670 00:29:06,660 --> 00:29:07,840 That's not much of a victory, 671 00:29:07,900 --> 00:29:08,060 though, 672 00:29:08,160 --> 00:29:10,740 because DNS tunnels are bandwidth limited, 673 00:29:10,860 --> 00:29:13,140 and you'd be splitting it up into something even slower, 674 00:29:13,300 --> 00:29:14,020 I think. 675 00:29:16,600 --> 00:29:20,140 So this used to be just a complete jerk slide, 676 00:29:20,220 --> 00:29:22,480 and I lost my nerve and changed that too. 677 00:29:23,640 --> 00:29:24,080 Um, 678 00:29:25,580 --> 00:29:28,600 so the slides and the source can be found at minipants.com. 679 00:29:29,200 --> 00:29:29,640 Uh, 680 00:29:29,780 --> 00:29:30,740 don't call me minipants. 681 00:29:32,920 --> 00:29:36,220 You don't need to email me to tell me things that are wrong with it. 682 00:29:36,660 --> 00:29:37,220 I mean, 683 00:29:37,220 --> 00:29:37,900 unless you fixed them. 684 00:29:41,020 --> 00:29:41,380 Um, 685 00:29:42,060 --> 00:29:44,240 so I have no idea what I'm going to do with this. 686 00:29:44,500 --> 00:29:44,860 Um, 687 00:29:45,020 --> 00:29:45,560 I, 688 00:29:46,220 --> 00:29:48,480 I have no illusions of, 689 00:29:48,500 --> 00:29:49,500 of grandeur with it. 690 00:29:49,640 --> 00:29:49,980 Um, 691 00:29:51,520 --> 00:29:52,560 I'm not interested in patents. 692 00:29:53,160 --> 00:29:54,420 Everything I've done is public domain. 693 00:29:54,940 --> 00:29:55,760 You can take it. 694 00:29:55,900 --> 00:29:56,920 You can mess around with it. 695 00:29:56,960 --> 00:29:58,280 You can experiment on your own network. 696 00:29:58,280 --> 00:29:58,820 Um, 697 00:29:59,780 --> 00:30:00,360 improve it, 698 00:30:00,420 --> 00:30:00,720 hopefully. 699 00:30:02,080 --> 00:30:02,640 And then, 700 00:30:02,680 --> 00:30:02,880 uh, 701 00:30:02,920 --> 00:30:03,540 these are a list of, 702 00:30:03,600 --> 00:30:04,360 of folks who, 703 00:30:04,420 --> 00:30:06,040 who gave me some help along the way. 704 00:30:06,360 --> 00:30:06,700 Uh, 705 00:30:06,720 --> 00:30:08,780 just because their names here doesn't mean they endorsed the project. 706 00:30:08,920 --> 00:30:09,700 It just means they were, 707 00:30:09,800 --> 00:30:09,960 uh, 708 00:30:09,960 --> 00:30:10,260 helpful. 709 00:30:11,700 --> 00:30:13,420 And it does need a complete code rewrite. 710 00:30:13,520 --> 00:30:14,800 Of all the projects I've ever released, 711 00:30:15,020 --> 00:30:15,180 it, 712 00:30:15,240 --> 00:30:17,060 it is ironic that the one I am, 713 00:30:17,140 --> 00:30:17,400 the, 714 00:30:17,420 --> 00:30:21,020 the one that has code I am most ashamed of is the one I'm presenting at DEF CON. 715 00:30:21,240 --> 00:30:21,600 But, 716 00:30:21,640 --> 00:30:24,300 I don't think I'm alone in that. 717 00:30:26,400 --> 00:30:27,380 And then the last slide, 718 00:30:27,380 --> 00:30:27,600 um, 719 00:30:27,880 --> 00:30:28,640 is really just, 720 00:30:28,820 --> 00:30:29,420 you can, 721 00:30:29,420 --> 00:30:30,560 you can pull the slides online. 722 00:30:30,820 --> 00:30:31,060 This is, 723 00:30:31,160 --> 00:30:31,620 if you, 724 00:30:31,620 --> 00:30:32,740 if you saw this talk and you're like, 725 00:30:32,820 --> 00:30:33,000 wow, 726 00:30:33,120 --> 00:30:36,600 AI is not that hard and it's not beyond me because it's not, 727 00:30:36,780 --> 00:30:38,980 you can go write AI applications right now. 728 00:30:39,400 --> 00:30:39,820 Um, 729 00:30:39,880 --> 00:30:41,140 these are some good places to start. 730 00:30:41,760 --> 00:30:42,180 Um, 731 00:30:42,240 --> 00:30:48,580 Neurosolutions in particular makes a GUI on a neural network that allows you to see things and move it around. 732 00:30:48,640 --> 00:30:52,020 You'll really get to understand the guts of how a neural network works. 733 00:30:55,440 --> 00:30:57,360 And that is available on a trial like this. 734 00:30:57,380 --> 00:30:57,820 Um, 735 00:30:58,260 --> 00:31:02,020 Fuzzy Thinking should be required reading by Bart Cosco. 736 00:31:02,820 --> 00:31:03,220 Um, 737 00:31:05,100 --> 00:31:06,280 WEC is pretty useful too. 738 00:31:06,340 --> 00:31:07,480 So let's do a demo real quick. 739 00:31:09,940 --> 00:31:11,440 Show you that the tool does what I, 740 00:31:11,440 --> 00:31:12,380 what I, 741 00:31:12,380 --> 00:31:13,180 what I tell you it does. 742 00:31:20,580 --> 00:31:22,180 So when I practice with no audience, 743 00:31:22,220 --> 00:31:24,020 that was 45 minutes talk. 744 00:31:24,380 --> 00:31:26,200 And we just did it in 30 minutes. 745 00:31:27,040 --> 00:31:28,320 It's probably not too good. 746 00:31:49,180 --> 00:31:49,620 Okay. 747 00:31:50,100 --> 00:31:51,920 Do you guys see this decently well? 748 00:31:52,920 --> 00:31:54,220 It's just a command line tool. 749 00:31:54,220 --> 00:31:55,020 Sorry, 750 00:31:55,240 --> 00:31:55,440 there's, 751 00:31:55,440 --> 00:31:56,460 there's no cool GUI. 752 00:31:58,220 --> 00:32:00,520 I don't really even know how to do a GUI. 753 00:32:00,620 --> 00:32:01,440 I've never done one. 754 00:32:01,820 --> 00:32:02,840 Nor do I intend to. 755 00:32:04,540 --> 00:32:04,980 Okay. 756 00:32:07,260 --> 00:32:07,700 So, 757 00:32:08,720 --> 00:32:10,160 this is our configuration file. 758 00:32:10,320 --> 00:32:13,020 The first line is the number of examples we're going to give the neural network. 759 00:32:13,180 --> 00:32:13,420 Right? 760 00:32:14,080 --> 00:32:15,720 We're going to delete these to start with. 761 00:32:18,960 --> 00:32:23,280 And we're going to train our neural network on that initial data set. 762 00:32:23,280 --> 00:32:24,180 So it's trained. 763 00:32:25,720 --> 00:32:26,640 Now I'm going to say, 764 00:32:26,760 --> 00:32:27,500 show me, 765 00:32:29,540 --> 00:32:35,040 show me if there's any DNS tunnels in this sample off of, 766 00:32:35,080 --> 00:32:37,660 off of a small private network of iodine, 767 00:32:37,720 --> 00:32:38,700 which is a DNS tunnel. 768 00:32:40,760 --> 00:32:42,280 Example3.com might be a tunnel. 769 00:32:42,360 --> 00:32:43,380 It is in fact iodine. 770 00:32:43,860 --> 00:32:44,300 Okay. 771 00:32:45,900 --> 00:32:47,300 So that's not very impressive. 772 00:32:47,380 --> 00:32:47,980 Now let's say, 773 00:32:48,040 --> 00:32:48,600 show me, 774 00:32:48,600 --> 00:32:49,400 um, 775 00:32:51,020 --> 00:32:54,560 if this sample of Ozyman has a DNS tunnel in it. 776 00:32:54,920 --> 00:32:55,260 Oh, 777 00:32:55,440 --> 00:32:56,020 oh geez, 778 00:32:56,200 --> 00:32:56,900 it didn't find it. 779 00:32:57,040 --> 00:32:57,680 That's okay. 780 00:32:59,040 --> 00:32:59,560 So, 781 00:32:59,640 --> 00:33:00,460 the next step, 782 00:33:02,240 --> 00:33:08,600 is we're going to data mine out the correct values that we want of this example of Ozyman. 783 00:33:12,400 --> 00:33:14,620 And we're going to put that in our training file. 784 00:33:17,840 --> 00:33:20,040 We're going to adjust the training file a little bit. 785 00:33:21,840 --> 00:33:24,720 And we're going to give it a one because that is in fact a positive positive. 786 00:33:27,520 --> 00:33:29,200 We're going to retrain the neural networks. 787 00:33:29,300 --> 00:33:30,060 Hang with me here guys. 788 00:33:30,100 --> 00:33:30,800 That is boring, 789 00:33:31,020 --> 00:33:31,740 but hang with me. 790 00:33:32,700 --> 00:33:34,000 We're going to retrain the neural network. 791 00:33:35,680 --> 00:33:36,460 And we're going to say, 792 00:33:36,560 --> 00:33:36,720 okay, 793 00:33:36,880 --> 00:33:38,300 so I just gave you the answers. 794 00:33:38,440 --> 00:33:41,040 Now I'm going to show you the exact same network traffic. 795 00:33:42,180 --> 00:33:44,500 Now can you find a DNS tunnel in it? 796 00:33:44,500 --> 00:33:45,760 And it finds it right away. 797 00:33:46,100 --> 00:33:46,460 Well, 798 00:33:46,500 --> 00:33:47,120 that's not very impressive, 799 00:33:47,200 --> 00:33:47,360 right? 800 00:33:47,380 --> 00:33:48,360 Because we just gave it the answers. 801 00:33:48,680 --> 00:33:51,880 What if I show you a second example of Ozyman? 802 00:33:51,980 --> 00:33:53,140 You should be able to find it, 803 00:33:53,180 --> 00:33:53,260 right? 804 00:33:53,400 --> 00:33:53,560 I mean, 805 00:33:53,580 --> 00:33:55,420 the numbers should match up fairly well. 806 00:33:55,560 --> 00:33:56,520 You should be able to catch it. 807 00:33:57,240 --> 00:33:58,260 And it still does. 808 00:33:58,560 --> 00:33:58,900 So, 809 00:33:58,920 --> 00:34:00,180 that's an Ozyman sample. 810 00:34:00,380 --> 00:34:01,140 It's never seen before. 811 00:34:01,480 --> 00:34:02,840 But you can see how it learned. 812 00:34:02,920 --> 00:34:03,460 It adjusted. 813 00:34:03,700 --> 00:34:05,620 And it can catch stuff it hasn't seen before. 814 00:34:06,360 --> 00:34:06,720 Okay? 815 00:34:08,200 --> 00:34:08,560 So, 816 00:34:08,640 --> 00:34:12,440 what about a DNS tunnel that's never seen before entirely, 817 00:34:12,780 --> 00:34:13,040 right? 818 00:34:13,160 --> 00:34:13,820 Because we're going to, 819 00:34:14,500 --> 00:34:16,460 two examples of what a DNS tunnel looks like. 820 00:34:16,700 --> 00:34:17,420 From this point, 821 00:34:17,480 --> 00:34:19,220 it should be able to infer some things. 822 00:34:21,160 --> 00:34:23,800 Can you catch DNS to TCP without seeing it? 823 00:34:24,540 --> 00:34:24,940 Yes, 824 00:34:25,040 --> 00:34:25,500 we can. 825 00:34:25,840 --> 00:34:26,240 Right? 826 00:34:26,380 --> 00:34:27,500 So we've never seen it before. 827 00:34:27,640 --> 00:34:28,240 But it doesn't matter. 828 00:34:28,640 --> 00:34:30,960 Because we've adjusted our weights and thresholds 829 00:34:30,960 --> 00:34:32,000 to the limit where 830 00:34:32,840 --> 00:34:34,900 even stuff we've never seen before is going to trip it. 831 00:34:36,180 --> 00:34:36,580 Okay? 832 00:34:36,840 --> 00:34:38,740 Let's talk about false negatives for just a minute. 833 00:34:41,380 --> 00:34:42,140 So I've got a, 834 00:34:42,140 --> 00:34:42,460 I've got a, 835 00:34:44,080 --> 00:34:44,960 I've got a file here. 836 00:34:45,180 --> 00:34:45,820 And we're going to, 837 00:34:45,820 --> 00:34:47,760 we're going to tell it to go look at this file 838 00:34:47,760 --> 00:34:49,520 and see if there's any DNS tunnels in it. 839 00:34:50,520 --> 00:34:51,500 It comes up with two. 840 00:34:51,540 --> 00:34:53,600 It comes up with comcast.net and verizon.net. 841 00:34:54,440 --> 00:34:56,080 So we've looked at those and we've determined 842 00:34:56,080 --> 00:34:58,240 those are in fact not DNS tunnels. 843 00:34:58,560 --> 00:34:59,560 So it made a mistake. 844 00:34:59,740 --> 00:34:59,980 Right? 845 00:35:00,060 --> 00:35:00,900 False positives. 846 00:35:06,100 --> 00:35:07,060 We're going to do the same thing. 847 00:35:07,140 --> 00:35:08,560 We're going to data mine out what we want. 848 00:35:14,140 --> 00:35:16,440 And we're going to stick it in our configuration file. 849 00:35:21,520 --> 00:35:23,260 And we're going to give it a negative one 850 00:35:23,260 --> 00:35:24,280 for a false positive. 851 00:35:25,300 --> 00:35:27,560 This is all documented in the project by the way. 852 00:35:29,760 --> 00:35:32,880 We're going to retrain the DNS, 853 00:35:32,940 --> 00:35:34,080 the neural network. 854 00:35:39,220 --> 00:35:40,000 Not good. 855 00:35:40,000 --> 00:35:42,100 Live demos. 856 00:35:44,120 --> 00:35:44,800 There we go. 857 00:35:44,920 --> 00:35:45,600 That's what I wanted. 858 00:35:45,880 --> 00:35:47,260 That was not my fault by the way. 859 00:35:47,940 --> 00:35:50,580 Fan has its own bit of weirdness. 860 00:35:51,220 --> 00:35:54,540 So let's start to find it on the false positive file. 861 00:35:55,580 --> 00:35:56,020 Bang. 862 00:35:56,040 --> 00:35:57,060 Our false positives are gone. 863 00:35:57,420 --> 00:35:58,300 So what did it do? 864 00:35:58,500 --> 00:36:00,180 It readjusted its traits, 865 00:36:00,300 --> 00:36:02,140 it readjusted its weights and thresholds 866 00:36:02,540 --> 00:36:05,680 until those two domains are no longer tripping them. 867 00:36:06,980 --> 00:36:07,420 Okay. 868 00:36:07,540 --> 00:36:09,260 So there's one more thing I want to address here 869 00:36:09,260 --> 00:36:09,780 before we go. 870 00:36:10,000 --> 00:36:11,940 So if you go play around with the tool, 871 00:36:13,620 --> 00:36:15,320 sampling becomes very important. 872 00:36:15,540 --> 00:36:15,800 Okay. 873 00:36:15,860 --> 00:36:16,880 And the reason for that 874 00:36:18,000 --> 00:36:19,520 is because each of these 875 00:36:19,520 --> 00:36:20,980 is taken from a sample 876 00:36:20,980 --> 00:36:23,180 that was approximately as long as my attention span. 877 00:36:23,420 --> 00:36:23,700 Right? 878 00:36:23,860 --> 00:36:24,940 I'm doing a TZB dump 879 00:36:24,940 --> 00:36:26,540 and when I get bored I do a control C. 880 00:36:26,680 --> 00:36:28,500 And that's the sample that this came from. 881 00:36:28,620 --> 00:36:28,860 Right? 882 00:36:29,140 --> 00:36:30,740 Your results may vary. 883 00:36:31,480 --> 00:36:35,300 You should be building your own training file 884 00:36:35,800 --> 00:36:37,240 when you mess around with the project 885 00:36:37,240 --> 00:36:38,780 based on your own network 886 00:36:38,780 --> 00:36:40,000 and what you're trying to accomplish. 887 00:36:40,280 --> 00:36:42,120 So it comes with a stock default one. 888 00:36:42,340 --> 00:36:43,800 Don't expect much from that 889 00:36:43,800 --> 00:36:44,840 because it's not the same. 890 00:36:48,940 --> 00:36:51,860 So we blazed through that way fast. 891 00:36:52,380 --> 00:36:53,300 Any questions? 892 00:36:53,840 --> 00:36:54,520 Go ahead. 893 00:36:56,100 --> 00:36:56,620 . 894 00:37:04,160 --> 00:37:05,800 So the distance equation, 895 00:37:06,000 --> 00:37:06,440 . 896 00:37:07,860 --> 00:37:09,080 The distance equation 897 00:37:09,080 --> 00:37:10,920 is the third number in these series. 898 00:37:13,380 --> 00:37:14,860 So you can see the tunnels 899 00:37:14,860 --> 00:37:16,740 often have a much higher distance. 900 00:37:17,060 --> 00:37:18,520 However, these false positives 901 00:37:18,520 --> 00:37:19,840 also had a very high distance. 902 00:37:21,280 --> 00:37:22,520 Did I answer your question? 903 00:37:24,060 --> 00:37:24,660 . 904 00:37:30,260 --> 00:37:30,860 Right. 905 00:37:32,120 --> 00:37:32,720 No. 906 00:37:32,840 --> 00:37:34,560 So what that is, 907 00:37:34,560 --> 00:37:37,580 is we give our neural network all these inputs. 908 00:37:37,920 --> 00:37:38,020 Right? 909 00:37:38,140 --> 00:37:40,280 And it gives us a single numeric output, 910 00:37:40,480 --> 00:37:43,000 which is a likelihood of how close it matches. 911 00:37:43,320 --> 00:37:43,800 Okay? 912 00:37:44,320 --> 00:37:47,120 So inside my C source code, 913 00:37:47,320 --> 00:37:49,600 there's a judgment call where I said, 914 00:37:49,660 --> 00:37:52,960 okay, anything greater than .4. 915 00:37:57,320 --> 00:37:59,800 Anything greater than .4 is probably a tunnel. 916 00:37:59,920 --> 00:38:00,660 So output that. 917 00:38:00,900 --> 00:38:01,420 Right? 918 00:38:01,460 --> 00:38:03,400 So this example of Ozyman, 919 00:38:03,400 --> 00:38:05,640 it gave a likelihood of .89. 920 00:38:06,580 --> 00:38:07,800 It's over the threshold. 921 00:38:08,040 --> 00:38:10,380 You may have to adjust that as needed. 922 00:38:12,080 --> 00:38:12,960 Any other questions? 923 00:38:15,040 --> 00:38:15,600 . 924 00:38:23,160 --> 00:38:25,880 Can somebody up here shout his question up to me? 925 00:38:25,940 --> 00:38:26,480 I can't hear him. 926 00:38:28,680 --> 00:38:29,240 . 927 00:38:39,940 --> 00:38:40,180 Okay. 928 00:38:41,120 --> 00:38:42,360 Now let me just... 929 00:38:47,080 --> 00:38:47,320 . 930 00:38:48,400 --> 00:38:48,640 . 931 00:38:48,640 --> 00:38:48,840 . 932 00:38:49,540 --> 00:38:49,780 . 933 00:38:50,500 --> 00:38:50,740 . 934 00:38:52,040 --> 00:38:52,280 . 935 00:38:52,280 --> 00:38:52,300 . 936 00:38:52,300 --> 00:38:52,320 . 937 00:38:52,320 --> 00:38:52,340 . 938 00:38:52,340 --> 00:38:52,360 . 939 00:38:52,360 --> 00:38:52,380 . 940 00:38:52,380 --> 00:38:52,400 . 941 00:38:52,400 --> 00:38:52,420 . 942 00:38:52,420 --> 00:38:52,460 . 943 00:38:52,460 --> 00:38:52,500 . 944 00:38:52,500 --> 00:38:52,960 . 945 00:38:52,960 --> 00:38:53,080 . 946 00:38:53,080 --> 00:38:53,120 . 947 00:38:59,240 --> 00:39:00,440 artificial neural network internals. 948 00:39:00,720 --> 00:39:02,280 Okay, I got you. 949 00:39:03,080 --> 00:39:05,660 So this is actually done with a straight stock 950 00:39:07,060 --> 00:39:09,560 default fan configuration file, right? 951 00:39:09,620 --> 00:39:10,980 Fan is the neural network that I'm using. 952 00:39:11,140 --> 00:39:12,580 I'm using straight defaults. 953 00:39:12,580 --> 00:39:14,820 And at one point I got in there and messed around with those 954 00:39:14,820 --> 00:39:17,160 and I discovered I really didn't make the situation better. 955 00:39:17,680 --> 00:39:19,380 That's why I went back to just the straight 956 00:39:19,380 --> 00:39:21,120 stock fan configuration file. 957 00:39:21,300 --> 00:39:22,800 And it seems to work. 958 00:39:25,360 --> 00:39:26,700 Is that what you're looking for? 959 00:39:30,760 --> 00:39:31,300 Go ahead. 960 00:39:38,740 --> 00:39:40,120 Yes, it does, absolutely. 961 00:39:40,980 --> 00:39:42,420 Because it's adjusting thresholds. 962 00:39:44,820 --> 00:39:45,240 That's right. 963 00:39:45,400 --> 00:39:47,320 So at one point I took a lot of network dumps 964 00:39:47,320 --> 00:39:48,700 off of a really busy internet server 965 00:39:49,360 --> 00:39:55,480 and I started intermixing the output of that 966 00:39:55,480 --> 00:39:57,280 in with stuff off small networks 967 00:39:57,280 --> 00:39:58,740 and I ended up with kind of a kludge. 968 00:39:59,240 --> 00:40:01,320 So I really don't like to say 969 00:40:01,320 --> 00:40:02,960 that a neural network is learning your network 970 00:40:02,960 --> 00:40:04,880 because that sounds, right? 971 00:40:05,860 --> 00:40:08,460 But you do end up with some strange results 972 00:40:08,460 --> 00:40:10,600 by intermixing those types of things. 973 00:40:13,060 --> 00:40:13,680 Go ahead. 974 00:40:25,620 --> 00:40:26,080 Oh. 975 00:40:29,380 --> 00:40:30,700 He asked if we could run through 976 00:40:30,700 --> 00:40:33,560 the Euclidean equation real quick. 977 00:40:36,220 --> 00:40:37,720 Oh, his question was, 978 00:40:37,800 --> 00:40:39,780 can we run through the Euclidean equation really quick? 979 00:40:41,620 --> 00:40:43,400 By far that is like the most, 980 00:40:43,440 --> 00:40:44,820 I never imagined someone would ask 981 00:40:44,820 --> 00:40:45,720 like that kind of question. 982 00:40:46,980 --> 00:40:48,740 I got my life so much better now. 983 00:40:48,820 --> 00:40:50,100 My faith in humanity is restored. 984 00:40:53,680 --> 00:40:55,360 So we glossed over that pretty fast. 985 00:40:55,640 --> 00:40:56,980 I don't have an example ready, 986 00:40:57,760 --> 00:40:59,060 but so we've turned, 987 00:40:59,240 --> 00:41:01,500 we've turned every character into a number, right? 988 00:41:02,220 --> 00:41:04,200 So Comcast, or actually it's going to be, 989 00:41:04,940 --> 00:41:08,340 let's say apple.comcast versus orange.comcast. 990 00:41:08,580 --> 00:41:09,760 And we want to know how different they are, right? 991 00:41:10,060 --> 00:41:13,240 So we're going to take the numeric A and the numeric O 992 00:41:13,240 --> 00:41:15,540 and we're going to subtract the O from the A. 993 00:41:15,780 --> 00:41:16,800 We're going to square that. 994 00:41:17,600 --> 00:41:20,020 And then we're going to go on down the line, right? 995 00:41:20,840 --> 00:41:22,900 Substituting nulls for length mismatches. 996 00:41:24,780 --> 00:41:25,580 We're going to square that. 997 00:41:25,640 --> 00:41:27,840 We're going to sum all those and take the square root of it. 998 00:41:28,660 --> 00:41:29,220 That's the Euclidean. 999 00:41:29,220 --> 00:41:30,800 That's the Euclidean equation for similarity. 1000 00:41:32,640 --> 00:41:35,920 That's, that's, that's probably the best I can do on the spot. 1001 00:41:40,920 --> 00:41:41,640 So, okay. 1002 00:41:41,720 --> 00:41:41,920 Yeah. 1003 00:41:41,980 --> 00:41:42,120 Okay. 1004 00:41:47,240 --> 00:41:47,600 Right. 1005 00:41:53,040 --> 00:41:55,080 So here, here's one of the reasons why it's not real time. 1006 00:41:55,200 --> 00:41:58,040 So you can only compare as many domains as you've saved, right? 1007 00:41:58,220 --> 00:41:59,200 So every time I say, 1008 00:41:59,220 --> 00:42:01,600 if I want to save a domain, if I want to do a comparison against it, I have to keep it. 1009 00:42:04,720 --> 00:42:08,260 So, in the proof of concept, I'm only comparing against the last one I saw. 1010 00:42:08,420 --> 00:42:12,240 I'm only keeping one and I'm comparing the one I have now to the last one I saw, right? 1011 00:42:13,100 --> 00:42:15,680 It would work better if we kept more. 1012 00:42:16,320 --> 00:42:21,280 But then we start to get into windowing issues and memory issues and I was not, 1013 00:42:21,440 --> 00:42:23,520 at the time, I was not as interested in that. 1014 00:42:24,420 --> 00:42:28,860 So, like if we're to make this a more fuller in your time, you know, 1015 00:42:28,860 --> 00:42:32,580 do you think about putting all your requests that you've seen into some sort of database, 1016 00:42:32,900 --> 00:42:40,060 like you could later do some sort of feature or something to reduce all the similarities for you 1017 00:42:40,060 --> 00:42:42,320 and then come up with a better score? 1018 00:42:46,680 --> 00:42:47,420 I don't know. 1019 00:42:47,980 --> 00:42:49,240 I haven't got that far. 1020 00:42:50,520 --> 00:42:51,780 Thanks for asking it. 1021 00:42:53,200 --> 00:42:54,260 Yeah, it's a good question. 1022 00:42:54,980 --> 00:42:58,700 I'm kind of hoping that, to me, this is, 1023 00:42:59,160 --> 00:43:02,660 I've convinced myself this is clearly a better way to do IDS than signatures. 1024 00:43:02,940 --> 00:43:06,300 And I'm kind of hoping that other people will ask these kinds of questions 1025 00:43:06,300 --> 00:43:10,100 and then maybe we'll code that in the next version and it'll improve. 1026 00:43:10,380 --> 00:43:10,640 Go ahead. 1027 00:43:11,400 --> 00:43:15,320 In your comparison, the way you're looking at, for example, 1028 00:43:15,340 --> 00:43:20,660 WWW versus WWW2, if, for example, I had bind and bind comparison, 1029 00:43:21,740 --> 00:43:24,860 it's not going to seem very similar because you're doing it letter by letter. 1030 00:43:25,000 --> 00:43:28,380 Is there any way you could perhaps get some sort of string within that? 1031 00:43:34,260 --> 00:43:35,780 You should code that. 1032 00:43:37,540 --> 00:43:38,840 Was that a volunteer? 1033 00:43:40,360 --> 00:43:40,960 Go ahead. 1034 00:43:44,640 --> 00:43:47,020 So unequal length, I just substituted in nulls. 1035 00:43:47,280 --> 00:43:49,480 And at first I was like, oh, this will never work. 1036 00:43:49,580 --> 00:43:52,740 But it actually seemed to work okay, so I went with it. 1037 00:43:54,980 --> 00:43:57,380 You're only comparing it to the data itself. 1038 00:43:57,900 --> 00:43:58,560 Is there any? 1039 00:44:04,840 --> 00:44:06,020 I don't think so. 1040 00:44:06,800 --> 00:44:10,260 We're comparing these two domains and I, you know, I worked on different schemes. 1041 00:44:10,660 --> 00:44:14,580 And I don't think there's a lot of value in comparing domains against each other. 1042 00:44:15,420 --> 00:44:18,460 It's mostly the same packets to the same domains. 1043 00:44:18,740 --> 00:44:19,760 That's what we want to look at. 1044 00:44:20,300 --> 00:44:21,780 I think that's what we want to look at. 1045 00:44:22,580 --> 00:44:23,180 Go ahead. 1046 00:44:25,160 --> 00:44:25,600 . 1047 00:44:35,940 --> 00:44:37,460 are you a math guy 1048 00:44:39,440 --> 00:44:47,920 it's awesome no it's awesome um um so the question was it was about why are we adding 1049 00:44:47,920 --> 00:44:54,000 why are we doing the um comparison letter by letter right um the best answer i can give you 1050 00:44:54,000 --> 00:45:00,440 is that this equation is supposed to take into account the entire set that's like the point of 1051 00:45:00,440 --> 00:45:06,900 the equation so even though we're doing a letter by letter uh subtraction the equation is supposed 1052 00:45:06,900 --> 00:45:14,020 to take into account the set if that's an insufficient answer i'm sorry um 1053 00:45:22,260 --> 00:45:23,840 no those will come out as 1054 00:45:23,840 --> 00:45:23,980 um 1055 00:45:24,000 --> 00:45:29,100 different so we're just going to stick a null value at the end of apple right so those are 1056 00:45:29,100 --> 00:45:34,060 going to come out um so so those are actually going to be the same until it gets to the last 1057 00:45:34,060 --> 00:45:38,940 character and then it'll be different but the difference will be a small amount compared to 1058 00:45:38,940 --> 00:45:45,760 apple and orange there will be a smaller amount of difference let me answer that 1059 00:46:00,500 --> 00:46:06,020 agreed agreed um i didn't think of it go ahead 1060 00:46:14,420 --> 00:46:20,240 no i didn't take case into account these are a lot of good questions good job 1061 00:46:21,500 --> 00:46:23,820 oh i'm done they're kicking me thanks 1062 00:46:23,820 --> 00:46:23,980 you 1063 00:46:24,000 --> 00:46:24,560 guys