1 00:00:00,000 --> 00:00:00,640 All right. 2 00:00:00,640 --> 00:00:02,960 Good afternoon, everyone. 3 00:00:03,040 --> 00:00:08,800 And it is 1.30 Pacific time in beautiful Las Vegas, Nevada. 4 00:00:09,320 --> 00:00:12,120 Thank you so much for joining us today. 5 00:00:12,160 --> 00:00:18,720 And this next talk is sponsored by the Packet Hacking Village. 6 00:00:18,780 --> 00:00:23,300 And it is my absolute pleasure to introduce to you Josh Piore. 7 00:00:23,900 --> 00:00:25,920 Thank you. 8 00:00:27,360 --> 00:00:28,120 All right. 9 00:00:28,120 --> 00:00:28,920 So that's me. 10 00:00:28,920 --> 00:00:31,860 I work with Cisco Talos. 11 00:00:31,860 --> 00:00:39,420 Previously I worked with Zscaler, Umbrella, OpenDNS, NASA, and Mandiant and some other places and nonprofits and whatnot. 12 00:00:39,420 --> 00:00:44,740 So I do security research and I make music and do a bunch of other stuff. 13 00:00:45,560 --> 00:00:51,620 So before I get into all the details, I'm going to talk about what I want to focus on when I'm doing this kind of thing. 14 00:00:52,700 --> 00:00:54,600 I'm going to talk about the infection chain real quick. 15 00:00:54,980 --> 00:00:57,240 And it's probably very familiar to you. 16 00:00:57,240 --> 00:01:00,240 So hopefully I'm not going to bore everyone, but I'll just continue on. 17 00:01:00,380 --> 00:01:04,840 So looking at attribution, when you're looking for something, I spent most of my time as a threat hunter. 18 00:01:04,840 --> 00:01:08,680 When you're looking for something, you're following one thing that you see. 19 00:01:08,680 --> 00:01:12,420 So maybe I found a domain or a URL . 20 00:01:12,420 --> 00:01:15,920 In this case, I found this one at urlhouse.abuse.ch. 21 00:01:16,200 --> 00:01:20,840 And then I can see as part of Emotet , a lot of the samples I'm using are kind of some old samples for the moment. 22 00:01:20,840 --> 00:01:22,320 I have some newer stuff later on. 23 00:01:22,320 --> 00:01:25,660 But this is part of Emotet, part of the Epoch 4. 24 00:01:25,660 --> 00:01:29,340 There are various epochs, various evolutions. 25 00:01:29,900 --> 00:01:37,000 If I look at that in like VirusTotal, I can find a hash that's associated with this URL. 26 00:01:37,060 --> 00:01:41,180 And then I can follow that trail, looking for more hashes. 27 00:01:41,340 --> 00:01:43,460 VirusTotal makes this very easy. 28 00:01:43,600 --> 00:01:50,660 I can then keep on going and getting more and more attribution, finding more of this particular variation of Emotet. 29 00:01:50,660 --> 00:01:53,200 Maybe it's today's variant or this week's variant. 30 00:01:54,120 --> 00:02:04,000 I can copy the hash for that file and I can go in multiple different directions, take that to another interface and find additional things. 31 00:02:04,860 --> 00:02:09,160 Keep on looking, basically ending up at finding a whole bunch of different URLs. 32 00:02:09,160 --> 00:02:13,100 So as a threat hunter, I would do this to like find additional compromised URLs. 33 00:02:13,100 --> 00:02:20,920 In this case, a bunch of WordPress URLs that are dropping this specific version of Emotet at the time. 34 00:02:21,220 --> 00:02:25,020 Maybe I have another example, just to give you another example. 35 00:02:25,160 --> 00:02:31,240 I go to any.run, which is a malware sandbox that you can go to, and I grab something. 36 00:02:31,240 --> 00:02:33,460 I see a URL that's at this IP address. 37 00:02:33,520 --> 00:02:40,000 And I grab that IP address, go look for it in another place and get some hashes and get more information. 38 00:02:40,000 --> 00:02:41,900 Keep building up my thing. 39 00:02:41,900 --> 00:02:44,820 You have to know when to quit, of course, but keep building. 40 00:02:44,940 --> 00:02:57,560 And eventually you can do something like you can map it all together, following host infrastructure, finding what these specific threat actors are using to make their malware do what it does. 41 00:02:57,580 --> 00:03:10,080 But there's always patterns, as we all know, like when you look at binary analysis or anything like that, there's certain variable names that are the same because it's difficult to change your habits as anything in the world. 42 00:03:10,620 --> 00:03:25,800 There's a framework for this, you probably all know about it, minor attack framework to attribute various tools, tactics, procedures to things and to groups like APT29, which is a threat group and it's, you know if something belongs to them because it follows these certain procedures. 43 00:03:26,440 --> 00:03:29,600 They use certain techniques, you can track everything with this. 44 00:03:29,600 --> 00:03:32,440 It's nice, it's a little hard to automate, but it's nice. 45 00:03:33,700 --> 00:03:38,180 There's books about this kind of thing, this is a great book about this, I actually bought it at Defcon a few years ago. 46 00:03:39,080 --> 00:03:41,060 But there are levels of attribution. 47 00:03:41,320 --> 00:03:49,980 When I worked in the government, we were very interested in threat actors, like what threat actor is responsible for this thing and APT was the word of the day every single day, so. 48 00:03:50,220 --> 00:03:54,060 We were interested in individuals, other governments, the state sponsored stuff. 49 00:03:54,680 --> 00:04:06,300 In some cases, many places, I'm interested in campaigns, so what is the malware campaign that I'm looking at, is it Emotet or is it something like a remote access Trojan or is it ransomware or whatever. 50 00:04:07,160 --> 00:04:13,260 And then in most cases, like small environments, you just want to know what's inside your network, if that's your attribution level. 51 00:04:14,960 --> 00:04:23,940 So I'm going to talk briefly about the infection chain because it doesn't change much, just like the behaviors of all these things don't change much, making it possible to track them. 52 00:04:24,160 --> 00:04:27,440 Using Emotet again, it's just so easy to use and I like to make fun of it. 53 00:04:27,800 --> 00:04:43,640 It usually comes in via an email and then you get a link to something or an attachment to something, leads to OfficeDock with macros, PowerShell, more macros, it'll install additional components, then the C2 stuff, back then, I mean, it would lead to Cobalt Strike, 54 00:04:43,640 --> 00:04:46,020 but maybe it leads to remote access Trojan. 55 00:04:46,380 --> 00:04:50,080 This is just Emotet, but this is kind of a pattern with most things. 56 00:04:50,080 --> 00:04:56,580 The easiest way to compromise is, you know, get the user via some kind of email dropper or link to something or drive-by download. 57 00:04:59,640 --> 00:05:05,120 Usually, oh, let's see, I forgot that I made this segmented, but I just went over that. 58 00:05:05,840 --> 00:05:11,700 So another one, QuackBot, same kind of thing, but a little bit more complex, maybe to make it seem more authentic. 59 00:05:12,340 --> 00:05:21,720 Usually they get an email, which has a link, which leads to a password-protected zip file, they possibly open that file, and then they have an ISO, and they're like, what do I do with this? 60 00:05:21,720 --> 00:05:26,180 They open that, there's a Windows shortcut, downloads things, and then it does what it does after that. 61 00:05:27,600 --> 00:05:37,940 And typically you see that get request in over HTTP, maybe you see it more these days over SSL, but often you'll see it over HTTP, and then SSL traffic starts after that. 62 00:05:37,940 --> 00:05:43,840 When you're detecting this kind of stuff, it's harder where you get to the SSL, but I'm going to talk about that too. 63 00:05:44,300 --> 00:05:48,160 The problem that I'm addressing here is how do we find bad things in the network? 64 00:05:48,160 --> 00:05:53,060 How do we get the attribution of what's inside our environment without knowing too much? 65 00:05:54,760 --> 00:06:01,000 So this is just my home network, I'm just capturing stuff on a capture device. 66 00:06:01,320 --> 00:06:05,500 It's not very busy, but I mean, of course, networks are way busier than this, but how do you find something like this? 67 00:06:05,500 --> 00:06:14,160 This is just a super simple example of like a post over clear text of someone putting a username and password into a compromised WordPress site. 68 00:06:14,160 --> 00:06:15,460 How do you find that inside that? 69 00:06:15,460 --> 00:06:18,400 There are ways, obviously, we know about this, I'm sure. 70 00:06:19,120 --> 00:06:21,920 Intrusion detection and Yara, I'm going to talk about these. 71 00:06:22,900 --> 00:06:37,780 So IDS rules, this is kind of a crazy slide, but at the very top, if you're familiar with this, is an IDS rule, I'm using Emotet, it would capture what you see in this PCAP, it's going to look for things like the content being the post, it's going to look for a specific kind of post content, 72 00:06:37,780 --> 00:06:41,220 maybe it's looking for the user agent or some other data. 73 00:06:42,360 --> 00:06:52,140 And when I run this, like if I run a PCAP or I run that malware in my, when I ran it in my home environment, I triggered six alert fires through Suricata reading this rule. 74 00:06:52,140 --> 00:06:55,200 So there's really easy detection mechanisms for certain things. 75 00:06:55,780 --> 00:06:58,980 Of course, as with most things, you have to know what you're looking for. 76 00:06:58,980 --> 00:07:01,340 You have to have already seen it in many cases. 77 00:07:01,340 --> 00:07:06,100 Yara rules are typically not thought of as a streaming detection mechanism. 78 00:07:06,100 --> 00:07:07,880 I mean, they can be used in such a way. 79 00:07:08,100 --> 00:07:10,140 We use them at my work like that. 80 00:07:10,420 --> 00:07:19,280 But they're typically for finding strings or data in binary analysis, you can look for stuff in HTTP text and JavaScript. 81 00:07:19,400 --> 00:07:24,160 So it's not really thought of as a thing you can use for PCAPs or net streaming network traffic. 82 00:07:24,160 --> 00:07:32,260 But I did find that someone wrote a tool called Yara PCAP, I took that and I modified it, my code is going to be at the very end of this, I have a link to it. 83 00:07:32,400 --> 00:07:36,100 But I modified that to include it as a proof of concept if you want to play with it. 84 00:07:36,100 --> 00:07:40,420 So you can upload a PCAP and test it. 85 00:07:40,480 --> 00:07:49,640 How it works with the Yara PCAP thing is you write a Yara rule, like based off this IDS rule that I had before, it becomes really simple, much easier to read. 86 00:07:49,640 --> 00:07:58,980 I'm looking for a post for the user agent, certain kind of content, the refer information, and then I want to get all those things when it sees them, it triggers. 87 00:07:58,980 --> 00:08:09,580 So if you look at my web app that I built, you browse to something, I pull up like a test Yara, I can see that I get these two alerts, basically. 88 00:08:09,700 --> 00:08:17,280 So it's possible to capture stuff over network with Yara as a detection mechanism. 89 00:08:18,220 --> 00:08:21,300 There's just a view of it. 90 00:08:22,300 --> 00:08:24,200 There are some obstacles here. 91 00:08:24,200 --> 00:08:25,920 I'm going to talk about a lot of obstacles. 92 00:08:26,860 --> 00:08:29,720 Visibility, SSL, I briefly touched on this. 93 00:08:31,300 --> 00:08:40,340 Going back to that infection chain, usually you get an email, and that's going to be one endpoint detection, you're looking at your email detection, so hopefully you have something that's watching your email. 94 00:08:40,740 --> 00:08:50,060 You maybe have a going to get that link over HTTP, or you have an attachment already in the email, so, I mean, you hopefully detected it in the email. 95 00:08:50,120 --> 00:08:57,820 And then your endpoint detection is hopefully catching that office doc with all the macros and seeing PowerShell running and stopping it. 96 00:08:58,580 --> 00:09:12,440 Then installing additional components is probably going to be over SSL, you're probably not going to know that's something weird is happening, except for the endpoint that it's connecting to, if you're monitoring that, or if you're looking at DNS, you can also get some information from that, 97 00:09:12,440 --> 00:09:13,000 too. 98 00:09:13,060 --> 00:09:17,220 And the C2 is usually going to be SSL as well, and beyond. 99 00:09:17,220 --> 00:09:26,480 Remote access Trojan traffic, and when they drop ransomware on there, you don't have visibility into the whole thing like you did maybe 15 years ago. 100 00:09:27,440 --> 00:09:37,340 And here's an example, like iced ID dropper, you get it over HTTP, and then traffic starts right afterwards with SSL. 101 00:09:37,340 --> 00:09:47,280 So you can capture that HTTP and maybe the SSL with some kind of magical behavioral analysis, or in some cases, stuff I'm showing you kind of catches it sometimes. 102 00:09:48,000 --> 00:09:49,500 There are solutions for this. 103 00:09:49,500 --> 00:09:54,120 When I give talks, I don't do vendor talks usually, so I try to talk about free things. 104 00:09:54,340 --> 00:10:07,940 I think Proxifier has a fee, but enterprises like my company and other companies offer solutions to man the middle of your SSL traffic, you have to install something on the clients, so you can intercept that stuff for better detection. 105 00:10:08,120 --> 00:10:09,520 But you can also do it for free. 106 00:10:10,480 --> 00:10:13,100 So is this possible, this thing I'm talking about here? 107 00:10:13,320 --> 00:10:14,460 Well, let's find out. 108 00:10:15,040 --> 00:10:20,200 I had this idea from a talk I gave a long, long time ago, I was looking at, these are really old samples. 109 00:10:20,560 --> 00:10:25,620 These are, okay, I'm not a data scientist, so ignore the numbers on the left. 110 00:10:26,740 --> 00:10:32,060 I was plotting the time, plotting when things were happening with a sample, like over the network. 111 00:10:32,080 --> 00:10:36,060 When does it make a GET or a PORT request, or when's the SYN, SYNACK, et cetera. 112 00:10:36,560 --> 00:10:37,860 And it's a whole bunch of samples. 113 00:10:37,860 --> 00:10:42,860 And I've seen there's a relationship between these samples, but I don't know, maybe not. 114 00:10:43,380 --> 00:10:49,080 Then I looked at Emotet samples, it's different than Hansitor, it's different. 115 00:10:49,080 --> 00:10:53,900 And they're related, by the way, but they're, the traffic stuff is different. 116 00:10:53,900 --> 00:10:59,080 And then we look at TrickBot, same kind of thing, they're related to each other, very different from Hansitor and Emotet. 117 00:10:59,080 --> 00:11:04,460 I'm not going to show you more examples of malware, but I was like, maybe there's an idea here of something I could explore. 118 00:11:05,100 --> 00:11:09,140 So let's talk about finding some patterns and show, like, some examples. 119 00:11:09,240 --> 00:11:21,320 I'll use dropper downloads, so when you first get that dropper, beaconing out, and we'll have a little bit of SSL in there, and then benign versus malicious, because in many cases I'm wondering, is this just how networking works, the way that I'm doing this? 120 00:11:21,320 --> 00:11:25,020 Or is it bandwidth that's causing issues, or not causing issues? 121 00:11:25,300 --> 00:11:38,720 Looking at dropper downloads first, I'll take two separatized ID downloads, I'm getting these requests, I've got almost double the transactions on the top one than the bottom one, and the download is basically the same. 122 00:11:39,180 --> 00:11:43,760 So these, they look different, but in terms of how many transactions happen. 123 00:11:44,800 --> 00:11:51,640 I'll look at the timing in between these, like, so when a transaction happens, then the next transaction, and what's the timing between that? 124 00:11:51,640 --> 00:11:54,100 And that's what I'm going to be focusing on mostly in this talk. 125 00:11:54,940 --> 00:12:01,000 And despite the difference in transactions, I'm seeing that there's a sort of a pattern, just, you know, just using my meat brain. 126 00:12:01,660 --> 00:12:08,180 I've got a big time, and a small one, larger, small, really big, smaller, etc. 127 00:12:08,180 --> 00:12:11,660 So I'm seeing a pattern, I'm wondering, is this something I can work with? 128 00:12:12,320 --> 00:12:13,680 Let's look at beaconing. 129 00:12:14,260 --> 00:12:18,100 This is over SSL, cobalt strike, beaconing, two samples. 130 00:12:19,380 --> 00:12:24,380 Is this even, am I going to see the kind of same results, or is this just how networking works? 131 00:12:24,380 --> 00:12:28,020 This is what I'm always asking myself, is this stuff I don't know about? 132 00:12:28,640 --> 00:12:34,700 I look at it, I'm kind of seeing the same patterns where I get that big one and the small one, so it's still maybe, maybe it's just how it works. 133 00:12:35,340 --> 00:12:39,500 I do Emotet and Trickbot beacons, same kind of thing. 134 00:12:39,500 --> 00:12:43,460 So I need to find something to show me a difference. 135 00:12:43,460 --> 00:12:47,840 I need two samples that are alike, and I want to know if they behave differently. 136 00:12:47,840 --> 00:12:49,180 So benign versus malicious. 137 00:12:49,620 --> 00:12:55,060 I downloaded this thing called existential.exe, I found it when I was looking for a benign exe file. 138 00:12:55,280 --> 00:13:00,500 Someone wrote it to look like a malicious dropper download, which is usually pretty small. 139 00:13:00,840 --> 00:13:04,880 You can see I get it, and I'm getting it from some site, a domain that I own. 140 00:13:05,560 --> 00:13:08,840 And then I compared it with a malicious dropper download. 141 00:13:08,840 --> 00:13:16,740 I don't remember the malicious dropper, but I'm seeing there are some similarities, but it's starting to be different enough that I decided to explore further. 142 00:13:17,640 --> 00:13:21,140 So let's talk about the processes that I'm going to play with and use in this. 143 00:13:21,140 --> 00:13:25,780 I'm going to talk about averages, Levenstein distance, and some fuzziness. 144 00:13:26,360 --> 00:13:27,740 There's some challenges. 145 00:13:28,660 --> 00:13:31,960 Again, finding the parts that I'm interested in. 146 00:13:32,380 --> 00:13:36,620 If you have network traffic, how do you find the bad stuff? 147 00:13:36,620 --> 00:13:42,940 I have malware analysis sandboxes at home, we have them at work, we have them all available to us for free. 148 00:13:43,360 --> 00:13:45,080 So you can find this stuff. 149 00:13:45,080 --> 00:13:48,180 But if you have a PCAP full of stuff, how do you find it? 150 00:13:48,180 --> 00:13:52,120 And there's always flows in a huge PCAP file. 151 00:13:52,140 --> 00:13:56,840 These are the connections between all the different servers, or maybe you just do one machine in all the places it connects to. 152 00:13:56,840 --> 00:14:02,260 So how do you separate all these flows in an efficient manner and then operate on them? 153 00:14:03,240 --> 00:14:05,860 There are, as I mentioned, there are places we can go get stuff. 154 00:14:05,860 --> 00:14:09,380 I'm going to use a lot of examples from malware traffic analysis for the Austin site. 155 00:14:09,380 --> 00:14:16,560 You can download an exact, like almost a carved PCAP, sometimes there's extra data in there, but of malicious stuff. 156 00:14:16,560 --> 00:14:19,520 And I'm going to use that for what I'm going to build signatures out of. 157 00:14:20,460 --> 00:14:30,940 So once I have a viable PCAP, like I downloaded from malware traffic analysis, like I'm going to use this ICED ID with Cobalt Strike, it's old, but... 158 00:14:30,940 --> 00:14:32,820 Oh wait, I figured something out. 159 00:14:32,820 --> 00:14:35,460 Oh yeah, once I have a viable PCAP, I can use that. 160 00:14:35,460 --> 00:14:38,020 So I'll play with the detection ideas. 161 00:14:38,020 --> 00:14:41,000 I'll play with the averages and I'm going to look at co-integration. 162 00:14:41,460 --> 00:14:43,500 And once again, I'm not a data scientist. 163 00:14:43,500 --> 00:14:48,560 I'm going to talk about co-integration and I might mess it up a little bit, but I know how to make it work in the thing, sort of. 164 00:14:48,700 --> 00:14:50,900 So averages first. 165 00:14:51,680 --> 00:14:57,820 When I look at an isolated trick bot post from that viable PCAP that I download, I've got 840 queries. 166 00:14:58,140 --> 00:15:03,540 I'll take the queries in between the transactions and I'll put them in a big list. 167 00:15:03,540 --> 00:15:08,800 And this is basically the entire PCAP in terms of time from the very beginning to the end from when it runs. 168 00:15:10,080 --> 00:15:11,280 And then I'll find the average. 169 00:15:11,280 --> 00:15:15,400 So I'll add them together and I'll divide them and get the average number. 170 00:15:15,400 --> 00:15:19,160 So average time between is 12,748 for this one PCAP. 171 00:15:19,320 --> 00:15:21,040 And then take another one. 172 00:15:21,040 --> 00:15:22,900 I've got a different set of queries. 173 00:15:22,900 --> 00:15:24,020 Do the same thing. 174 00:15:24,060 --> 00:15:28,860 And I've got these averages that on their own don't look that similar. 175 00:15:28,860 --> 00:15:33,880 The number is 14,748 and 16,125 different. 176 00:15:33,920 --> 00:15:37,220 But I need to compare it to other stuff to see how related they might be to each other. 177 00:15:37,480 --> 00:15:39,420 So I'll compare this against some random traffic. 178 00:15:39,420 --> 00:15:43,360 I take a random PCAP just with stuff in it. 179 00:15:43,360 --> 00:15:50,000 And it's got 779 queries and I'm also taking one flow from that random traffic just to add another thing. 180 00:15:50,000 --> 00:15:51,200 Just 32 queries. 181 00:15:51,200 --> 00:15:52,640 So it's not that much data. 182 00:15:52,880 --> 00:15:57,600 And when I look at it in this context, I'm seeing that there's a little bit more of a relationship between them. 183 00:15:57,600 --> 00:16:00,660 And if I scale this, I'm seeing even more of a relationship between them. 184 00:16:00,660 --> 00:16:02,480 I don't have that as an example. 185 00:16:02,760 --> 00:16:08,880 So I'm feeling like I can continue on and explore this further. 186 00:16:09,300 --> 00:16:11,880 I'm going to talk about cointegration as another method. 187 00:16:12,120 --> 00:16:16,560 So cointegration as described is usually a drunk guy and a dog are walking. 188 00:16:16,560 --> 00:16:17,480 They're walking together. 189 00:16:17,480 --> 00:16:19,260 So they're co-occurring with each other. 190 00:16:19,260 --> 00:16:20,800 But are they actually together? 191 00:16:21,120 --> 00:16:23,840 So there's this model to run it against them. 192 00:16:23,840 --> 00:16:26,320 They start to move in a different direction. 193 00:16:26,340 --> 00:16:29,420 You can see that they co-occur, but they didn't co-integrate. 194 00:16:29,420 --> 00:16:30,340 They're not actually together. 195 00:16:30,340 --> 00:16:31,740 They're just doing their own thing. 196 00:16:32,240 --> 00:16:33,580 Basically like that. 197 00:16:33,680 --> 00:16:39,480 And some little parts to describe it when I show some graphs. 198 00:16:39,540 --> 00:16:45,040 P-value is the probability that the relationship between those series is due to chance. 199 00:16:45,040 --> 00:16:55,020 And then there's a spread , which is the difference between the two actually co-integrated time series to show how far they deviate from their long-term relationship with each other. 200 00:16:55,620 --> 00:16:58,560 Just some examples like Russia, Ukraine searches on Google. 201 00:16:59,960 --> 00:17:07,320 On the spread, they were together and they separated away from the spread, but they did it at the same time. 202 00:17:07,320 --> 00:17:10,360 So they're co-integrated and they stay together basically. 203 00:17:10,360 --> 00:17:13,660 These are co-integrated, co-occurring things happen at the same time. 204 00:17:14,220 --> 00:17:18,780 Twitter and Elon Musk around that time, I think that's around when he took it over. 205 00:17:19,160 --> 00:17:20,260 So they don't really... 206 00:17:20,800 --> 00:17:22,240 they're way off the spread. 207 00:17:22,460 --> 00:17:27,360 The timelines don't match up, but they come together right at the same time to zero on the spread right there. 208 00:17:27,360 --> 00:17:30,720 So there was a relationship because everyone's like, oh, what's going on with this? 209 00:17:30,720 --> 00:17:32,080 And they're Googling it or whatever. 210 00:17:32,420 --> 00:17:36,440 And then 5G and COVID, I just had to put this in here because people were searching it. 211 00:17:36,440 --> 00:17:40,980 They matched, stayed on the spread all the time, and then they both searched at the same time. 212 00:17:41,660 --> 00:17:42,280 Annoying. 213 00:17:42,600 --> 00:17:45,200 The people... whatever. 214 00:17:46,660 --> 00:17:48,280 So two identical PCAP files. 215 00:17:48,280 --> 00:17:51,720 If I take the same exact ones, they're going to definitely co-integrate. 216 00:17:53,200 --> 00:17:55,420 Just as a test to see if I could do it, I guess you don't. 217 00:17:55,420 --> 00:17:58,160 And you've got... I put a scatterplot here. 218 00:17:58,160 --> 00:18:00,760 The little numbers on the bottom are the times, the milliseconds. 219 00:18:01,480 --> 00:18:02,680 And they're on top of each other. 220 00:18:02,680 --> 00:18:04,360 There's a blue value underneath the orange value. 221 00:18:04,360 --> 00:18:05,460 Of course, they're identical. 222 00:18:05,460 --> 00:18:09,900 And the P value, which you want to be between zero and one, it's the probability value. 223 00:18:10,260 --> 00:18:11,600 They match exactly. 224 00:18:11,740 --> 00:18:13,860 So I want to try two different PCAP files. 225 00:18:13,860 --> 00:18:16,120 Doesn't matter what they are, if they're malware or not. 226 00:18:16,160 --> 00:18:18,160 They won't co-integrate, though. 227 00:18:18,260 --> 00:18:19,320 And they don't. 228 00:18:19,320 --> 00:18:22,880 The P value for file one is way off. 229 00:18:22,880 --> 00:18:25,100 And the scatterplot is just a mess. 230 00:18:25,560 --> 00:18:28,940 And I'm starting to think there may be some problems with co-integration. 231 00:18:29,020 --> 00:18:32,200 But there's maybe also a method to start finding similarities. 232 00:18:32,680 --> 00:18:36,280 I'll try two different PCAP files with similar traffic. 233 00:18:36,980 --> 00:18:38,820 So these are benign. 234 00:18:38,980 --> 00:18:41,900 One to DigiCert and one to Windows Update. 235 00:18:41,900 --> 00:18:43,700 Just some get requests. 236 00:18:44,320 --> 00:18:47,060 When I map them, I've got a seconds marker. 237 00:18:47,060 --> 00:18:47,980 I'm using seconds here. 238 00:18:47,980 --> 00:18:49,920 And most of this stuff, I'm going to use microseconds. 239 00:18:49,920 --> 00:18:51,620 And I'll mention this in a second. 240 00:18:52,580 --> 00:18:56,580 But at 48 seconds, then 50 seconds, then 53 seconds, then zero. 241 00:18:56,580 --> 00:19:00,520 And that other one, at 38 seconds, at 46, rolling through time as we go forward. 242 00:19:00,900 --> 00:19:03,420 And the number of transactions at those seconds. 243 00:19:03,860 --> 00:19:07,920 When I map them, I get similar P values, because they're kind of similar. 244 00:19:08,320 --> 00:19:12,560 The timing difference is a little bit off, because one started later, one started earlier. 245 00:19:13,420 --> 00:19:16,460 There are some problems, as I mentioned, with co-integration. 246 00:19:16,460 --> 00:19:18,340 Like the time value. 247 00:19:18,780 --> 00:19:21,340 I've got this one and I've got this other one that has a huge one. 248 00:19:21,340 --> 00:19:26,480 I'm going to get a scatterplot or data that the second one is going to far exceed the other one. 249 00:19:26,480 --> 00:19:28,380 They aren't going to match up the way I want them to. 250 00:19:28,380 --> 00:19:31,940 Even if I'm doing individual flows compared against each other. 251 00:19:33,620 --> 00:19:35,040 As you can see, that's what I did here. 252 00:19:35,040 --> 00:19:36,400 I forgot that I put the slide here. 253 00:19:36,400 --> 00:19:39,160 But the orange one keeps on going. 254 00:19:39,180 --> 00:19:40,600 The P values are different. 255 00:19:41,200 --> 00:19:43,840 So short sample size. 256 00:19:43,840 --> 00:19:46,100 In many cases, a flow will be very minimal. 257 00:19:46,100 --> 00:19:50,400 So I'm going to get something where I can't do anything with it. 258 00:19:50,920 --> 00:19:53,000 So let me talk about time resolution. 259 00:19:53,000 --> 00:19:55,540 I just briefly mentioned I talk about this. 260 00:19:56,080 --> 00:20:00,160 You have to decide how much time you want to work with. 261 00:20:00,180 --> 00:20:02,320 At the minutes resolution, you're not going to get much data. 262 00:20:02,320 --> 00:20:05,040 It's going to be spread out one per minute. 263 00:20:05,480 --> 00:20:08,220 Or all your transactions in a minute. 264 00:20:08,220 --> 00:20:10,940 The seconds, you're going to get some data, but it's not going to be useful. 265 00:20:11,140 --> 00:20:12,320 Microseconds, you get a lot more data. 266 00:20:12,320 --> 00:20:13,960 So I'm going to work with microseconds. 267 00:20:14,780 --> 00:20:16,080 Also normalization. 268 00:20:16,080 --> 00:20:19,620 Because things aren't starting at the same time, I want them to start at the same time. 269 00:20:19,620 --> 00:20:28,800 So I decided to make all PCAPs or any network transactions, I throw through this to start at January 1st, 2000, just to get them to line up. 270 00:20:30,520 --> 00:20:32,600 And this just sort of shows that. 271 00:20:32,600 --> 00:20:36,180 I don't have to really describe it, but they show how they all start at the same time. 272 00:20:37,020 --> 00:20:42,760 Now, talking about signatures and detection, where it's getting a little more interesting, where I'm starting to play with actually building the signatures. 273 00:20:42,960 --> 00:20:44,580 I want to separate the flows first. 274 00:20:44,580 --> 00:20:46,200 I'm going to calculate percentages. 275 00:20:46,220 --> 00:20:47,720 I'm going to do distance, and I'm going to do fuzziness. 276 00:20:47,720 --> 00:20:50,400 And I'll involve Levenstein distance and other things. 277 00:20:51,240 --> 00:20:56,000 So first step to separate these flows, as I showed before, it's a lot of flows inside network data. 278 00:20:56,000 --> 00:21:09,980 And if you're running this with Daemon logger or TCP dump, writing a packet capture to file on your logging systems, and then you're going to have tons of data, and then you have to separate those flows. 279 00:21:10,000 --> 00:21:11,940 So I'm going to operate against each flow individually. 280 00:21:11,940 --> 00:21:15,440 This is computationally intense. 281 00:21:15,440 --> 00:21:17,900 So in my code, I've made it so it's multiprocessing. 282 00:21:17,900 --> 00:21:18,980 At least there's that. 283 00:21:19,140 --> 00:21:23,480 So when I run it, it'll just use whatever processing power you have. 284 00:21:23,480 --> 00:21:28,600 I'm using it on this laptop, and it's pretty fast for a fairly large file. 285 00:21:29,700 --> 00:21:34,660 And so once I operate that, I get the average time between queries and the total queries, and I also get some other data. 286 00:21:34,660 --> 00:21:36,160 I added more after this point. 287 00:21:36,560 --> 00:21:44,340 And then I'm going to calculate percentages, because I'm ending up with these times and these averages, and it's kind of messy. 288 00:21:44,340 --> 00:21:45,940 I want it to be smaller. 289 00:21:46,000 --> 00:22:04,320 I'm ultimately working towards a goal of building a small list of numbers that I can make into a So when I take those frequencies, those numbers and the times in between, and I say this time is what percentage of the entire PCAP, I do that for the whole thing. 290 00:22:04,540 --> 00:22:08,560 There's a lot of zeros, and then there's a lot of times where it doesn't. 291 00:22:08,620 --> 00:22:10,920 Theoretically, this whole list should equal 100. 292 00:22:11,080 --> 00:22:15,820 I do some stuff to it, and it doesn't quite equal 100 after I deal with it. 293 00:22:15,820 --> 00:22:23,480 But if I look at just a quick look at just this raw percentage data, I'm kind of seeing the same traffic patterns between PCAPs. 294 00:22:23,960 --> 00:22:25,080 I add a little chaos. 295 00:22:25,080 --> 00:22:26,640 Like I said, I do some stuff to it. 296 00:22:26,700 --> 00:22:27,920 I take away those zeros. 297 00:22:27,920 --> 00:22:28,980 I round things. 298 00:22:30,020 --> 00:22:34,360 This, you add it up, it won't equal 100, but it's because I did stuff to it. 299 00:22:34,360 --> 00:22:36,780 But it's all in my code, which you can see. 300 00:22:38,480 --> 00:22:44,660 Basically, what I'm ending up with is something like this, where I have this list of numbers, and I'm thinking, well, this is... okay, this is something. 301 00:22:44,660 --> 00:22:46,880 It represents the time of a transaction. 302 00:22:47,420 --> 00:22:51,740 So we can find exact matches, like the exact same thing in other PCAP data. 303 00:22:51,740 --> 00:22:55,400 And that's nice, but I'm looking for variations of malware. 304 00:22:55,400 --> 00:23:04,580 Like when the new variant of today's hot malware drops because the last one was burned, how do we find it? 305 00:23:06,300 --> 00:23:08,540 So I look at percentages and distances. 306 00:23:08,540 --> 00:23:12,120 I talked about Levenstein distance, and let me go into that a little bit more. 307 00:23:12,620 --> 00:23:16,120 Levenstein distance, if you don't know, it's usually used on string data. 308 00:23:17,820 --> 00:23:24,200 And if you want to know how far away the word kitten is from sitting, you place that K with an S, that's one distance. 309 00:23:24,200 --> 00:23:26,680 You place the E with an I, that's a second distance. 310 00:23:26,680 --> 00:23:27,940 You add a G, that's a third distance. 311 00:23:27,940 --> 00:23:31,760 So it's three distance from each other. 312 00:23:31,760 --> 00:23:39,620 And I was thinking maybe I could use this even on small bits of data and treat those numbers not like integers, but like strings. 313 00:23:41,000 --> 00:23:48,160 So if we remember, I want to find this behavior, this little bad thing in this whatever thing. 314 00:23:48,940 --> 00:23:52,420 So I'll create my signature, which looks like this. 315 00:23:52,420 --> 00:23:54,100 And it doesn't look that valuable. 316 00:23:54,100 --> 00:23:57,020 It's a bunch of ones and twos and that one. 317 00:23:58,500 --> 00:24:05,200 And when I run it on something using Levenstein distance, I get a number at the very end. 318 00:24:05,200 --> 00:24:10,800 That number going up to 100 equals the probability that I'm finding inside a flow something that matches. 319 00:24:12,460 --> 00:24:15,860 But I can see there's a lot of like 58, 67. 320 00:24:15,860 --> 00:24:16,720 There's one that's 100. 321 00:24:16,720 --> 00:24:18,460 That's the one I made my signature from. 322 00:24:18,460 --> 00:24:21,180 So of course it matches because it's exactly identical. 323 00:24:22,080 --> 00:24:26,520 So I'm starting to get somewhere where I can maybe be a little looser in my searching. 324 00:24:27,660 --> 00:24:31,760 I'm just looking at that PCAP and seeing that's the thing I made a signature from. 325 00:24:32,160 --> 00:24:33,640 But I need to be fuzzier with it. 326 00:24:33,640 --> 00:24:35,160 I need to get a little bit looser. 327 00:24:36,440 --> 00:24:40,740 There was something that was called Fuzzy Wuzzy, which is so cool, but it's the fuzz now. 328 00:24:40,800 --> 00:24:47,080 So I'm using this to apply a different threshold based on the Levenstein distance. 329 00:24:47,260 --> 00:24:51,140 When I run this, I'm going to get another number that's been modified. 330 00:24:51,140 --> 00:24:58,940 It still has the 100 for the signature match, but it has other numbers that I'm interested in, like the 75, 67. 331 00:24:59,820 --> 00:25:01,960 What are these numbers and what do they represent? 332 00:25:01,960 --> 00:25:05,840 So I can't remember if I opened the PCAP in this one. 333 00:25:05,840 --> 00:25:06,580 Let's see. 334 00:25:09,530 --> 00:25:10,490 I did not. 335 00:25:10,490 --> 00:25:15,250 So the signature made from this flow, as pointed out before, got these two other ones I'm interested in. 336 00:25:15,350 --> 00:25:17,810 If I look at one of them, I get an exact match. 337 00:25:18,310 --> 00:25:20,770 If I look at another one, it's an exact match. 338 00:25:21,390 --> 00:25:22,490 So that's interesting. 339 00:25:22,490 --> 00:25:29,930 I have no match on 67, so maybe there's a number I can pick that is my magical number that's going to find this all of the time. 340 00:25:30,510 --> 00:25:34,630 There's some tuning involved, because different malware campaigns are different with each other. 341 00:25:35,410 --> 00:25:39,310 I'll talk about this in the future work I'm going to work on, but just showing tuning. 342 00:25:39,550 --> 00:25:48,750 I'm sorry to show you code, but basically I'm looking, as kind of described already, the partial ratio is greater than my threshold. 343 00:25:48,790 --> 00:25:53,450 That partial ratio is from the fuzz thing, and Levenstein distance is less than my Levenstein threshold. 344 00:25:53,450 --> 00:25:58,330 So I'm working with these two variables, and I just have to tune them depending on what I'm working with. 345 00:25:59,750 --> 00:26:02,590 And I can set that, you know, at the very top of my code. 346 00:26:02,590 --> 00:26:04,490 This is all in the README on the GitHub. 347 00:26:06,050 --> 00:26:15,250 So if I go get two things, Darkgate activity, I downloaded one from 11-30-2023 and 12-7-2023. 348 00:26:15,250 --> 00:26:20,210 I don't think I could find... I wasn't able to find newer stuff than that, just like last week. 349 00:26:20,730 --> 00:26:20,910 But 350 00:26:24,590 --> 00:26:31,550 what I'm going to do is I'm going to carve out the bit I'm interested in from the 11-30 one first. 351 00:26:31,750 --> 00:26:35,110 Let me scroll down here to post. 352 00:26:36,290 --> 00:26:44,310 So I'm finding this information here, this post that's suspicious, and we know it's bad. 353 00:26:44,310 --> 00:26:48,210 And I'm going to save this to create a signature out of it. 354 00:26:48,210 --> 00:26:58,590 So I'm just exporting just the displayed packets, saving it as Darkgate post, and then just showing you what it looks like. 355 00:26:58,590 --> 00:27:01,630 It has no other flows in it, just this one flow between these two servers. 356 00:27:03,130 --> 00:27:05,290 And then I'm going to upload this to create a signature . 357 00:27:07,590 --> 00:27:12,390 And when I upload it, it creates a really simple... like, there's three numbers. 358 00:27:12,390 --> 00:27:14,250 It doesn't seem like I can do much with that. 359 00:27:14,590 --> 00:27:15,750 But I'll show you. 360 00:27:16,770 --> 00:27:25,170 And then when I go and I upload the same file, I want to see... I'm tuning it right now. 361 00:27:25,170 --> 00:27:28,010 So I'm getting a match, of course, on my exact match. 362 00:27:31,700 --> 00:27:37,540 But if I look at some of the other ones below it, I'm going to see some other additional matches here. 363 00:27:37,840 --> 00:27:39,060 So it's not quite tuned yet. 364 00:27:39,060 --> 00:27:42,040 I've got 11 sign distance of four, my ratio is 75%. 365 00:27:42,040 --> 00:27:45,720 I click on the very top one, which is the most matchy that didn't match. 366 00:27:45,720 --> 00:27:47,100 It's the same one. 367 00:27:47,860 --> 00:27:56,120 I continue down the list and maybe go to 67% distance of four on 11 sign. 368 00:27:56,120 --> 00:27:57,860 And I've got another match here. 369 00:27:57,860 --> 00:28:02,300 So I've obviously got to fix the thresholds I'm working with. 370 00:28:02,300 --> 00:28:03,260 I look at 64%. 371 00:28:03,260 --> 00:28:04,640 Let's see what this is. 372 00:28:08,100 --> 00:28:10,000 And in this case, I'm not getting a match. 373 00:28:10,000 --> 00:28:12,860 So I'm starting to find the numbers I can work with. 374 00:28:17,800 --> 00:28:20,320 Now, I look at this one, 67%. 375 00:28:20,320 --> 00:28:21,480 It's a match. 376 00:28:21,960 --> 00:28:25,820 And so between 67 and 64 is where I want to be. 377 00:28:25,820 --> 00:28:29,160 11 sign, five or four, somewhere on there. 378 00:28:29,240 --> 00:28:31,260 And so I just want to adjust those values and play with it. 379 00:28:31,260 --> 00:28:32,940 Then we'll try this again. 380 00:28:33,040 --> 00:28:36,320 So I've unfortunately got to see me carve out that part again. 381 00:28:36,320 --> 00:28:37,580 I'm going to carve out a little bit different part. 382 00:28:37,580 --> 00:28:39,280 So it's going to create a slightly different signature. 383 00:28:41,040 --> 00:28:47,620 And I think I ran it on... I think I ran it on the same one. 384 00:28:47,620 --> 00:28:48,160 Sorry. 385 00:28:48,360 --> 00:28:52,740 And I'm seeing my don't matches don't match and my matches match. 386 00:28:52,740 --> 00:28:55,640 So I've got this tuned and I can start applying it to other things. 387 00:28:56,340 --> 00:28:59,520 So now I'm going to upload the newest signature from 12.7. 388 00:28:59,520 --> 00:29:03,480 This is a later PCAP different version, basically. 389 00:29:03,480 --> 00:29:04,960 And I'm looking at my matches. 390 00:29:04,960 --> 00:29:08,820 I'm getting similar, different things happening in there. 391 00:29:08,820 --> 00:29:13,720 Same kind of post to a different server, basically. 392 00:29:14,740 --> 00:29:17,540 And the... I'll show you two of them. 393 00:29:17,940 --> 00:29:25,020 And then the ones that are in the not matching will show that they don't match. 394 00:29:25,460 --> 00:29:28,780 So I'm feeling a lot more confident about what I'm seeing here. 395 00:29:29,420 --> 00:29:30,880 And I can apply it to other things. 396 00:29:30,880 --> 00:29:33,240 So I want to try an older signature, newer variant. 397 00:29:33,240 --> 00:29:34,140 This is what I was saying. 398 00:29:34,140 --> 00:29:36,780 You have to watch me carve out the same thing again. 399 00:29:36,780 --> 00:29:40,720 But I'm going to carve it out from the 11.30 and make a signature out of it. 400 00:29:41,180 --> 00:29:45,580 And then I'm going to... I'll stalk you through it. 401 00:29:46,580 --> 00:29:48,100 So I open that up. 402 00:29:48,100 --> 00:29:50,720 I'll isolate the flow that I'm interested in. 403 00:29:51,760 --> 00:29:54,660 I keep on selecting that same get request. 404 00:29:54,780 --> 00:29:58,040 But basically I want to follow this post here. 405 00:30:00,800 --> 00:30:02,460 And I'll save this. 406 00:30:09,170 --> 00:30:12,710 And then upload that to create my signature. 407 00:30:12,910 --> 00:30:17,290 And this is where I'm going to have some different numbers from the last one, because it's a slightly different transaction. 408 00:30:18,390 --> 00:30:23,850 And I want to analyze, I guess, one from six months later, Darkgate. 409 00:30:23,850 --> 00:30:25,590 So I was actually able to find a newer one. 410 00:30:26,190 --> 00:30:27,950 And I'm getting a whole bunch of matches. 411 00:30:28,130 --> 00:30:29,770 So I can review those. 412 00:30:29,770 --> 00:30:32,670 And I can go to the very bottom, which is the least matchy of the matches. 413 00:30:35,090 --> 00:30:38,410 And... oh, actually, I guess I'm going to look at the top one first. 414 00:30:39,550 --> 00:30:43,630 No matter how many times I build these videos, I always forget what I did. 415 00:30:43,930 --> 00:30:45,970 But the very top one matches, of course. 416 00:30:46,110 --> 00:30:48,810 And I can put this... throw this in the last search if I want to. 417 00:30:48,810 --> 00:30:49,930 I'll get all those matches. 418 00:30:50,610 --> 00:30:51,590 169 hits. 419 00:30:53,470 --> 00:31:01,010 When I look at the signature, the signature is based off this visit to TranslateGoogle.com, misspelled, typosquatting. 420 00:31:01,010 --> 00:31:04,730 And the bottom one is the same kind of post to a different place. 421 00:31:05,410 --> 00:31:07,070 And I'm getting 169 matches. 422 00:31:07,070 --> 00:31:07,990 So that's pretty cool. 423 00:31:08,630 --> 00:31:10,830 I thought it'd be cool to add a map, because we all love maps. 424 00:31:10,830 --> 00:31:12,230 Our management loves maps. 425 00:31:13,290 --> 00:31:15,370 And so it's thought it'd be cool. 426 00:31:15,470 --> 00:31:19,670 The red skulls are the bad locations. 427 00:31:19,670 --> 00:31:26,010 The unmapped things are black, because you can't... I couldn't put an internal IP address on a map. 428 00:31:26,010 --> 00:31:33,050 But I try to put them in the middle of the Pacific Ocean when they're unmapped, but there are some other ones that actually get unmapped. 429 00:31:33,050 --> 00:31:34,050 So I'm working on that. 430 00:31:34,910 --> 00:31:35,850 Production use. 431 00:31:35,850 --> 00:31:38,070 This is cool that you can use... you have a web app. 432 00:31:38,070 --> 00:31:45,530 If you're... I've been a SOC analyst, and I've pulled PCAPs down, and I'm like... I open it up, and I see what actually happened once the IDS rule fired. 433 00:31:45,910 --> 00:31:53,730 But it'd be cool to have something like this, where I could upload it, see what's happening, see if it compares with anything in my database of signatures. 434 00:31:54,170 --> 00:31:55,890 But there's other ways to do it. 435 00:31:55,890 --> 00:32:02,110 For example, I was talking about the daemon logger, or TCP dump, if you're writing packets to your disk. 436 00:32:02,110 --> 00:32:05,150 How do you run this on a rolling basis? 437 00:32:07,210 --> 00:32:14,750 So I wrote this as a fast API thing with Flask running on top of it. 438 00:32:14,850 --> 00:32:19,170 So if I start this over on the left, I'm running my fast API app. 439 00:32:19,170 --> 00:32:23,210 And then on the right, I have a Python script sending a PCAP. 440 00:32:23,210 --> 00:32:29,050 And it sends it and gets back JSON data, and then I can refresh whatever my sim is. 441 00:32:29,050 --> 00:32:33,390 It can be Elasticsearch, or anything else that you use, or want to use, and get those matches. 442 00:32:33,710 --> 00:32:37,390 So that's nice, at least for a rolling PCAP. 443 00:32:37,630 --> 00:32:41,650 Of course, as mentioned before, the multiprocessing happens when the flows are separated. 444 00:32:41,650 --> 00:32:43,250 So you want to do it on a fast machine. 445 00:32:43,250 --> 00:32:48,630 But generally, machines that are doing packet capture are going to be fast. 446 00:32:49,850 --> 00:32:56,730 Additionally, just because I thought it would be fun, you can use notify, which is N-T-F-I, to notify you. 447 00:32:56,870 --> 00:33:02,270 So when I run this again, I can get a notification on my phone, which is kind of cool. 448 00:33:03,870 --> 00:33:04,990 Kind of cool. 449 00:33:04,990 --> 00:33:06,950 It could also be kind of terrible. 450 00:33:06,950 --> 00:33:12,630 For example, you can get analyst fatigue when I did this and got a whole bunch of stuff. 451 00:33:12,630 --> 00:33:15,530 So I have that on my system. 452 00:33:15,530 --> 00:33:17,410 But you can run it if you want to. 453 00:33:20,490 --> 00:33:23,190 I'm going to talk about something completely impractical. 454 00:33:23,190 --> 00:33:28,350 I love doing research because it opens my mind to new things. 455 00:33:28,350 --> 00:33:30,070 I get to create and build things. 456 00:33:30,070 --> 00:33:37,230 I feel like security research is a creative process, and it fuels my other creative passions, like music. 457 00:33:37,630 --> 00:33:41,650 So I just wanted to play around with this and see if I could do something with audio. 458 00:33:42,110 --> 00:33:43,630 It's not practical. 459 00:33:43,630 --> 00:33:45,690 But let's just see what happens. 460 00:33:45,690 --> 00:33:47,190 So I like this quote a lot. 461 00:33:47,190 --> 00:33:48,410 Art is how we decorate space. 462 00:33:48,410 --> 00:33:49,730 Music is how we decorate time. 463 00:33:49,730 --> 00:33:55,130 And I painted before I made things, built things to fill up the space we live in. 464 00:33:55,130 --> 00:33:56,310 I also make music. 465 00:33:56,350 --> 00:33:57,690 And music is all based on time. 466 00:33:57,690 --> 00:33:59,750 You change the beat, it's completely different. 467 00:33:59,750 --> 00:34:02,410 You change a note, and the length of the note is different. 468 00:34:03,110 --> 00:34:07,010 So they're powerful things in their own areas. 469 00:34:08,110 --> 00:34:12,830 And I was thinking, while I'm playing with time, let's see if I can make something musical with this. 470 00:34:12,830 --> 00:34:14,430 So you all know about Shazam, I'm sure. 471 00:34:14,430 --> 00:34:15,090 I use it. 472 00:34:15,530 --> 00:34:18,430 If I'm at a club, I'm in the corner, like, Shazamming. 473 00:34:18,630 --> 00:34:25,250 So basically, if you don't know how it works, this is what it looks like. 474 00:34:25,250 --> 00:34:26,630 Oh, that's not what it looks like. 475 00:34:30,660 --> 00:34:38,120 So you press Shazam, you hear a song you want to hear, and then it tells you what it is, adds it to your Spotify playlist, you can listen to it over and over again. 476 00:34:38,120 --> 00:34:38,600 It's great. 477 00:34:39,280 --> 00:34:40,480 Sorry to rickroll here. 478 00:34:41,860 --> 00:34:42,820 So I was researching this. 479 00:34:42,820 --> 00:34:47,300 I was like, could I do this with Python and NumPy? 480 00:34:47,300 --> 00:34:48,800 So I found this article. 481 00:34:48,880 --> 00:35:03,300 I also found something called DejaVu that someone wrote, that they wanted to make their own personal Shazam server where they could store their music, and if they heard a sample of something, it would play that, it would listen for the sample, or you send it to DejaVu, 482 00:35:03,300 --> 00:35:06,500 and it would go, oh, yeah, that's this song. 483 00:35:06,920 --> 00:35:09,100 I thought, oh, I can probably do this. 484 00:35:09,100 --> 00:35:19,320 So I'm back to my transactions, not the percentages, but the actual times in between, the microseconds or milliseconds or whatever time I was using or want to use. 485 00:35:20,320 --> 00:35:23,660 And I'm looking at this, I'm thinking about pitch. 486 00:35:23,720 --> 00:35:25,140 Frequency is the number. 487 00:35:25,140 --> 00:35:31,480 So zero would be a low, like a low sound, and up high would be a high number is a high sound. 488 00:35:31,480 --> 00:35:33,420 So I can make audio out of this. 489 00:35:33,420 --> 00:35:34,660 It's not going to be beautiful. 490 00:35:34,660 --> 00:35:40,880 I mean , you're going to hear it right now, what it sounds like when you listen to a PCAP file. 491 00:35:41,640 --> 00:35:43,400 But there's patterns in there. 492 00:35:44,960 --> 00:35:46,680 Like I said, this is not practical. 493 00:35:47,080 --> 00:35:48,160 But let's play with this. 494 00:35:48,160 --> 00:35:50,900 Let's go same malware sample, different environments. 495 00:35:51,280 --> 00:35:52,740 I'm going to grab my malware. 496 00:35:52,840 --> 00:35:57,440 I grabbed from Malware Bazaar, agent Tesla, kind of old. 497 00:35:57,820 --> 00:36:03,120 I ran it in any run, downloaded the sample, just I don't know why I downloaded the sample. 498 00:36:03,120 --> 00:36:03,880 I always do. 499 00:36:04,160 --> 00:36:05,500 And I get the PCAP. 500 00:36:05,920 --> 00:36:09,240 And then I can see that it's doing a post. 501 00:36:09,300 --> 00:36:11,500 And in this case, I'm not going to be applying my Levenshtein stuff. 502 00:36:11,500 --> 00:36:12,860 I'm just playing with audio. 503 00:36:13,400 --> 00:36:16,060 But I see there's a post here. 504 00:36:16,300 --> 00:36:18,600 And I also want to address the idea of bandwidth. 505 00:36:18,600 --> 00:36:19,820 That's why I'm running this any run. 506 00:36:19,820 --> 00:36:22,780 And I'm also going to run it in my own very busy network environment at home. 507 00:36:23,520 --> 00:36:24,440 I run it on my system. 508 00:36:24,440 --> 00:36:27,620 This is just a picture of one of my malware VMs. 509 00:36:27,640 --> 00:36:30,380 And I've got the same kind of post happening. 510 00:36:30,460 --> 00:36:33,200 I'm going to have different transaction times because of bandwidth. 511 00:36:34,280 --> 00:36:35,760 And I'm going to just end it. 512 00:36:36,280 --> 00:36:38,520 So there's a little bit of stuff here. 513 00:36:38,520 --> 00:36:39,420 I have to reverse it. 514 00:36:39,420 --> 00:36:44,660 I'm instead going to be making a signature out of the entire PCAP, not the little bit. 515 00:36:44,880 --> 00:36:46,540 So like I said, not practical. 516 00:36:46,980 --> 00:36:50,040 And then I'm going to play my little bit and see if it finds it. 517 00:36:52,020 --> 00:36:55,080 If I open up this PCAP, let's see here. 518 00:36:55,740 --> 00:36:57,840 And we're looking at that post. 519 00:37:00,320 --> 00:37:02,440 I've got to create an audio file from it. 520 00:37:02,680 --> 00:37:11,600 So I have a little Python script I wrote to convert those frequencies into different pitches using Fourier transform and some other stuff. 521 00:37:12,380 --> 00:37:14,680 And in the back, you can see there's a bunch of MP3s being made. 522 00:37:14,680 --> 00:37:15,400 And they all disappear. 523 00:37:15,400 --> 00:37:16,860 Those are all the flows individually. 524 00:37:16,860 --> 00:37:19,820 And then they get combined into one big PCAP, MP3. 525 00:37:21,540 --> 00:37:23,560 And then I'm left with that thing. 526 00:37:23,600 --> 00:37:26,640 And then I've got a carved one. 527 00:37:26,860 --> 00:37:30,340 This is the little tiny bit that I want to identify in my Shazam. 528 00:37:31,020 --> 00:37:33,060 I'm going to do the same thing with that. 529 00:37:34,780 --> 00:37:39,880 I've got that MP3 file, which is huge, by the way, compared to the PCAP, which is like 500k or something. 530 00:37:40,520 --> 00:37:41,300 It's not that huge. 531 00:37:41,300 --> 00:37:42,820 But I've got others that are huger. 532 00:37:44,140 --> 00:37:45,480 I've got my carved one here. 533 00:37:45,480 --> 00:37:47,340 I'm going to make the signature from this one. 534 00:37:49,760 --> 00:37:53,000 And you see a bunch of... it's carved, but there's flows in there. 535 00:37:53,680 --> 00:37:55,220 Because I didn't carve it all the way. 536 00:37:55,460 --> 00:37:57,640 And I've got these two MP3 files. 537 00:37:59,220 --> 00:37:59,980 Let's see. 538 00:38:01,980 --> 00:38:03,800 So now I'm going to try to identify it. 539 00:38:04,680 --> 00:38:09,520 Initially, when I try to identify, it's not going to see it because I have to add it to a database. 540 00:38:10,600 --> 00:38:13,220 It's not like a clean app like Shazam. 541 00:38:13,220 --> 00:38:14,860 It's just a program you can run. 542 00:38:14,860 --> 00:38:16,120 So I try to recognize it. 543 00:38:16,120 --> 00:38:17,860 It's not going to recognize my file yet. 544 00:38:17,940 --> 00:38:19,280 But that's because I haven't added it. 545 00:38:19,280 --> 00:38:20,880 So what I'm going to do is I'm about to add it. 546 00:38:20,900 --> 00:38:25,560 I've got to drop it into the signatures folder, which I'm going to do right now. 547 00:38:29,620 --> 00:38:30,500 Slowly. 548 00:38:31,620 --> 00:38:32,780 Drop it in there. 549 00:38:32,780 --> 00:38:36,480 I'm going to run a script to help it identify that. 550 00:38:36,860 --> 00:38:37,600 So it sees it. 551 00:38:37,600 --> 00:38:41,820 It's like now there's a signature for this audio file, this song of yours. 552 00:38:42,380 --> 00:38:48,100 And then I want to recognize the file, just my part. 553 00:38:48,160 --> 00:38:55,700 And it's seeing there's a song ID recognized this traffic pattern that I was seeing. 554 00:38:55,700 --> 00:39:03,220 And if I apply Levenshtein to it, which I didn't do in this example because I don't want to bore you with more of this running commands. 555 00:39:03,220 --> 00:39:05,800 But it gets even more interesting. 556 00:39:05,800 --> 00:39:11,700 But of course, like I said many times, it's not practical because those pcap files can grow to huge sizes when they're mp3s. 557 00:39:11,700 --> 00:39:14,840 And who wants to run their network in mp3 mode? 558 00:39:15,100 --> 00:39:16,980 So maybe I do. 559 00:39:18,180 --> 00:39:19,740 I guess I kind of talked fast. 560 00:39:19,740 --> 00:39:21,260 I'm kind of getting towards the end here. 561 00:39:21,260 --> 00:39:24,620 Supposed to go for 50 minutes or 55 minutes. 562 00:39:24,620 --> 00:39:26,820 But you can go get some coffee. 563 00:39:26,820 --> 00:39:29,780 So going further, I'm going to work on some third-party APIs. 564 00:39:29,780 --> 00:39:37,080 Like I said, I like to, when I release stuff personally, whether that's not a work talk, I want people to be able to try it and play with it if you want to. 565 00:39:37,340 --> 00:39:44,160 So you can add stuff if you want integrations with VirusTotal, with my company's product, Investigate, or other things like that. 566 00:39:45,100 --> 00:39:46,020 I didn't add it. 567 00:39:46,020 --> 00:39:47,200 It's very easy to add. 568 00:39:47,920 --> 00:39:51,320 Then you can look at things like domain, IP, reputation, relationships. 569 00:39:51,320 --> 00:39:53,600 If you have a sinkhole in your environment, you can pull that data in. 570 00:39:53,600 --> 00:39:55,760 You can play with anything you have. 571 00:39:56,680 --> 00:39:58,920 To add more things for conviction. 572 00:39:59,980 --> 00:40:04,040 And I'll analyze various components of the PCAPs, so I can add that in the future. 573 00:40:04,040 --> 00:40:05,480 And I should probably learn Rust. 574 00:40:05,480 --> 00:40:06,700 I should learn something so it's fast. 575 00:40:06,700 --> 00:40:11,480 Like, you know how Snort is a C binary, or I think it's a C binary, and it uses its rules. 576 00:40:11,480 --> 00:40:12,800 It runs very fast streaming. 577 00:40:12,800 --> 00:40:13,760 I'd love to do that. 578 00:40:14,560 --> 00:40:15,720 The code is available. 579 00:40:15,720 --> 00:40:20,400 It's a long name, but if you want, I just uploaded it about two days ago. 580 00:40:20,400 --> 00:40:21,960 So hopefully it's okay. 581 00:40:21,960 --> 00:40:24,380 There's a couple things you have to do if you want to play with it. 582 00:40:24,380 --> 00:40:30,760 But I was very, very verbose in my documentation on the README. 583 00:40:31,100 --> 00:40:32,460 And there's a couple utilities, too. 584 00:40:32,460 --> 00:40:37,140 I added a malware traffic analysis unzipper file, because there's a password scheme. 585 00:40:37,140 --> 00:40:40,780 So if you want to unzip malware traffic analysis PCAPs, you can do that. 586 00:40:40,960 --> 00:40:44,680 You can reach me at my website, my personal site, which is pyrosec.com. 587 00:40:45,440 --> 00:40:47,900 Not a Twitter, because I just don't post. 588 00:40:47,900 --> 00:40:49,640 Don't even really look at it anymore. 589 00:40:49,640 --> 00:40:52,940 And I'll probably rewrite all my posts with nonsense. 590 00:40:53,440 --> 00:40:57,200 And Bastodon, I don't even have the app installed, but I should, because it's kind of cool. 591 00:40:57,200 --> 00:40:58,780 But anyways, that's my talk. 592 00:40:58,780 --> 00:41:00,280 And thank you for coming. 593 00:41:09,280 --> 00:41:11,620 There's time for questions, if you have questions. 594 00:41:27,710 --> 00:41:33,410 Well, a lot of the time I was working in a clean environment, for the most part. 595 00:41:34,950 --> 00:41:40,170 But I did run stuff over my network at home, which I know that's crazy, but I do it. 596 00:41:40,170 --> 00:41:43,390 And I didn't see negative results. 597 00:41:43,390 --> 00:41:45,150 But my network is busy. 598 00:41:45,150 --> 00:41:46,450 It's not a corporate environment. 599 00:41:46,450 --> 00:41:50,970 I have like 20 VMs and three or four servers. 600 00:41:50,970 --> 00:41:51,870 So it's busy. 601 00:41:51,870 --> 00:41:57,910 But I have a family, Spotify, Netflix, YouTube. 602 00:41:59,990 --> 00:42:01,110 What's that? 603 00:42:02,970 --> 00:42:04,430 Yeah, yeah. 604 00:42:04,610 --> 00:42:05,370 It shows promise. 605 00:42:05,370 --> 00:42:06,770 I want to keep exploring it. 606 00:42:07,750 --> 00:42:08,690 Yeah. 607 00:42:13,660 --> 00:42:14,700 Sorry, say again? 608 00:42:19,550 --> 00:42:20,910 No, but that's what I mentioned. 609 00:42:21,050 --> 00:42:22,770 I want to explore future stuff. 610 00:42:22,770 --> 00:42:24,090 And that's easy enough to do. 611 00:42:25,150 --> 00:42:27,090 Direction, that's also good to play with. 612 00:42:27,090 --> 00:42:31,730 I started to play with it with a mapping, like making the source changes constantly. 613 00:42:32,510 --> 00:42:32,870 So... 614 00:42:33,790 --> 00:42:34,570 Oh, yeah? 615 00:42:34,570 --> 00:42:35,150 That's really cool. 616 00:42:35,150 --> 00:42:35,770 I love to talk. 617 00:42:35,770 --> 00:42:36,250 Yeah. 618 00:42:39,970 --> 00:42:40,290 All right. 619 00:42:40,290 --> 00:42:41,350 Thank you very much.