start	end	text
0	7860	All right. Good afternoon, everyone. And it is 1.30 Pacific time in beautiful Las Vegas,
7860	17320	Nevada. Thank you so much for joining us today. And this next talk is sponsored by the Packet
17320	23300	Hacking Village. And it is my absolute pleasure to introduce to you Josh Piore.
23900	33980	Thank you. All right. So that's me. I work with Cisco Talos. Previously I worked with Zscaler,
33980	40160	Umbrella, OpenDNS, NASA, and Mandiant and some other places and nonprofits and whatnot. So I do
40160	47760	security research and I make music and do a bunch of other stuff. So before I get into all the
47760	53180	details, I'm going to talk about what I want to focus on when I'm doing this kind of thing. I'm
53180	57260	going to talk about the infection chain real quick. And it's probably very familiar to you. So
57260	61940	hopefully I'm not going to bore everyone, but I'll just continue on. So looking at attribution,
61940	65120	when you're looking for something, I spent most of my time as a threat hunter. When you're
65120	72200	looking for something, you're following one thing that you see. So maybe I found a domain or a
72200	78240	URL. In this case, I found this one at urlhouse.abuse.ch. And then I can see as part of
78240	81200	Emotet, a lot of the samples I'm using are kind of some old samples for the moment. I have some
81200	86600	newer stuff later on. But this is part of Emotet, part of the Epoch 4. There are various epochs,
86600	94520	various evolutions. If I look at that in like VirusTotal, I can find a hash that's associated
94520	102520	with this URL. And then I can follow that trail, looking for more hashes. VirusTotal makes this
102520	108020	very easy. I can then keep on going and getting more and more attribution, finding more of this
109080	114920	particular variation of Emotet. Maybe it's today's variant or this week's variant. I can copy
114920	119120	the hash for that file and I can go in multiple different directions, take that to another
119740	128040	interface and find additional things. Keep on looking, basically ending up at finding a whole
128040	132020	bunch of different URLs. So as a threat hunter, I would do this to like find additional
132020	138340	compromised URLs. In this case, a bunch of WordPress URLs that are dropping this specific
138820	145020	version of Emotet at the time. Maybe I have another example, just to give you another example.
145160	151980	I go to any.run, which is a malware sandbox that you can go to, and I grab something. I see a
151980	156240	URL that's at this IP address. And I grab that IP address, go look for it in another place and
156240	162480	get some hashes and get more information. Keep building up my thing. You have to know when to
162480	167260	quit, of course, but keep building. And eventually you can do something like you can map it
167260	174220	all together, following host infrastructure, finding what these specific threat actors are using
174220	179720	to make their malware do what it does. But there's always patterns, as we all know, like when
179720	184400	you look at binary analysis or anything like that, there's certain variable names that are the
184400	191560	same because it's difficult to change your habits as anything in the world. There's a framework
191560	196240	for this, you probably all know about it, minor attack framework to attribute various tools,
196240	202400	tactics, procedures to things and to groups like APT29, which is a threat group and it's, you
202400	207300	know if something belongs to them because it follows these certain procedures. They use certain
207300	211620	techniques, you can track everything with this. It's nice, it's a little hard to automate, but
211620	216440	it's nice. There's books about this kind of thing, this is a great book about this, I actually
216440	222180	bought it at Defcon a few years ago. But there are levels of attribution. When I worked in the
222180	226340	government, we were very interested in threat actors, like what threat actor is responsible for
226340	231120	this thing and APT was the word of the day every single day, so. We were interested in
231120	236460	individuals, other governments, the state sponsored stuff. In some cases, many places, I'm
236460	241800	interested in campaigns, so what is the malware campaign that I'm looking at, is it Emotet or is
241800	248760	it something like a remote access Trojan or is it ransomware or whatever. And then in most
248760	251940	cases, like small environments, you just want to know what's inside your network, if that's your
251940	258120	attribution level. So I'm going to talk briefly about the infection chain because it doesn't
258120	263140	change much, just like the behaviors of all these things don't change much, making it possible to
263140	268400	track them. Using Emotet again, it's just so easy to use and I like to make fun of it. It usually
268400	273560	comes in via an email and then you get a link to something or an attachment to something, leads to
273560	279500	OfficeDock with macros, PowerShell, more macros, it'll install additional components, then the C2
279500	285240	stuff, back then, I mean, it would lead to Cobalt Strike, but maybe it leads to remote access
285240	290820	Trojan. This is just Emotet, but this is kind of a pattern with most things. The easiest way to
290820	295440	compromise is, you know, get the user via some kind of email dropper or link to something or
295440	304400	drive-by download. Usually, oh, let's see, I forgot that I made this segmented, but I just went
304400	310080	over that. So another one, QuackBot, same kind of thing, but a little bit more complex, maybe to
310080	314760	make it seem more authentic. Usually they get an email, which has a link, which leads to a
314760	320840	password-protected zip file, they possibly open that file, and then they have an ISO, and they're
320840	324580	like, what do I do with this? They open that, there's a Windows shortcut, downloads things, and
324580	332000	then it does what it does after that. And typically you see that get request in over HTTP, maybe you
332000	337140	see it more these days over SSL, but often you'll see it over HTTP, and then SSL traffic starts
337140	342380	after that. When you're detecting this kind of stuff, it's harder where you get to the SSL, but
342380	347460	I'm going to talk about that too. The problem that I'm addressing here is how do we find bad
347460	351820	things in the network? How do we get the attribution of what's inside our environment without
351820	361520	knowing too much? So this is just my home network, I'm just capturing stuff on a capture device. It's
361520	364800	not very busy, but I mean, of course, networks are way busier than this, but how do you find
364800	370240	something like this? This is just a super simple example of like a post over clear text of someone
370240	374960	putting a username and password into a compromised WordPress site. How do you find that inside
374960	380920	that? There are ways, obviously, we know about this, I'm sure. Intrusion detection and Yara, I'm
380920	386340	going to talk about these. So IDS rules, this is kind of a crazy slide, but at the very top, if
386340	391700	you're familiar with this, is an IDS rule, I'm using Emotet, it would capture what you see in
391700	395940	this PCAP, it's going to look for things like the content being the post, it's going to look for a
395940	402880	specific kind of post content, maybe it's looking for the user agent or some other data. And when I
402880	406660	run this, like if I run a PCAP or I run that malware in my, when I ran it in my home
406660	412780	environment, I triggered six alert fires through Suricata reading this rule. So there's really
412780	418180	easy detection mechanisms for certain things. Of course, as with most things, you have to know
418180	422800	what you're looking for. You have to have already seen it in many cases. Yara rules are typically
422800	428360	not thought of as a streaming detection mechanism. I mean, they can be used in such a way. We use
428360	435600	them at my work like that. But they're typically for finding strings or data in binary analysis,
435600	441020	you can look for stuff in HTTP text and JavaScript. So it's not really thought of as a thing you can
441020	446780	use for PCAPs or net streaming network traffic. But I did find that someone wrote a tool called
446780	451360	Yara PCAP, I took that and I modified it, my code is going to be at the very end of this, I have a
451360	456280	link to it. But I modified that to include it as a proof of concept if you want to play with it. So
456280	464820	you can upload a PCAP and test it. How it works with the Yara PCAP thing is you write a Yara rule,
464820	469760	like based off this IDS rule that I had before, it becomes really simple, much easier to read. I'm
469760	476140	looking for a post for the user agent, certain kind of content, the refer information, and then
476140	480780	I want to get all those things when it sees them, it triggers. So if you look at my web app that I
480780	488680	built, you browse to something, I pull up like a test Yara, I can see that I get these two alerts,
488680	497280	basically. So it's possible to capture stuff over network with Yara as a detection mechanism.
498220	505160	There's just a view of it. There are some obstacles here. I'm going to talk about a lot of
505160	513320	obstacles. Visibility, SSL, I briefly touched on this. Going back to that infection chain,
513320	517060	usually you get an email, and that's going to be one endpoint detection, you're looking at your
517060	522300	email detection, so hopefully you have something that's watching your email. You maybe have a
522300	528360	going to get that link over HTTP, or you have an attachment already in the email, so, I mean,
528360	532620	you hopefully detected it in the email. And then your endpoint detection is hopefully catching
532620	537820	that office doc with all the macros and seeing PowerShell running and stopping it.
538580	542880	Then installing additional components is probably going to be over SSL, you're probably not going to
542880	548720	know that's something weird is happening, except for the endpoint that it's connecting to, if
548720	552440	you're monitoring that, or if you're looking at DNS, you can also get some information from that,
552440	558580	too. And the C2 is usually going to be SSL as well, and beyond. Remote access Trojan traffic,
558580	563980	and when they drop ransomware on there, you don't have visibility into the whole
563980	570980	thing like you did maybe 15 years ago. And here's an example, like iced ID dropper,
570980	578160	you get it over HTTP, and then traffic starts right afterwards with SSL. So you can capture
578160	584700	that HTTP and maybe the SSL with some kind of magical behavioral analysis, or in some cases,
584700	589800	stuff I'm showing you kind of catches it sometimes. There are solutions for this. When I
589800	595220	give talks, I don't do vendor talks usually, so I try to talk about free things. I think Proxifier
595220	601680	has a fee, but enterprises like my company and other companies offer solutions to man the middle
601680	606820	of your SSL traffic, you have to install something on the clients, so you can intercept that stuff
606820	612300	for better detection. But you can also do it for free. So is this possible, this thing I'm talking
612300	617920	about here? Well, let's find out. I had this idea from a talk I gave a long, long time ago,
617920	623940	I was looking at, these are really old samples. These are, okay, I'm not a data scientist, so
623940	629720	ignore the numbers on the left. I was plotting the time, plotting when things were happening
629720	634540	with a sample, like over the network. When does it make a GET or a PORT request, or when's the SYN,
634540	638960	SYNACK, et cetera. And it's a whole bunch of samples. And I've seen there's a relationship
639420	644860	between these samples, but I don't know, maybe not. Then I looked at Emotet samples,
644860	652320	it's different than Hansitor, it's different. And they're related, by the way, but they're,
652320	656440	the traffic stuff is different. And then we look at TrickBot, same kind of thing, they're related
656440	660160	to each other, very different from Hansitor and Emotet. I'm not going to show you more examples
660160	664460	of malware, but I was like, maybe there's an idea here of something I could explore.
665100	670580	So let's talk about finding some patterns and show, like, some examples. I'll use dropper
670580	675100	downloads, so when you first get that dropper, beaconing out, and we'll have a little bit of SSL
675100	678980	in there, and then benign versus malicious, because in many cases I'm wondering, is this
678980	683500	just how networking works, the way that I'm doing this? Or is it bandwidth that's causing issues,
683500	688980	or not causing issues? Looking at dropper downloads first, I'll take two separatized
688980	694440	ID downloads, I'm getting these requests, I've got almost double the transactions on the top one
694440	701860	than the bottom one, and the download is basically the same. So these, they look different, but in
701860	708620	terms of how many transactions happen. I'll look at the timing in between these, like, so when a
708620	712020	transaction happens, then the next transaction, and what's the timing between that? And that's
712020	716940	what I'm going to be focusing on mostly in this talk. And despite the difference in transactions,
716940	722020	I'm seeing that there's a sort of a pattern, just, you know, just using my meat brain. I've
722020	729260	got a big time, and a small one, larger, small, really big, smaller, etc. So I'm seeing a pattern,
729260	735580	I'm wondering, is this something I can work with? Let's look at beaconing. This is over SSL,
735580	742900	cobalt strike, beaconing, two samples. Is this even, am I going to see the kind of same results,
742900	745840	or is this just how networking works? This is what I'm always asking myself, is this
746420	751580	stuff I don't know about? I look at it, I'm kind of seeing the same patterns where I get that big
751580	756980	one and the small one, so it's still maybe, maybe it's just how it works. I do Emotet and Trickbot
756980	763820	beacons, same kind of thing. So I need to find something to show me a difference. I need two
763820	769180	samples that are alike, and I want to know if they behave differently. So benign versus malicious.
769620	774320	I downloaded this thing called existential.exe, I found it when I was looking for a benign exe
774320	780500	file. Someone wrote it to look like a malicious dropper download, which is usually pretty small.
780840	784880	You can see I get it, and I'm getting it from some site, a domain that I own.
785560	790280	And then I compared it with a malicious dropper download. I don't remember the malicious dropper,
790280	795060	but I'm seeing there are some similarities, but it's starting to be different enough that
795060	799720	I decided to explore further. So let's talk about the processes that I'm going to play with
799720	805780	and use in this. I'm going to talk about averages, Levenstein distance, and some fuzziness.
806360	813600	There's some challenges. Again, finding the parts that I'm interested in. If you have
814300	819800	network traffic, how do you find the bad stuff? I have malware analysis sandboxes at home,
819800	825300	we have them at work, we have them all available to us for free. So you can find this stuff. But
825300	831520	if you have a PCAP full of stuff, how do you find it? And there's always flows in a huge PCAP
831520	834980	file. These are the connections between all the different servers, or maybe you just do one
834980	839900	machine in all the places it connects to. So how do you separate all these flows in an efficient
839900	845860	manner and then operate on them? There are, as I mentioned, there are places we can go get stuff.
845860	849580	I'm going to use a lot of examples from malware traffic analysis for the Austin site. You can
849580	855560	download an exact, like almost a carved PCAP, sometimes there's extra data in there, but of
855560	859520	malicious stuff. And I'm going to use that for what I'm going to build signatures out of.
860460	864060	So once I have a viable PCAP, like I downloaded from malware traffic analysis,
866440	870940	like I'm going to use this ICED ID with Cobalt Strike, it's old, but...
870940	875560	Oh wait, I figured something out. Oh yeah, once I have a viable PCAP, I can use that. So
876020	879900	I'll play with the detection ideas. I'll play with the averages and I'm going to look at
879900	884620	co-integration. And once again, I'm not a data scientist. I'm going to talk about co-integration
884620	888820	and I might mess it up a little bit, but I know how to make it work in the thing, sort of. So
889820	896100	averages first. When I look at an isolated trick bot post from that viable PCAP that I download,
896100	902780	I've got 840 queries. I'll take the queries in between the transactions and I'll put them in a
902780	907160	big list. And this is basically the entire PCAP in terms of time from the very beginning to the
907160	912600	end from when it runs. And then I'll find the average. So I'll add them together and I'll
912600	919160	divide them and get the average number. So average time between is 12,748 for this one PCAP.
919320	925340	And then take another one. I've got a different set of queries. Do the same thing. And I've got
925340	932520	these averages that on their own don't look that similar. The number is 14,748 and 16,125
933000	937220	different. But I need to compare it to other stuff to see how related they might be to each other.
937480	943620	So I'll compare this against some random traffic. I take a random PCAP just with stuff in it. And
943620	948600	it's got 779 queries and I'm also taking one flow from that random traffic just to
948600	954160	add another thing. Just 32 queries. So it's not that much data. And when I look at it in
954160	957900	this context, I'm seeing that there's a little bit more of a relationship between them. And if
957900	961800	I scale this, I'm seeing even more of a relationship between them. I don't have that as an
961800	968880	example. So I'm feeling like I can continue on and explore this further.
969300	974260	I'm going to talk about cointegration as another method. So cointegration as described is usually
974760	978480	a drunk guy and a dog are walking. They're walking together. So they're co-occurring
978480	983840	with each other. But are they actually together? So there's this model to run it against them.
983840	988740	They start to move in a different direction. You can see that they co-occur, but they didn't
988740	992680	co-integrate. They're not actually together. They're just doing their own thing. Basically
992680	1000500	like that. And some little parts to describe it when I show some graphs. P-value is the
1000500	1006020	probability that the relationship between those series is due to chance. And then there's a
1006020	1011300	spread, which is the difference between the two actually co-integrated time series to show how
1011300	1016960	far they deviate from their long-term relationship with each other. Just some examples like Russia,
1016960	1025600	Ukraine searches on Google. On the spread, they were together and they separated away from the
1025600	1029860	spread, but they did it at the same time. So they're co-integrated and they stay together
1029860	1034740	basically. These are co-integrated, co-occurring things happen at the same time. Twitter and Elon
1034740	1040260	Musk around that time, I think that's around when he took it over. So they don't really...
1040800	1044980	they're way off the spread. The timelines don't match up, but they come together right at the
1044980	1049440	same time to zero on the spread right there. So there was a relationship because everyone's like,
1049440	1054360	oh, what's going on with this? And they're Googling it or whatever. And then 5G and COVID, I just had
1054360	1058540	to put this in here because people were searching it. They matched, stayed on the spread all the
1058540	1067220	time, and then they both searched at the same time. Annoying. The people... whatever. So two
1067220	1071720	identical PCAP files. If I take the same exact ones, they're going to definitely co-integrate.
1073200	1077820	Just as a test to see if I could do it, I guess you don't. And you've got... I put a scatterplot
1077820	1082320	here. The little numbers on the bottom are the times, the milliseconds. And they're on top of
1082320	1085560	each other. There's a blue value underneath the orange value. Of course, they're identical. And
1085560	1090860	the P value, which you want to be between zero and one, it's the probability value. They match
1090860	1095100	exactly. So I want to try two different PCAP files. Doesn't matter what they are, if they're
1095100	1100940	malware or not. They won't co-integrate, though. And they don't. The P value for file one is
1101620	1107620	way off. And the scatterplot is just a mess. And I'm starting to think there may be some
1107620	1112200	problems with co-integration. But there's maybe also a method to start finding similarities.
1112680	1119660	I'll try two different PCAP files with similar traffic. So these are benign. One to
1120260	1126620	DigiCert and one to Windows Update. Just some get requests. When I map them, I've got a seconds
1126620	1130400	marker. I'm using seconds here. And most of this stuff, I'm going to use microseconds. And I'll
1130400	1136860	mention this in a second. But at 48 seconds, then 50 seconds, then 53 seconds, then zero. And that
1136860	1141980	other one, at 38 seconds, at 46, rolling through time as we go forward. And the number of
1141980	1147140	transactions at those seconds. When I map them, I get similar P values, because they're kind of
1147140	1152560	similar. The timing difference is a little bit off, because one started later, one started earlier.
1153420	1159300	There are some problems, as I mentioned, with co-integration. Like the time value. I've got
1159300	1163400	this one and I've got this other one that has a huge one. I'm going to get a scatterplot or data
1163400	1167780	that the second one is going to far exceed the other one. They aren't going to match up the way
1167780	1174340	I want them to. Even if I'm doing individual flows compared against each other. As you can see,
1174340	1179160	that's what I did here. I forgot that I put the slide here. But the orange one keeps on going.
1179180	1186280	The P values are different. So short sample size. In many cases, a flow will be very minimal. So
1186280	1192380	I'm going to get something where I can't do anything with it. So let me talk about time
1192380	1199260	resolution. I just briefly mentioned I talk about this. You have to decide how much time you want
1199260	1202940	to work with. At the minutes resolution, you're not going to get much data. It's going to be
1202940	1208960	spread out one per minute. Or all your transactions in a minute. The seconds, you're going to get
1208960	1212620	some data, but it's not going to be useful. Microseconds, you get a lot more data. So I'm
1212620	1218260	going to work with microseconds. Also normalization. Because things aren't starting at the same time,
1218260	1223560	I want them to start at the same time. So I decided to make all PCAPs or any network transactions,
1223560	1228800	I throw through this to start at January 1st, 2000, just to get them to line up.
1230520	1234680	And this just sort of shows that. I don't have to really describe it, but they show
1234680	1238460	how they all start at the same time. Now, talking about signatures and
1238460	1241040	detection, where it's getting a little more interesting, where I'm starting to play with
1241040	1245180	actually building the signatures. I want to separate the flows first. I'm going to calculate
1245560	1248440	percentages. I'm going to do distance, and I'm going to do fuzziness. And I'll involve
1248440	1252780	Levenstein distance and other things. So first step to separate these flows,
1252780	1256660	as I showed before, it's a lot of flows inside network data. And if you're running this
1256660	1266200	with Daemon logger or TCP dump, writing a packet capture to file on your logging systems,
1266200	1269980	and then you're going to have tons of data, and then you have to separate those flows.
1270000	1273540	So I'm going to operate against each flow individually. This is computationally
1274720	1278980	intense. So in my code, I've made it so it's multiprocessing. At least there's that.
1279140	1283860	So when I run it, it'll just use whatever processing power you have. I'm using it on
1283860	1291200	this laptop, and it's pretty fast for a fairly large file. And so once I operate that, I get
1291200	1294880	the average time between queries and the total queries, and I also get some other data. I added
1294880	1298880	more after this point. And then I'm going to calculate percentages, because I'm ending up
1298880	1306400	with these times and these averages, and it's kind of messy. I want it to be smaller. I'm
1306400	1310760	ultimately working towards a goal of building a small list of numbers that I can make into a
1311360	1320640	So when I take those frequencies, those numbers and the times in between, and I say this time is
1320640	1325880	what percentage of the entire PCAP, I do that for the whole thing. There's a lot of zeros,
1325880	1330920	and then there's a lot of times where it doesn't. Theoretically, this whole list should equal 100.
1331080	1335820	I do some stuff to it, and it doesn't quite equal 100 after I deal with it.
1335820	1340600	But if I look at just a quick look at just this raw percentage data, I'm kind of seeing the same
1341460	1346640	traffic patterns between PCAPs. I add a little chaos. Like I said, I do some stuff to it.
1346700	1352680	I take away those zeros. I round things. This, you add it up, it won't equal 100,
1352680	1356780	but it's because I did stuff to it. But it's all in my code, which you can see.
1358480	1362000	Basically, what I'm ending up with is something like this, where I have this list of numbers,
1362000	1366880	and I'm thinking, well, this is... okay, this is something. It represents the time of a transaction.
1367420	1372160	So we can find exact matches, like the exact same thing in other PCAP data. And that's
1372820	1378500	nice, but I'm looking for variations of malware. Like when the new variant of
1379040	1384580	today's hot malware drops because the last one was burned, how do we find it?
1386300	1391140	So I look at percentages and distances. I talked about Levenstein distance, and let me go into
1391140	1396120	that a little bit more. Levenstein distance, if you don't know, it's usually used on string data.
1397820	1402960	And if you want to know how far away the word kitten is from sitting, you place that K with an
1402960	1407260	S, that's one distance. You place the E with an I, that's a second distance. You add a G,
1407260	1413500	that's a third distance. So it's three distance from each other. And I was thinking maybe I could
1413500	1419620	use this even on small bits of data and treat those numbers not like integers, but like strings.
1421000	1428160	So if we remember, I want to find this behavior, this little bad thing in this whatever thing.
1428940	1434140	So I'll create my signature, which looks like this. And it doesn't look that valuable. It's
1434240	1443560	a bunch of ones and twos and that one. And when I run it on something using Levenstein distance,
1443560	1448320	I get a number at the very end. That number going up to 100 equals the probability that I'm finding
1448320	1456140	inside a flow something that matches. But I can see there's a lot of like 58, 67. There's one
1456140	1460040	that's 100. That's the one I made my signature from. So of course it matches because it's exactly
1460040	1466520	identical. So I'm starting to get somewhere where I can maybe be a little looser in my searching.
1467660	1471760	I'm just looking at that PCAP and seeing that's the thing I made a signature from.
1472160	1475160	But I need to be fuzzier with it. I need to get a little bit looser.
1476440	1480740	There was something that was called Fuzzy Wuzzy, which is so cool, but it's the fuzz now.
1480800	1487080	So I'm using this to apply a different threshold based on the Levenstein distance.
1487260	1492140	When I run this, I'm going to get another number that's been modified. It still has the 100 for
1492140	1498940	the signature match, but it has other numbers that I'm interested in, like the 75, 67.
1499820	1505500	What are these numbers and what do they represent? So I can't remember if I opened the PCAP in this
1505500	1513190	one. Let's see. I did not. So the signature made from this flow, as pointed out before,
1513190	1517810	got these two other ones I'm interested in. If I look at one of them, I get an exact match.
1518310	1524650	If I look at another one, it's an exact match. So that's interesting. I have no match on 67,
1524650	1528830	so maybe there's a number I can pick that is my magical number that's going to find this
1528830	1533670	all of the time. There's some tuning involved, because different malware campaigns are different
1533670	1537890	with each other. I'll talk about this in the future work I'm going to work on, but
1537890	1544110	just showing tuning. I'm sorry to show you code, but basically I'm looking, as kind of described
1544110	1550330	already, the partial ratio is greater than my threshold. That partial ratio is from the fuzz
1550330	1554070	thing, and Levenstein distance is less than my Levenstein threshold. So I'm working with these
1554070	1558330	two variables, and I just have to tune them depending on what I'm working with.
1559750	1564490	And I can set that, you know, at the very top of my code. This is all in the README on the GitHub.
1566050	1575250	So if I go get two things, Darkgate activity, I downloaded one from 11-30-2023 and 12-7-2023.
1575250	1580910	I don't think I could find... I wasn't able to find newer stuff than that, just like last week. But
1584590	1590190	what I'm going to do is I'm going to carve out the bit I'm interested in from the 11-30 one
1590190	1602150	first. Let me scroll down here to post. So I'm finding this information here, this post that's
1602150	1608210	suspicious, and we know it's bad. And I'm going to save this to create a signature out of it.
1608210	1614630	So I'm just exporting just the displayed packets, saving it as Darkgate post, and then
1617330	1619850	just showing you what it looks like. It has no other flows in it,
1619850	1624970	just this one flow between these two servers. And then I'm going to upload this to create a
1624970	1632470	signature. And when I upload it, it creates a really simple... like, there's three numbers.
1632470	1635750	It doesn't seem like I can do much with that. But I'll show you.
1636770	1645290	And then when I go and I upload the same file, I want to see... I'm tuning it right now. So
1645290	1653720	I'm getting a match, of course, on my exact match. But if I look at some of the other ones
1653720	1659120	below it, I'm going to see some other additional matches here. So it's not quite tuned yet. I've
1659120	1664000	got 11 sign distance of four, my ratio is 75%. I click on the very top one, which is the most
1664000	1671520	matchy that didn't match. It's the same one. I continue down the list and maybe go to 67%
1674100	1680020	distance of four on 11 sign. And I've got another match here. So I've obviously got to fix
1680020	1684640	the thresholds I'm working with. I look at 64%. Let's see what this is.
1688100	1692860	And in this case, I'm not getting a match. So I'm starting to find the numbers I can work with.
1697800	1705960	Now, I look at this one, 67%. It's a match. And so between 67 and 64 is where I want to be. 11
1705960	1711140	sign, five or four, somewhere on there. And so I just want to adjust those values and play with
1711140	1716480	it. Then we'll try this again. So I've unfortunately got to see me carve out that part again. I'm going
1716480	1719280	to carve out a little bit different part. So it's going to create a slightly different signature.
1721040	1730120	And I think I ran it on... I think I ran it on the same one. Sorry. And I'm seeing my don't
1730120	1734600	matches don't match and my matches match. So I've got this tuned and I can start applying
1734600	1740120	it to other things. So now I'm going to upload the newest signature from 12.7. This is a later
1740120	1746680	PCAP different version, basically. And I'm looking at my matches. I'm getting similar,
1746680	1751380	different things happening in there. Same kind of post to a different server,
1752920	1762560	basically. And the... I'll show you two of them. And then the ones that are in the not matching
1763120	1768780	will show that they don't match. So I'm feeling a lot more confident about what I'm seeing here.
1769420	1773380	And I can apply it to other things. So I want to try an older signature, newer variant. This
1773380	1777300	is what I was saying. You have to watch me carve out the same thing again. But I'm going to carve
1777300	1784880	it out from the 11.30 and make a signature out of it. And then I'm going to... I'll stalk you
1784880	1792880	through it. So I open that up. I'll isolate the flow that I'm interested in. I keep on selecting
1792880	1802460	that same get request. But basically I want to follow this post here. And I'll save this.
1809170	1814430	And then upload that to create my signature. And this is where I'm going to have some different
1814430	1819990	numbers from the last one, because it's a slightly different transaction. And I want to analyze,
1819990	1825590	I guess, one from six months later, Darkgate. So I was actually able to find a newer one.
1826190	1830910	And I'm getting a whole bunch of matches. So I can review those. And I can go to the very bottom,
1830910	1837490	which is the least matchy of the matches. And... oh, actually, I guess I'm going to look at the
1837490	1843630	top one first. No matter how many times I build these videos, I always forget what I did.
1843930	1847990	But the very top one matches, of course. And I can put this... throw this in the last search
1847990	1854510	if I want to. I'll get all those matches. 169 hits. When I look at the signature,
1854510	1860150	the signature is based off this visit to TranslateGoogle.com, misspelled,
1860150	1864730	typosquatting. And the bottom one is the same kind of post to a different place.
1865410	1870030	And I'm getting 169 matches. So that's pretty cool. I thought it'd be cool to add a map,
1870030	1875550	because we all love maps. Our management loves maps. And so it's thought it'd be cool. The
1876950	1883490	red skulls are the bad locations. The unmapped things are black, because you can't... I couldn't
1883490	1888910	put an internal IP address on a map. But I try to put them in the middle of the Pacific Ocean
1888910	1893330	when they're unmapped, but there are some other ones that actually get unmapped. So I'm working
1893330	1898790	on that. Production use. This is cool that you can use... you have a web app. If you're... I've
1898790	1903190	been a SOC analyst, and I've pulled PCAPs down, and I'm like... I open it up, and I see what
1903190	1908310	actually happened once the IDS rule fired. But it'd be cool to have something like this, where
1908310	1912970	I could upload it, see what's happening, see if it compares with anything in my database of
1912970	1917890	signatures. But there's other ways to do it. For example, I was talking about the daemon logger,
1917890	1925150	or TCP dump, if you're writing packets to your disk. How do you run this on a rolling basis?
1927210	1936010	So I wrote this as a fast API thing with Flask running on top of it. So if I start this over
1936010	1941270	on the left, I'm running my fast API app. And then on the right, I have a Python script
1941910	1948590	sending a PCAP. And it sends it and gets back JSON data, and then I can refresh whatever my
1948590	1952710	sim is. It can be Elasticsearch, or anything else that you use, or want to use, and get those
1952710	1959250	matches. So that's nice, at least for a rolling PCAP. Of course, as mentioned before, the
1959250	1963250	multiprocessing happens when the flows are separated. So you want to do it on a fast machine.
1963250	1968630	But generally, machines that are doing packet capture are going to be fast.
1969850	1975330	Additionally, just because I thought it would be fun, you can use notify, which is N-T-F-I,
1975330	1981550	to notify you. So when I run this again, I can get a notification on my phone, which is kind
1981550	1988650	of cool. Kind of cool. It could also be kind of terrible. For example, you can get analyst fatigue
1989190	1996430	when I did this and got a whole bunch of stuff. So I have that on my system. But you can run it
1996430	2004470	if you want to. I'm going to talk about something completely impractical. I love doing research
2004470	2011430	because it opens my mind to new things. I get to create and build things. I feel like security
2011430	2018070	research is a creative process, and it fuels my other creative passions, like music. So I just
2018070	2023810	wanted to play around with this and see if I could do something with audio. It's not practical. But
2023810	2028890	let's just see what happens. So I like this quote a lot. Art is how we decorate space. Music is how
2028890	2034830	we decorate time. And I painted before I made things, built things to fill up the space we
2034830	2039390	live in. I also make music. And music is all based on time. You change the beat, it's completely
2039390	2045410	different. You change a note, and the length of the note is different. So they're powerful things
2045410	2050810	in their own areas. And I was thinking, while I'm playing with time, let's see if I can make
2050810	2056490	something musical with this. So you all know about Shazam, I'm sure. I use it. If I'm at a club,
2056490	2064270	I'm in the corner, like, Shazamming. So basically, if you don't know how it works,
2064270	2072340	this is what it looks like. Oh, that's not what it looks like. So you press Shazam, you hear a
2072340	2076960	song you want to hear, and then it tells you what it is, adds it to your Spotify playlist,
2076960	2082580	you can listen to it over and over again. It's great. Sorry to rickroll here. So I was researching
2082580	2089260	this. I was like, could I do this with Python and NumPy? So I found this article. I also found
2089260	2094220	something called DejaVu that someone wrote, that they wanted to make their own personal Shazam
2094220	2098920	server where they could store their music, and if they heard a sample of something,
2098920	2105160	it would play that, it would listen for the sample, or you send it to DejaVu, and it would go,
2105160	2111640	oh, yeah, that's this song. I thought, oh, I can probably do this. So I'm back to my transactions,
2111640	2116880	not the percentages, but the actual times in between, the microseconds or milliseconds or
2116880	2123660	whatever time I was using or want to use. And I'm looking at this, I'm thinking about pitch.
2123720	2130320	Frequency is the number. So zero would be a low, like a low sound, and up high would be a
2130320	2134840	high number is a high sound. So I can make audio out of this. It's not going to be beautiful. I
2134840	2140880	mean, you're going to hear it right now, what it sounds like when you listen to a PCAP file.
2141640	2148280	But there's patterns in there. Like I said, this is not practical. But let's play with this. Let's
2148280	2153840	go same malware sample, different environments. I'm going to grab my malware. I grabbed from
2154380	2161540	Malware Bazaar, agent Tesla, kind of old. I ran it in any run, downloaded the sample,
2161540	2167360	just I don't know why I downloaded the sample. I always do. And I get the PCAP. And then I can
2167360	2171500	see that it's doing a post. And in this case, I'm not going to be applying my Levenshtein stuff.
2171500	2178100	I'm just playing with audio. But I see there's a post here. And I also want to address the idea of
2178100	2181280	bandwidth. That's why I'm running this any run. And I'm also going to run it in my own very busy
2181280	2187620	network environment at home. I run it on my system. This is just a picture of one of my malware VMs.
2187640	2192140	And I've got the same kind of post happening. I'm going to have different transaction times
2192140	2198700	because of bandwidth. And I'm going to just end it. So there's a little bit of stuff here. I have
2198700	2203880	to reverse it. I'm instead going to be making a signature out of the entire PCAP, not the little
2203880	2210040	bit. So like I said, not practical. And then I'm going to play my little bit and see if it finds it.
2212020	2217840	If I open up this PCAP, let's see here. And we're looking at that post.
2220320	2225340	I've got to create an audio file from it. So I have a little Python script I wrote to
2225340	2231600	convert those frequencies into different pitches using Fourier transform and some other stuff.
2232380	2235520	And in the back, you can see there's a bunch of MP3s being made. And they all disappear. Those
2235520	2239820	are all the flows individually. And then they get combined into one big PCAP, MP3.
2241540	2247820	And then I'm left with that thing. And then I've got a carved one. This is the little tiny bit
2247820	2253060	that I want to identify in my Shazam. I'm going to do the same thing with that.
2254780	2259120	I've got that MP3 file, which is huge, by the way, compared to the PCAP, which is like 500k
2259120	2265160	or something. It's not that huge. But I've got others that are huger. I've got my carved one
2265160	2271880	here. I'm going to make the signature from this one. And you see a bunch of... it's carved,
2271880	2277640	but there's flows in there. Because I didn't carve it all the way. And I've got these two MP3 files.
2279220	2287660	Let's see. So now I'm going to try to identify it. Initially, when I try to identify, it's not
2287660	2293220	going to see it because I have to add it to a database. It's not like a clean app like Shazam.
2293220	2297040	It's just a program you can run. So I try to recognize it. It's not going to recognize my
2297040	2300880	file yet. But that's because I haven't added it. So what I'm going to do is I'm about to add it.
2300900	2305560	I've got to drop it into the signatures folder, which I'm going to do right now.
2309620	2317600	Slowly. Drop it in there. I'm going to run a script to help it identify that. So it sees it.
2317600	2324740	It's like now there's a signature for this audio file, this song of yours. And then I want to
2324740	2335040	recognize the file, just my part. And it's seeing there's a song ID recognized this traffic pattern
2335040	2338220	that I was seeing. And if I apply Levenshtein to it, which I didn't do in this example because I
2338220	2345800	don't want to bore you with more of this running commands. But it gets even more interesting.
2345800	2350180	But of course, like I said many times, it's not practical because those pcap files can grow to
2350180	2356980	huge sizes when they're mp3s. And who wants to run their network in mp3 mode? So maybe I do.
2358180	2361820	I guess I kind of talked fast. I'm kind of getting towards the end here. Supposed to go
2361820	2366820	for 50 minutes or 55 minutes. But you can go get some coffee.
2366820	2370820	So going further, I'm going to work on some third-party APIs. Like I said, I like to,
2370820	2375540	when I release stuff personally, whether that's not a work talk, I want people to be able to try
2375540	2380940	it and play with it if you want to. So you can add stuff if you want integrations with VirusTotal,
2380940	2386540	with my company's product, Investigate, or other things like that. I didn't add it. It's very easy
2386540	2392020	to add. Then you can look at things like domain, IP, reputation, relationships. If you have a
2392020	2395760	sinkhole in your environment, you can pull that data in. You can play with anything you have.
2396680	2402460	To add more things for conviction. And I'll analyze various components of the PCAPs,
2402460	2406140	so I can add that in the future. And I should probably learn Rust. I should learn something
2406140	2410380	so it's fast. Like, you know how Snort is a C binary, or I think it's a C binary,
2410380	2413760	and it uses its rules. It runs very fast streaming. I'd love to do that.
2414560	2420400	The code is available. It's a long name, but if you want, I just uploaded it about two days ago.
2420400	2424380	So hopefully it's okay. There's a couple things you have to do if you want to play with it.
2424380	2432360	But I was very, very verbose in my documentation on the README. And there's a couple utilities,
2432360	2437360	too. I added a malware traffic analysis unzipper file, because there's a password scheme. So if
2437360	2442200	you want to unzip malware traffic analysis PCAPs, you can do that. You can reach me at my website,
2442200	2447900	my personal site, which is pyrosec.com. Not a Twitter, because I just don't post.
2447900	2452940	Don't even really look at it anymore. And I'll probably rewrite all my posts with nonsense.
2453440	2457200	And Bastodon, I don't even have the app installed, but I should, because it's kind of cool.
2457200	2460280	But anyways, that's my talk. And thank you for coming.
2469280	2471620	There's time for questions, if you have questions.
2487710	2493410	Well, a lot of the time I was working in a clean environment, for the most part.
2494950	2500450	But I did run stuff over my network at home, which I know that's crazy, but I do it. And
2500900	2506840	I didn't see negative results. But my network is busy. It's not a corporate environment. I have
2507750	2517090	like 20 VMs and three or four servers. So it's busy. But I have a family, Spotify, Netflix,
2517090	2528690	YouTube. What's that? Yeah, yeah. It shows promise. I want to keep exploring it. Yeah.
2533660	2543170	Sorry, say again? No, but that's what I mentioned. I want to explore future stuff. And that's easy
2543170	2548830	enough to do. Direction, that's also good to play with. I started to play with it with a mapping,
2548830	2552870	like making the source changes constantly. So...
2553790	2561350	Oh, yeah? That's really cool. I love to talk. Yeah. All right. Thank you very much.
