start	end	text
0	4940	So thank you so much for coming. I know it's early on a Saturday at DEF CON. I talked to some
4940	8860	people last night. They're like, when are you talking? It's at 11am. I don't get up until 3,
8860	15760	sorry. So I appreciate the effort. Or maybe you're still up. So I want to move pretty
15760	19840	quickly here. I've got a handheld mic. I might walk around a bit. I don't have a lapel mic
19840	25220	because flippers and stuff like that. So we'll see what we do. But I've got a lot of slides and
25220	28900	I want to make sure I get through everything. So I've got a quick agenda that I will start
28900	33920	with. Let me quickly introduce myself for those of you who may not be familiar with who I am or
33920	40200	my work. So my name is Stephen Sims. I've been a vulnerability researcher for going on 20
40200	48680	years now. I was lucky enough early on to have computers in the house and be able to have
48680	54380	access to video gaming and all the fun things early on and using a hex editor and hacking. All
54380	58020	the things you guys have already done. So let's move on beyond that. I've sold a lot of
58020	66020	exploits over the past couple decades. I corrected myself there. I thought it was over 30 browser
66020	71780	exploits but I didn't want to fib so I went back and counted and it ends up being 29 of them.
72300	76920	Those are mostly used after free and type confusion vulnerabilities. I've always been someone
76920	84900	who sells exploits. I don't typically disclose them publicly or through other programs. I will
84900	88740	talk a little bit about that because obviously there are ethics associated with exploit sales.
88740	92640	So I'll give you my position when we get there. I found a couple kernel vulnerabilities on
92640	98240	Windows 1 RCE which you can get a lot of money for nowadays. Had I known a little bit more when
98240	101720	I sold it, it would have been better. But lots of other vulnerabilities and different
101720	104760	applications and hardware out there over the years have been lucky enough to have a lot of
104760	109600	great relationships and such. I moved to San Francisco early on in the 2000s and lived on
109600	113600	Treasure Island where we used to joke and call it Hacker Island because there were so many
113600	118360	hackers there. People from Burning Man, people from all kinds of different backgrounds. But it
118360	122620	was just a free for all and it was pretty incredible. Lots of people from CDC lived out
122620	128320	there and others and you learn pretty early on to how to properly use a handle and not get
128320	133760	yourself doxed out there. I'm also, like I said, a musician at the Sands Institute on the
133760	137420	Offensive Operations Curriculum Lead and I have a couple courses there on advanced exploit
137420	141560	development. I am one of the co-authors of Grey Hat Hacking, if you've heard of that book
141560	145260	series. We're talking right now about doing a seventh edition so hopefully that comes to
145260	150380	fruition. And then I also run a weekly stream you might have heard of called Off By One
150380	155440	Security where I do my own stream solo and I also have a lot of guests on and I've been lucky
155440	160760	enough to have some really amazing people on and that just makes it all great. I appreciate so
160760	164100	many of you have come up and say thank you for the stream because that means a lot to me and
164100	167280	that's what I do it for is to get back to the community. And if any of you are ever interested
167280	172760	in being a guest, I'd love to hear from you. All right, so quick agenda. We're going to start
172760	178220	off doing a quick history of mitigations. We're not going to cover all of them. There's dozens
178220	182360	and dozens of them so we can't get through them all but we'll touch briefly on them, kind of
182360	187440	show you where we were, where we are today. Microsoft MSRC was generous enough to get me some
187440	192280	really cool cutting edge data that has not been published yet so you'll get to see some
192280	196840	vulnerability information from Microsoft's perspective in relation to RCEs and local
196840	202120	priv and other types of bugs. Then we'll quickly go through payouts. I did a stream last Friday
202120	207700	on nothing but payouts and all the different types of buyers out there and I got a lot of hate
207700	212980	and a lot of love from that one which I expected because again it involves your morals and it's
212980	220120	very ethical considerations to have. We'll quickly look at the role of machine learning and AI in
220120	224060	general in vulnerability research because that's obviously a hot topic as of late and will
224060	229020	continue to be. And then we're going to switch over into being technical because I don't want to
229020	234580	do a talk without being technical and we'll get into looking at one specific mitigation that is
234580	239640	implemented in the Windows kernel. And my main point of wanting to show you that is so that if
239640	244880	you yourself want to understand how a new mitigation works that comes out, if you want to
244880	249360	figure out how to bypass it, how to work around it or other things or how effective it is if
249360	254340	you're a defender, you need to go and debug it. It's really the only way you can learn other
254340	258760	than taking other people's published information. So every time a new mitigation comes out I
258760	263500	love to jump in to debuggers and disassemblers and go and understand it as best I can. And
263500	269740	then we'll do some takeaways. That is the agenda. So the golden years, I'm not one, it's not my
269740	273760	right to say what the golden years of hacking is but I have been doing it long enough and I
273760	279160	remember reading, it was before my time, but I left one smash in the stack for fun and profit
279160	284400	and other papers released around that time, open wall, work that Brad Spengler was doing, so
284400	290360	many other brilliant researchers and when you, when I personally think about what the golden
290360	295360	years is, it's before all these mitigations became really effective. You'll see on a diagram
295360	300220	that I put together coming up in a moment that there are certain years where stuff got real
300220	305220	serious and it's only gotten harder and harder since then. So I would say the golden years of
305220	310620	memory corruption bugs is long over but still possible and those bugs are very valuable now
310620	316800	and you'll see that in a moment. But you see here Windows up at the top and we can go way back
316800	322280	to when trust from escape and wag that was what became Emmet or at least some of the controls
322280	326600	and mitigations there became the enhanced mitigation experience tool kit which of course
326600	331640	now today is exploit guard. But Windows it wasn't until XP service pack 2 where mitigations
331640	336600	were a thing. I remember when that dropped and admins were freaking out because it was over a
336600	341100	gigabyte update and there were a lot of new mitigations published. You can see them listed
341100	344480	there. I'm not going to go through every one of them but notable ones like data execution
344480	350620	prevention, that's huge. And in stack canaries. Linux down below, I was doing some research and
350620	355300	thankfully Brad Spengler pointed me to some great talk from maybe a decade or so ago that
355300	362240	really went through every single mitigation when it came out, the bug classes and gave credit
362240	366960	where credit is due to all the brilliant researchers and that's a really hard thing to do.
366960	371320	There's a lot of confusion when you go out there trying to find out who the original source was
371320	377520	that published a technique for exploitation or some documentation and I try my best to give
377520	383900	that credit. So the information there under Linux all the way back to 1997, I mean people
383900	389820	were thinking about security way back in 1997 especially on the Linux side of the house which
389820	396600	as expected is always first in that realm. But open wall was a big one for that one. Mac OS you
396600	401800	can see was a bit late to the game. ASLR like randomization didn't come out until like 2011.
401900	407040	That's way behind Vista even. So all the operating systems now though are at a pretty good
407040	413420	state. Some notable mitigations, this is not complete by any means. I put this together,
413420	417780	there's always possibilities, there's mistakes. A lot of times mitigations come out like
417780	423040	before the official OS release of that mitigation. You might hear well low fragmentation heap
423040	427920	that was around during XP service pack 2 or 3 but it didn't fully get implemented to replace
427920	432720	the front end heap allocator until Windows Vista. And then they got rid of the look aside list
432720	437100	except for in the kernel. So like a lot of this stuff can be fuzzy. So the arrows going back
437100	441320	that means back ported. A lot of times mitigations come out, some of them get back ported, some
441320	445400	of them don't get back ported. But you can see some other notable ones like Windows 10
445400	450140	obviously came out, control flow guard was a significant one. Microsoft was pretty proud of
450140	454340	that one and made some pretty bold claims about it. But none of these mitigations by
454340	460100	themselves are a one stop shop. They are complementary to one another. If there's one
460100	466120	weak link in the chain, if one single mitigation is not working properly or if one library is
466120	471480	not compiled to participate in a mitigation, it breaks the whole thing. So it can be
471480	476920	difficult to get all of them there. I usually put up a Venn diagram that shows overlapping
476920	481640	circles where you've got different categories of mitigations like those enforced by the
481640	486700	operating system, those enforced by the compiler, those enforced by a tool kit like exploit
486700	491560	guard or malware bytes or whatever you might be using. And if you get to the merged areas in
491560	495620	the circles, you're taking advantage of multiple categories and that's where things become
495620	500100	much more effective. Because depending on the type of exploit you're using or you're
500100	505460	writing, a mitigation might not even matter. For example, font protection. Like they
505460	509520	introduced font protection because I think it was Dooku or Stuxnet, it was a font based
509520	515100	vulnerability. It was a sign extension bug and it affected the Windows kernel and was a
515100	521800	brilliant exploit. That font mitigation just says you can't use any fonts unless it's in
521920	526740	a system 32 fonts folder. So no third party fonts to come along. But obviously that only
526740	532120	targets a very specific thing. So some of these mitigations don't matter when you're
532120	537540	exploiting things. So this is not something we're going to walk through. It's a pretty ugly
537540	542540	slide but it's something you can take a picture of. All it's showing is that with all of those
542540	548260	mitigations and that was not comprehensive by any means, it's a cat and mouse game where
548260	555020	you've got a mitigation that comes out due to a bug class or an exploit technique. For
555020	561100	example, look at arbitrary code guard or export address table filtering. EAF specifically
561100	568300	targets shell code and how it accesses the exports table inside libraries like kernel 32. So
568300	572800	they target very specific things and it's that cat and mouse game because when a new exploit
572800	577960	technique comes out or a new bug class, a mitigation goes in to try to kill it. And then a
577960	582740	workaround comes out and then they update the mitigation. A perfect example is back in
582740	587720	2014 and I was just hanging out with Corlan Coder like a week ago in Amsterdam at a hack
587720	592720	fest that we had out there. And he and I have something very in common with each other.
592720	597060	Actually I'll show you in a diagram coming up very soon. It might be the next one. It is the
597060	602760	next one. So this is the last version that Microsoft published outwardly that I've seen
602760	607620	anyway from Matt Miller and other folks at MSRC. And you notice it only goes up to like
607620	614660	2013 or so. Or 2015, 16. I can't even see it. But what I want you to look at here is, and
614660	618700	unfortunately I don't have a laser pointer on this thing, but look at the gray area to the
618700	624300	right side and see how it's a very wide gap. And then all of a sudden after that it shrinks
624300	630200	down. The reason that happened is because Microsoft in 2014 introduced a couple
630200	636780	mitigations that really killed specific types of bug classes in the browser. Like type
636780	642740	confusion, use after free. I brought up Core Lan Coder because he and I both were writing quite
642920	649240	a few exploits per year against a browser and then all of a sudden in June, July 2014 they
649240	654220	stopped working. The exploits stopped working. Because they put in deferred free, isolated
654220	659460	heaps and then MemGC came shortly after. And I remember even seeing people like Skylines who
659460	665420	was releasing lots of vulnerabilities or selling exploits or disclosing them, saying one
665420	669840	time in a tweet, hey does anybody have a MemGC bypass? I'm literally sitting on a bunch of
669840	676080	edge vulnerabilities that I can't exploit. So that's the job of the OS developers who work
676080	682080	with mitigations is to identify and understand a specific exploit technique or bug class and
682080	688460	try to kill it. Deferred free or MemGC I should say is so effective because it does
688460	694320	validation of references. Microsoft used C++ smart pointers to do dynamic tracking of
694320	699340	objects and reference tracking and the way in which they chose to track references allowed for
699480	704560	a certain type of exploit to be quite possible. So by adding the MemGC control in deferred
704560	709560	free, there's validation going on to make sure that there are no other references to the
709560	714060	object that's about to get freed before giving it back to garbage collector for reuse to get
714060	719700	recycled. And that's why it shrinks down so much. So Microsoft is very kind as I said
719700	726020	before in getting me this diagram and the next one. This one is remote code execution CVEs by
726020	731180	patch year. So you have to imagine that the majority of CVEs that come out are privately
731180	735820	disclosed. Meaning that there is no public exploit code. And that's why there's a lot of
735820	742000	exploit framework vendors out there like Rapid 7 with Metasploit and Core Impact and
742000	746940	Immunity Canvas and Saint. There's all these different frameworks and what they want to be
746940	754280	able to say is we have the most exploits for privately disclosed CVEs. Because if you're a
754280	759180	red team or some other offensive group and you want to be able to break in obviously to
759180	766500	targets, most companies are terrible about patching. So if we can get some really smart
766500	771360	people to do things like patch diffing, identify the delta in the code and weaponize
771360	775760	these end day vulnerabilities, then we're going to have a much more valuable framework
775760	780600	because we're able to allow you to exploit things that no one else can. I would say close to
780600	787940	like 90% of CVEs are privately disclosed. No public exploit code. So that is absolutely a
787940	792800	profitable business to go and write or weaponize end day vulnerabilities. Because again
793160	796800	organizations are terrible about patching. But you can see we're not going to walk through all
796800	800360	the data. I'm going to tweet this afterward and the slides obviously will come out. But this
800360	805160	is great stuff to use internally with your teams and your threat intel folks and SOC and
805160	810420	everyone else to say hey these are some things we should be considering. How effective are
810420	814700	the mitigations? What bug classes are the most popular right now? And this specifically is
814700	821640	for RCE. And you can see the number in the middle. The next one here is overall CVEs by
821640	826900	patch here. So this is not just memory safety or if you go back to that initial slide that I
826900	832040	had up that was all memory corruption for the most part. All of it. And I remember some patch
832040	839360	Tuesdays there would be like 50 patches coming out for Internet Explorer and Edge alone. It
839360	843180	was a serious problem and they had to solve it with these mitigations and did quite an
843180	847400	effective job. But this shows you memory corruption if you look at the left that's the
847400	851740	big green one in the middle and if you look to the left it's getting less and less and
851740	856620	sometimes it gets bigger and smaller but that is happening because obviously secured
856620	861500	code initiatives, introducing rust into the kernel to protect critical components, the
861500	866640	mitigations being very effective, that is what changes the trajectory here. And you can see
866640	870920	things like deserialization and other types of bugs start to pop up and get more popular.
870980	875680	Again, cat and mouse game and we're always trying to find new ways of getting in. So how
875680	879280	mitigations have affected payouts? I'll quickly go through this one because again I want to
879280	883700	make sure I have enough time. And if you want more information on this if you go to the
883700	888240	off by one security channel on YouTube look at last week's stream I spent like two hours
888240	893560	almost talking specifically about this process. But quickly going through there are
893560	898140	different categories of buyers. You can always go to the vendor themselves like Microsoft,
898140	902840	Google, Apple and they will pay you. Some companies have bounties, some don't. But they
902840	907380	typically don't pay as much as third party buyers out there depending on where they sit on
907380	912900	the realm of ethical boundaries. But they'll pay you and it's gotten better. Then you go a
912900	917160	little bit further. Okay, we can go to ZDI, the Zero Day Initiative or go out to CanSecWest and
917160	922000	participate in Pwn2Own or Bug Crowd, HackerOne, iDefense which I don't think are buying
922000	926900	exploits anymore. But those are third parties who do work with the vendor and they get it
926900	932440	patched. The exploit code never goes public. When you sell an exploit it's no longer your
932440	936880	exploit. Typically they don't pay you. The money gets put into an escrow and you have to wait
936880	940660	to get paid because they want to make sure you're not trying to double dip and sell it to
940660	945340	multiple buyers out there until you build up a good trust. So we go out further and I'm not
945340	949040	going to name any names because they get mad, but there are all kinds of different third
949040	954440	party buyers on behalf of different intelligence agencies and governments around the world.
954900	959660	Believe me, I've sat with them many times and they are looking for bugs from you. Now you
959660	963760	typically don't go knock on the front door of the NSA, I don't advise that, but there are
963760	969520	third parties out there and they will pay more than the below ones that we just talked about.
969520	974100	How much? We'll talk about some money here in a moment. You go further than that, there are
974100	979860	these third party companies that are exploit acquisition companies that refer to themselves
979860	984100	as crowd fences, a relatively new one, you heard of Zerodium, I don't think they're buying
984100	987940	anymore, they used to be Voopin. And there's Voln Point, I don't know anything about Voln
987940	994800	Point, but there's some hefty amounts of money that you can make there. Millions, I think up to
994800	1000760	9 million US dollars for an iOS bug. I mean full chain, obviously, it's got to be all the
1000760	1007240	things. And then you've got kind of the most unethical place you can go, which are random
1007240	1011100	people. This is where you've got to be really careful because you don't know who you're
1011100	1014820	selling to and you don't know who they're selling it to. You don't know who the buyer is.
1015080	1020480	But this could be over Tor, Telegram, people, if you start getting known for selling exploits
1020480	1025180	or having the skills to find zero days and weaponize them, especially in today's climate
1025180	1029700	with how hard it is, they will find you. But you've got to be really careful when you're
1029700	1034240	selling this stuff to protect you and your family and other things. I really, again,
1034240	1037880	recommend watching that stream if you're interested in that space because I go into some
1037880	1043820	good detail about that. So examples of how much you get paid for some of this stuff. Now,
1043820	1049180	this example is one for me personally. I've always sold things. I don't sell to unethical
1049180	1053500	buyers, though. Personally, that's my choice. Yes, you get paid less, but that's, you know,
1053500	1061180	your choice. So someone like iDefense or ZDI, back in 2014, before those mitigations I told
1061180	1065900	you about dropped, you could expect to get $10,000 to $30,000 US dollars for like a USAPTA
1065900	1071940	free exploit. And back then, you typically didn't need a big chain. Maybe one exploit or
1071940	1076680	two, like an information disclosure bug to bypass ASLR if you needed it. But if anyone
1076680	1083500	remembers, and I'm sure some of you do, JRE6, the Java Runtime Environment 6, MSVCR71.DLL.
1083500	1089480	That made me a lot of money because they didn't add dynamic rebasing to that module. And it
1089480	1093920	also had all the gadgets you need to get around data execution prevention. So it's a
1093920	1099580	beautiful thing. So if you found one remote code execution, USAPTA free against the
1099580	1104120	browser, that's all you needed. There was no sandboxing on Internet Explorer Edge back
1104120	1109640	then. And so you could expect to get paid that amount. But now it's a lot harder. On the
1109640	1116480	more unethical side of it, you can expect to get paid 10 to 20 times more. So you can see an
1116480	1121640	example there from CrowdFence. They say offering up to $400,000. That's straight from the
1121640	1129360	website. Another example is iOS. Zero click. Apple created something called Blastor to try to
1129360	1135480	triage text messages coming in to make sure code execution isn't occurring. It's going to be a
1135480	1141260	lot harder to jailbreak or root that phone because of Blastor. So you got to have like 4 to
1141260	1146720	6 zero days chained together at least. And it's not one person out there doing this anymore.
1146720	1152760	Back in 2014, you and yourself could find enough to get around all the things and get code
1152760	1157280	execution. But nowadays, especially in the kernel with HVCI and other cutting edge
1157280	1161700	mitigations you could say, it's hard. The execute primitive is gone. You get read write
1161700	1165160	opportunities but even that can be challenging with code signing and all kinds of other
1165160	1170640	things. But that is why the price tag goes up so much. So you can see 2014, I remember
1170640	1175640	Zerodium was offering up to $2 million, $2.5 million for iOS and Android full chain zero
1175640	1182480	clicks. Now you can get up to $9 million with VulnPoint and CrowdFence I think I saw. And then
1182480	1187320	this example here, if you've ever seen Operation Zero, it literally says on the Twitter page,
1187320	1193080	on their home page, the only Russian backed exploit acquisition program. And it literally
1193080	1199620	says, we are non-NATO friendly. But $20 million U.S. dollars, you could retire. That's
1199620	1203560	amazing. But look who you're selling. You are literally doing treason at that point. I'll
1203560	1207900	stop saying literally. And they will use that to attack your country. So I don't know if you
1207900	1213160	want to be in that position, but it's an option for you. So we'll jump now into machine
1213160	1219620	learning for vulnerability research. This one is one that I have a lot of interest in
1219620	1227820	because it saves you time. You already know, but automation and machine learning, or the
1227820	1233620	umbrella of AI in general, are things that aren't going away. And we don't want to fight it, we
1233620	1240400	want to leverage it and use it to complement our skills. If you fight it, you will lose. When
1241080	1247420	chat GPT was made public, I think it was November or December 2022, shortly after that
1247420	1254060	spring, I believe, Project Zero started an initiative, of course, to go and see how AI in
1254060	1259340	general, machine learning, can help with vulnerability research, specifically for memory
1259340	1267440	corruption bugs. If you remember a long time ago, DARPA, back in like 2016, they had a
1267440	1272780	challenge. And they paid, I think, 2 or 3 million U.S. dollars to the winning team, and the
1272780	1279580	challenge was, we want you to write basically machine wars, automated hacking, automated
1279580	1283100	detection and defense, where the machines are fighting each other, almost like a capture
1283100	1287940	the flag. And back then there was a lot of universities looking into very basic exploitation
1287940	1293040	techniques, like stack overflows. That's a pretty easy thing to weaponize. Okay, the buffer
1293040	1298780	is overrun and you overwrite a return point, that's very basic. So it's not so hard to write
1299400	1305080	something that will do that for you automatically. But when you're getting into harder bug
1305080	1310260	classes, I gave a couple examples, like type confusion, those are difficult to find. Static
1310260	1314620	analysis, dynamic analysis, manual code inspection, it doesn't matter. Those are tough to
1314620	1321200	find. Because as a developer, you can't possibly get your code into the context or every
1321200	1326520	possible situation where it might be run. Different libraries, different patch levels,
1326520	1331360	different things people do to their computers, a developer can't anticipate what that code
1331360	1336920	might run into in the future. So these vulnerabilities manifest thanks to things like C++.
1337420	1341420	A lot of people ask, well, why aren't we already on Rust? Why isn't the Windows kernel
1341420	1348040	rewritten entirely in Rust? I can't answer that 100% but I can give my opinion, which is,
1348040	1359740	wow, theirs is louder than mine, that's amazing. All right, okay. Cutting me off. So Rust,
1359740	1365100	remember when H.D. Moore and the Metasploit team, they were on Perl early on? Metasploit came
1365100	1369980	out in 2003. And at one point they said, we need to get off Perl because the language wasn't
1369980	1373820	growing at the same pace that they needed it to. And so they were going to choose between
1374520	1380520	Python and what's the other one? Ruby, right? And they chose Ruby. And I remember talking to
1380520	1384780	H.D. Moore at DEF CON a long time ago and I believe it was the Ruby developers were willing
1384780	1390760	to work with that project because it became the largest open source Ruby project to improve
1390760	1395400	the language to meet the needs of the developers. So the language developers working with the
1395820	1402760	framework. I imagine it's a similar thing where C++ has been around for a long time. It's very
1402760	1407860	mature, it's very powerful. So a couple things you get from that. You've got developers with
1407860	1412900	decades of experience who can't just overnight over to Rust and you've got limitations in the
1412900	1419120	language that might not allow it to do the things that C++ can do. And yes, Rust is mimicking
1419120	1423580	like low level behavior with the speed and the power of being able to directly manipulate
1423580	1429660	processor registers and memory, but unsafe languages tend to be extremely powerful. So
1430660	1434720	it's those memory corruption bugs, they're difficult to squash and it's not going to be
1434720	1438520	overnight where we replace everything. But it is slowly happening. I believe the first thing
1438520	1442860	you saw in the Windows kernel was Win32K.SysDriver. Some implementation of that got put
1442860	1447260	over to Rust. So anyway, from a high level, because I can't really go into what Google is
1447260	1451160	doing at Naptime, I read the paper, that's what they called it, was Project Naptime. And I
1451160	1455160	have been working on a similar thing, but as a single person, so they've got a team of people.
1455160	1459820	I've also talked to multiple other teams out there who are doing the same thing. And that is,
1459820	1465680	how do we create agents, different agents that serve different roles, they do different
1465680	1471540	things. Because just like humans, if you try to give AI in general, and again that's an umbrella
1471540	1477380	encompassing term for everything underneath it, if you ask a single agent or LLM to do
1477820	1482200	everything for you, it's not going to do a great job. But if you break it down, just like
1482200	1487860	humans, don't ask one developer to go rewrite Microsoft Office Suite, that's too much. Break
1487860	1491500	it down into different groups, different agents and roles, it's going to be a lot more
1491500	1497580	possible. And the gist of that, they did make some really impressive progress and they're
1497580	1502680	going to continue working on it of course, but said, as it quotes on the slide, there's still a
1502680	1506140	long way to go. We're not going to be replaced any time soon because there's so much nuance
1506680	1513260	that it can't have, like humans can have, the way we think. It'll get better of course. But
1513260	1517440	going into that a little bit more, this is an example of something called crew AI, if you've
1517440	1522640	heard of that, there's multiple frameworks out there for such, open source, and it has this
1522640	1526700	concept of the agents and these roles that things serve. So you can see on the right, we're
1526700	1531840	saying we want you to be a threat intelligence analyst, this is what your job is. And you feed
1531840	1537460	it information, it uses rag and other cool technology to ingest all kinds of threat intel
1537460	1543960	data and other, and then it does a thing. And to put that in like a chain, you've got over on
1543960	1549680	the left, like an agent that is the threat intel agent, and it's ingesting things like PDF
1549680	1554500	documents and just threat intel data, everything it can get its hands on. And then the result
1554500	1559280	of that, the output, like the list of MITRE attack TTPs as an example, because everyone
1559280	1564320	knows that one, gets fed into two other agents, one's the red team side and one's the blue
1564320	1569820	team side. One's doing detection engineering and generating Sigma or some kind of other
1569820	1575360	rules out there, and the red team side is using it for continuous automated red teaming and
1575360	1579320	pen testing. So they're consuming and ingesting the same data, using it for different
1579320	1583860	purposes. A lot of companies are getting into this now, a lot of managed socks out there are
1583860	1588100	doing exactly that. Here's your Yara rules, here's your Sigma rules, whatever, from it.
1588880	1593200	This is a pretty ugly slide, but it's one that I put together because this is what I'm
1593200	1598740	working on personally and I have been for some time now. I am not anywhere close to where I
1598740	1603140	want to be, and if Google's not getting the best results in the world, like meaning it can
1603140	1608440	replace humans with VR or the other way around, then I'm certainly not going to be able to do
1608440	1613760	it alone. But I have made some good progress, which is I feed into an LLM all the different
1613760	1620200	CVEs, all the project zero or other public research out there, all GitHub, anything I can
1620200	1627720	feed it around exploits and patch diffing, binary diffing and all that data. So one thing I
1627720	1633520	do a lot is end day vulnerability weaponization. I download on patch Tuesday unless I don't
1633520	1638340	have time. You get used to looking at this stuff, you look at all the CVEs, you look at the
1638340	1643540	knowledge base articles, you try to figure out which ones are most likely exploitable. You
1643540	1647060	probably still wrong, and you learn a lot, so you have to keep telling yourself, because it's
1647060	1651080	very frustrating when you spend two weeks looking at a patch vulnerability that you realize
1651080	1656960	you cannot weaponize, because of mitigations or some other factors. Because even if a
1656960	1662540	mitigation can 100% stop a vulnerability from being exploitable, they're still going to
1662540	1670540	patch it. Because what if somebody turns a mitigation off? It's a good habit to clean that
1670540	1675320	stuff up. So when you do a patch diff and you look at the delta of the code, use
1675320	1682000	something like diaphora or bin diff, and you take a look at the changes at the function or the
1682000	1688080	code level, you can give that information to the LLM and teach it how and why it's a certain
1688080	1693000	type of vulnerability. And then the output from that can go into the next agent, which is
1693000	1697900	really doing the patch diffing for new vulnerabilities that got patched. So it's taking
1697900	1702680	the patch, it's extracting it, or grabbing it from Winbindex, doing the diffing, and it's
1702680	1708480	looking at the delta. And it's knowledge of all the prior diffs that it has learned about and
1708480	1713700	all the information about exploits that are public or private. It's using that to make a good
1713700	1719400	guess as to what most likely is the vulnerability type. And then we have a corpus
1719400	1724200	generation agent, which is trying to generate trigger files that you can then feed to
1724200	1728360	whatever it is and hopefully trigger the vulnerability. And then of course you would have
1728360	1734120	to go in and see if you can actually weaponize it. So it's automating the process of binary
1734120	1740300	diffing and trying to find where the bug is and trying to help you generate malformed
1740300	1744800	documents or whatever you need to send to the target to try and get it to crash. I've got this
1744800	1750500	working pretty good, it's not great, but it's saving me a ton of time. I would say probably
1750500	1757500	like 10 to 20 times it's saving me on that research effort, which is pretty damn good for me
1757500	1761660	anyway. So understanding how mitigations work, we're going to jump into the more technical
1761660	1768000	part now. There's so many mitigations, so I just chose one random one. And also on my
1768000	1772380	channel I do a lot of exploit mitigation reversing, if you're interested in that stuff,
1772380	1777380	there's videos on that. But a lot of these mitigations, especially the more classic ones
1777380	1783020	that came out with emits and the initial exploit guard, what they do is they will hook
1783020	1787580	something. So for example, there are things called critical functions on Windows. Critical
1787580	1791700	function of one type will be any function that can change permissions in memory, like
1791700	1797060	virtual alloc, virtual protect, heap create, write process memory, those are critical APIs.
1797200	1801980	So we want to monitor those. So if we understand things about different bug classes out
1801980	1807160	there and different ways in which people exploit vulnerabilities, then we can hook the
1807160	1812080	flow of execution and before we allow the function to be called that will in fact change
1812080	1817380	permissions in memory, we inspect it. And they can do that, you could do that by overwriting
1817380	1821560	an entry in the imports table, so when it calls that function where it's linked, it'll
1821560	1826540	actually call your code first, or more likely they're going to hot patch or put a patch in
1826540	1831420	the very beginning of the function entry point, and it will first jump to another location,
1831420	1835640	execute some code, typically points into something called payload restrictions dot DLL,
1835640	1840460	and it evaluates the environment to make sure things look good. I'll give you one simple
1840460	1845160	example, if you've heard of stack pivoting before, Microsoft had the blue hat challenge,
1845160	1851360	and that was 2012, that was a long time ago, but they paid over a million dollars U.S. to
1851360	1856980	the first place winner, and then they had three places, first, second, third, and what they
1856980	1861700	were looking for is help from the community to stop return oriented programming. And one
1861700	1866780	of the main things that we would do in use after free exploits on browsers, is we would
1866780	1871720	pivot the stack pointer out to the heap, because the stack pointer is a register that only is
1871720	1875360	supposed to point to the current thread stack at the top of it, let's not get into speculative
1875360	1879580	execution and such, but you know what I mean, and we like the stack pointer because of three
1879580	1884120	powerful instructions, push, pop, rep. That's the only register that those instructions
1884120	1890480	exist for. So that power, we want that in other places in memory, so what we would do is use
1890480	1895140	an exchange gadget and it would exchange or pivot the stack pointer with another register
1895140	1899320	like the accumulator register. That would make it so the stack pointer points out on the
1899320	1904340	heap somewhere, where maybe our ROP chain is, our exploit code is. So great, it works. So
1904340	1910820	anti-ROP, which came out right before Blue Hat, was on Windows 8, all it did was it looked at
1910820	1914940	something called the thread information block at the stack boundaries, the stack high and
1914940	1919860	stack low limits, to make sure that the stack pointer points where it's supposed to before
1919860	1925500	allowing a critical API to be called. Very simple thing and it was very easy to get around, but it
1925500	1930740	showed you Microsoft was taking return oriented programming seriously. And then after that a
1930740	1936960	whole suite of mitigations came out, like 6, 7, 8, simulate the execution flow, just many
1936960	1943340	others. So again, a lot of these hook and then they inspect and you move on. Not all of them
1943340	1947760	though, some of them are enforced in user LAN, some of them are enforced in the kernel, and
1947760	1954700	other factors. So let's look at one more closely. So create process, a little C++ program I put
1954700	1961240	together, lifted code of course too, and all it does is it calls create process. There was a
1961240	1968220	mitigation that Microsoft came out with called, do not allow child processes. And that was
1968220	1972900	called the calculator killer, because obviously a lot of times people would use shell code to
1973040	1977360	pop a calculator to prove that it worked. Well this mitigation would kill that and prevent it
1977360	1982560	from happening. So a lot of times if you're exploiting like Microsoft Word or a browser or
1982560	1988320	anything else, you want to create a new process. This mitigation would stop you from being able
1988320	1994380	to do it. So when I first saw the mitigation, I just assumed that it hooked create process in
1994380	1999060	user LAN, somewhere around NTDLL or something, it grabbed it, and then payload restrictions
1999060	2003000	would just inspect it and it would just prevent you from being able to do it. But this one
2003000	2009200	ended up being a kernel in force protection. So first off, this is the code, you compile it, and
2009200	2024400	great, simple. When you run it, so I'll make sure this seems to be acting weird here. All right,
2024400	2029260	there we go. So when you run it, you can see on command line right there, a calculator pops up.
2029420	2033760	Exciting, right? But that's what it's job was. That's what it was supposed to do, is just pass
2033760	2038060	in an argument and it executes and creates a process with that argument. Simple. Then I go
2038060	2043880	into exploit guard, that's a little snippet on the top right, and I turn that specific
2043880	2048400	mitigation on. You can see there's audit mode and then there's enabled mode, and I just
2048400	2052440	enabled it. And then when we try to run it, you can see the command prompt in the middle, it
2052440	2057700	said create process failed. Okay, the mitigation is working. Down at the bottom, you can see
2057700	2062520	that as a defender, you want to watch these things. So here's one thing, I'll take a step
2062520	2067320	back. A lot of administrators are afraid to turn on these mitigations, the ones that aren't
2067320	2072300	turned on by default by Microsoft. And Microsoft's kind of in a catch-22 situation because if
2072300	2076000	they turn all the mitigations on that are available, they might break your applications.
2076040	2080360	Because some of your developers have to adhere to the way in which these mitigations work.
2080360	2084180	But if they don't turn them on, then you're mad at them because they didn't protect you. So
2084180	2088600	they're kind of in a bad spot. So they wait until things are mature enough. A perfect example
2088600	2093340	would be shadow stacks. If you've heard of shadow stack, it's a relatively newer mitigation
2093340	2098900	though not in theory. Early 2000's someone mentioned the idea of that. It creates a copy of
2098900	2107200	return pointers and it requires at least an Intel Tiger Lake CPU. So obviously not everybody's
2107200	2111080	running one of the newest processors and they're not just going to turn that on by default. So
2111080	2115520	they have to wait. So a lot of these, you do have to go on and turn them on. I remember
2115520	2120100	Microsoft released a paper a long time ago and said the adoption rate for the enhanced
2120100	2126560	mitigation experience tool kit, Emmet, was under 5%. So under 5% of organizations were
2126560	2132160	actually using Emmet in any way shape or form. Because the admins maybe don't understand how
2132160	2135800	the mitigations work at a very technical level and they don't want to do the screen test.
2135800	2140220	There's also performance hits associated with these mitigations. One nice thing you can do
2140220	2144500	though is turn on that audit mode. It's almost like an intrusion detection versus intrusion
2144500	2150420	prevention where it tells you about a potential problem but it doesn't actually block it. So
2150420	2154620	you've got the power to do that and then you can look in the event logs. There's a specific
2154620	2159480	event log area for user LAN mitigations and kernel LAN mitigations. And that's what you're
2159480	2164420	seeing at the bottom there. When I ran that program to execute the calculator, that new log
2164420	2169300	popped up that said a mitigation was blocking it. That's right there what told me it was
2169300	2175900	kernel enforced. So looking at the NTOS kernel here, when I set a break point on create
2175900	2181540	process and let it continue, it went straight into the kernel. So it told me right there,
2181540	2186320	validated that this is not a kernel, sorry user LAN enforced mitigation. So I went into
2186320	2192500	hex, I used hex rays obviously and I used wind debug and went in and set some break points on
2192500	2201020	those functions right there. Like PSP get no child process restricted policy or SC token is no
2201020	2206180	child process restriction enforced. These are by symbol name because thankfully Microsoft
2206180	2211180	gives us the symbols, the PDB files. We can go and look for things that look like they might be
2211180	2215440	associated with the mitigation that we're curious about. So I set the break points on there
2215440	2221700	and then we run it, it immediately gets hit. But look where it gets hit. It gets hit when I'm
2221700	2228160	in the command prompt trying to start that C++ wrapper program, the create process program.
2228360	2234060	Because that's the program we turned exploit guard mitigation on in the settings as you saw
2234060	2240980	in the last slide. So it makes sense. So we hit a break point on the setting API, the one that
2240980	2245500	sets the mitigation. Over on the right there, if you're not familiar with the Virgilious
2245500	2250760	project, it's everybody I know's go to if you're looking at kernel structures. It is a
2250760	2255720	brilliant resource and every single Windows version, kernel version, every build, every
2255720	2260080	creator's update, whatever, is tracked there. Because a lot of times when you're doing
2260080	2264680	things like token stealing in the kernel, you need to make sure that your offsets are
2264680	2269740	correct. There might be a structure like E process or K process, K thread, E thread and you
2269740	2274160	need to make sure that what you think like AP links at a certain offset is still there
2274160	2277840	depending on the kernel version. So you can look at these structures, look at the members
2277840	2283600	and you can update your shellcode accordingly. But either way, I saw an instruction and you
2283600	2289140	can see in the code in the top middle, in the white area, it says move into racks, GS
2289140	2295020	segment register, offset 188 hex. So the GS register, while under the context of the
2295020	2299160	kernel, points to a structure called the kernel processor control region, a very large
2299160	2303940	kernel structure. And nested inside of that is something called KPRCB, the kernel
2303940	2308320	processor region control block, which is a mega structure. What it's telling us at
2308320	2314380	offset 8 within that nested structure is what we're dereferencing. It ends up being the
2314380	2320320	K thread pointer. K thread and E thread and K process and E process are kernel things. If
2320320	2324940	you've ever heard of the process environment block in user land, the PEB, E process is
2324940	2328140	like the equivalent in the kernel. If you've ever heard of the TIB, the thread information
2328140	2333260	block, K thread, E thread, the executive and kernel thread, those are the relative entries
2333260	2337860	in the kernel. Not 1 to 1, but it's pretty close. So either way, we're dereferencing and
2337860	2344080	grabbing the K thread pointer for the current thread. So let me go in further and we're
2344080	2349080	checking out our progress here. You can see that I run this fancy window bug command and
2349080	2352980	we're basically saying, what is our current process? And it tells us that the current
2352980	2359280	process is the, uh, which one, command.exe. That's not the process I want to be in. So we
2359280	2363720	let it continue. We hit the break point again and then we look at the current process and now
2363720	2368420	we're in the create process C++ program where we want to be. So now we know where we want to
2368420	2371940	be, where we're at, where we want to be. It's important to mention that because when you set
2371940	2376760	these types of break points, they will get hit often unless you set process specific break
2376760	2380680	points as a kernel debugging session. So you want to make sure you understand what context
2380680	2387020	you're under for each, you know, process. And then we hit our break point on the SC token
2387020	2392600	set no child process restricted function. So this means that we're under the context of the
2392600	2399220	create process C++ program and that mitigation function has just been called and it says set no
2399220	2405740	child process restricted. So you go into hex rays and you decompile it and you say, hey, let's
2405740	2409100	take a look at this function and that's what you're seeing on the right there. I know it's
2409100	2413460	kind of small, again slides will be released. Put some circles around some variables because
2413460	2417460	we don't know what those variables are. Thankfully we get symbols from Microsoft.
2417460	2422300	Thankfully hex rays and IDA pro are brilliant, it's a brilliant disassembler and we get the
2422300	2426500	function prototype data. As long as you know what the structure is, you can say, hey, I know
2426500	2431580	this is a token structure because MSDN told me on the left, on the top there. And then once you
2431580	2438420	do that, you see that it's able to then go in and add all the symbols, define everything that
2438420	2443580	you want to see. On the right there, I did a stream a while ago on documenting undocumented
2443580	2449260	structures and it was all about looking at different bit masks in the kernel and E process
2449260	2453720	and the token structure to understand what the mitigation bits are and to show you kind of how
2453720	2458900	to do that. This is a reference from Google that shows us that these different bit mask
2458900	2463660	numbers, you'll see lots of booleans like ands and ors and those are either turning on or
2463660	2468280	clearing bits in the bit mask so that the mitigation flags are set to the state that they're
2468280	2472660	supposed to be in. So I went through here and I added a bunch of comments because obviously
2472660	2476980	it's helpful especially if you're not used to debugging or disassembling and decompiling
2476980	2481980	kernel structures. But that defines everything that's happening. Basically we're getting a
2481980	2486740	token or acquiring a lock on the token. We're initializing a variable which ends up being the
2486740	2491680	token, the current token. And then we're going in and we're checking bits that are set in the
2491680	2497860	bit mask. And these bit masks bits are things like, is it in audit only mode? Should it be
2497860	2502920	turned on and enforced? Is the low box token thing associated with it? What setting should I
2502920	2508300	do? And through the boolean operations it turns on the appropriate bit which then sets the
2508300	2514000	mitigation on. That is pretty much how that mitigation works and that's why it's being
2514000	2519440	blocked because the next thing that would have happened had we kept going, the get function
2519440	2523800	would have gotten called and it would have checked that bit to see if that program has the
2523800	2528640	authority to spawn a new process. So that's kind of what we learned by going through that and
2528640	2533120	that's how easy it can be to understand mitigations to see if you can get around them. So from
2533120	2539200	that you're like, well then can I get around this somehow? Obviously the first thing you want
2539200	2544440	to do is Google, go to chat GPT or your favorite AI LLM whatever and say, hey can you tell me
2544440	2548500	about any bypass techniques that may be publicly available? But if there are no publicly
2548500	2552420	available ones, hey you've got a great opportunity to do some cool research and make it
2552420	2558440	public if you can find something. Some examples down there towards the bottom, there was a
2558440	2562420	technique, I forget who discovered it but I put the link there where you can impersonate the
2562420	2566360	anonymous token to get around the mitigation and spawn a new process. I don't think that
2566360	2571840	still works but it was an option. You can use WMI like if you're in the context of Microsoft
2572820	2577780	Office and you can use some cool PowerShell or WMI to get around the mitigation that way.
2577780	2582000	There's process migration potentially, you can use reflexive DLL loading where you load
2582000	2587800	from memory, something into memory. That also gets you around other mitigations like CIT,
2587800	2592880	ones that are preventing you from loading an unsigned DLL from your Windows box. And
2592880	2598660	again, setting it accordingly, enforcing the protection and getting around it with things
2598660	2601960	like reflexive DLL. So, there's a bunch of ways we could potentially get around it and
2601960	2606200	that's why it's so important that you put a bunch of these together. That you're not just
2606200	2610880	relying on any one mitigation. I remember Microsoft made a pretty bold claim, somebody
2610880	2616800	there, said CFG, control flow guard, should be a strong enough mitigation that it can
2616800	2622440	prevent the majority of exploitation techniques where Emmet may not be needed as much. That
2622440	2626080	ends up not being entirely true because CFG is another one you could potentially get
2626080	2633780	around. People have demonstrated that even with V8 on Chrome. So, this right here, I just
2633780	2639360	wanted to point it out. There are two fields and rest in peace to Jeff Chappelle, brilliant
2639360	2643560	individual who passed away recently, sadly. But he maintained this site and I hope it
2643560	2649260	stays up forever because every time Microsoft would make a structural change or add a new
2649260	2653360	mitigation, like if you can see the ones towards the bottom on the right, mitigation flags
2653360	2658180	too, you see things like control flow enforcement technology and shadow stacks. Those are
2658180	2663600	relatively new mitigations. And these are bit masks that are set as a member of the
2663800	2668180	e-process structure. And those are the things that are being checked. That's why a lot of
2668180	2671780	times you might hear people getting around SMEP, like supervisor mode execution
2671780	2676980	prevention, by setting a bit or flipping a bit inside a control register while under a
2676980	2682120	certain context. Getting around patch guard by doing it fast and doing a race condition. So,
2682120	2686680	the more you understand from an offensive perspective about these mitigations, the more
2686680	2690520	you'll be able to get around them potentially or know when to call it a day. For me, it's
2690520	2695120	all about saving time. If I know a mitigation is likely on and I'm doing a patch dip or
2695120	2699500	find a zero day and I think it's not going to be fruitful for me to continue down that path,
2699500	2703920	you got to pay your dues though. You will have those harsh, frustrating days. I still have
2703920	2709460	them all the time. From a defensive perspective, it really helps you to understand how these
2709460	2713800	mitigations work so that if you don't want to turn all of them on, you know which ones are
2713800	2719560	going to be more beneficial, which ones have less overhead, which ones actually do stop an
2719560	2724720	exploit technique and which ones are pretty useless. So, some takeaways, I think I went
2724720	2731140	through some already, but it's a lot of nuance and I think that that gives us power where AI
2731140	2736360	won't take over our jobs anytime soon because the circumstances in which you will be doing
2736360	2741840	your research requires something that machine learning just can't do right now. And there's
2741840	2746180	synergy there as well when working with other researchers. The golden years of binary
2746180	2750740	exploitation can be behind us, but it's not going away anytime soon. People ask me, they
2750740	2754140	probably ask you all the time, for how much longer am I going to be able to do this?
2754960	2758960	As long as it's possible. People are going to keep doing it. It's a lot harder now, but I use
2758960	2763660	an analogy like Tony Hawk, the skateboarder. What he was doing in the 1990s, there's like an
2763660	2768000	eight-year-old kid able to do that today. We're just, all this information is out there to get
2768000	2773380	you up to speed from all the research done in the past, fast, so that you can then go and bring
2773380	2778220	about novel exploitation techniques and new zero days. And the ethical considerations are
2778220	2783260	something that you have to understand and think about. There's new acts and new legislation
2783260	2789860	out there, like Paul Maul and such, that we have to worry about. But as you probably know, the
2789860	2794000	more you push researchers and say you can't do something, the more likely they're going to go
2794000	2800300	unethical route and sell it on the dark net and make money that way. So, mitigations are a real
2800300	2805820	thing. They're hard, but they're not going away and you just have to deal with it. You have to
2805820	2811640	think about it as if there's always a way around it. And the prize will continue to grow. What
2811640	2818300	was $10,000 is $500,000 now. So it is worth your time putting months into research. So
2818300	2822600	references and thanks, there's always more people than I can remember to thank, but lots of
2822600	2826280	researchers out there in the past. Jeremy Tinder, just a shout out to him for getting me those
2826280	2830460	Microsoft documents or those updated charts, which is cool. Brad Spangler helped me out with
2830460	2834420	going over some things, so I'm not going to go through everyone. Harun Mir is the individual I
2834420	2839900	said that did a talk from 2010 that went through every single mitigation that ever came out. It's
2840040	2844600	a beautiful document. Definitely check that one out. And a lot of other folks as well. Thanks
2844600	2849700	to DEF CON for selecting a talk. That is it. I think I'm right on time here. I'm happy to, you
2849700	2852920	know, chat out in the hall because I know I've got to make way if you have any questions, but
2852920	2855300	thank you so much for coming to my talk. I really appreciate it.
