WEBVTT

00:00.000 --> 00:01.740
So thank you so much for coming.

00:01.740 --> 00:04.300
I know it's early on a Saturday at DEF CON.

00:04.300 --> 00:05.700
I talked to some people last night.

00:05.700 --> 00:06.920
They're like, when are you talking?

00:06.920 --> 00:07.740
It's at 11am.

00:07.740 --> 00:09.500
I don't get up until 3, sorry.

00:09.600 --> 00:11.960
So I appreciate the effort.

00:12.300 --> 00:13.660
Or maybe you're still up.

00:13.840 --> 00:16.820
So I want to move pretty quickly here.

00:16.820 --> 00:17.880
I've got a handheld mic.

00:17.880 --> 00:18.900
I might walk around a bit.

00:18.900 --> 00:21.620
I don't have a lapel mic because flippers and stuff like that.

00:21.620 --> 00:23.500
So we'll see what we do.

00:23.720 --> 00:26.760
But I've got a lot of slides and I want to make sure I get through everything.

00:26.760 --> 00:29.220
So I've got a quick agenda that I will start with.

00:29.220 --> 00:34.740
Let me quickly introduce myself for those of you who may not be familiar with who I am or my work.

00:35.440 --> 00:37.000
So my name is Stephen Sims.

00:37.000 --> 00:41.660
I've been a vulnerability researcher for going on 20 years now.

00:41.900 --> 00:54.260
I was lucky enough early on to have computers in the house and be able to have access to video gaming and all the fun things early on and using a hex editor and hacking.

00:54.260 --> 00:55.680
All the things you guys have already done.

00:55.680 --> 00:57.300
So let's move on beyond that.

00:57.300 --> 01:02.600
I've sold a lot of exploits over the past couple decades.

01:02.600 --> 01:04.220
I corrected myself there.

01:04.220 --> 01:11.780
I thought it was over 30 browser exploits but I didn't want to fib so I went back and counted and it ends up being 29 of them.

01:12.300 --> 01:16.020
Those are mostly used after free and type confusion vulnerabilities.

01:16.020 --> 01:18.900
I've always been someone who sells exploits.

01:18.900 --> 01:24.400
I don't typically disclose them publicly or through other programs.

01:24.420 --> 01:28.740
I will talk a little bit about that because obviously there are ethics associated with exploit sales.

01:28.740 --> 01:30.580
So I'll give you my position when we get there.

01:30.620 --> 01:36.780
I found a couple kernel vulnerabilities on Windows 1 RCE which you can get a lot of money for nowadays.

01:37.160 --> 01:39.720
Had I known a little bit more when I sold it, it would have been better.

01:40.060 --> 01:46.240
But lots of other vulnerabilities and different applications and hardware out there over the years have been lucky enough to have a lot of great relationships and such.

01:46.240 --> 01:54.480
I moved to San Francisco early on in the 2000s and lived on Treasure Island where we used to joke and call it Hacker Island because there were so many hackers there.

01:54.480 --> 01:57.540
People from Burning Man, people from all kinds of different backgrounds.

01:57.780 --> 02:00.900
But it was just a free for all and it was pretty incredible.

02:00.900 --> 02:10.060
Lots of people from CDC lived out there and others and you learn pretty early on to how to properly use a handle and not get yourself doxed out there.

02:10.520 --> 02:18.300
I'm also, like I said, a musician at the Sands Institute on the Offensive Operations Curriculum Lead and I have a couple courses there on advanced exploit development.

02:18.720 --> 02:22.180
I am one of the co-authors of Grey Hat Hacking, if you've heard of that book series.

02:22.260 --> 02:25.900
We're talking right now about doing a seventh edition so hopefully that comes to fruition.

02:26.540 --> 02:39.820
And then I also run a weekly stream you might have heard of called Off By One Security where I do my own stream solo and I also have a lot of guests on and I've been lucky enough to have some really amazing people on and that just makes it all great.

02:39.820 --> 02:46.160
I appreciate so many of you have come up and say thank you for the stream because that means a lot to me and that's what I do it for is to get back to the community.

02:46.320 --> 02:50.300
And if any of you are ever interested in being a guest, I'd love to hear from you.

02:50.940 --> 02:52.320
All right, so quick agenda.

02:52.320 --> 02:56.360
We're going to start off doing a quick history of mitigations.

02:56.360 --> 02:57.540
We're not going to cover all of them.

02:57.540 --> 03:04.380
There's dozens and dozens of them so we can't get through them all but we'll touch briefly on them, kind of show you where we were, where we are today.

03:04.760 --> 03:18.840
Microsoft MSRC was generous enough to get me some really cool cutting edge data that has not been published yet so you'll get to see some vulnerability information from Microsoft's perspective in relation to RCEs and local priv and other types of bugs.

03:19.020 --> 03:20.620
Then we'll quickly go through payouts.

03:20.620 --> 03:36.520
I did a stream last Friday on nothing but payouts and all the different types of buyers out there and I got a lot of hate and a lot of love from that one which I expected because again it involves your morals and it's very ethical considerations to have.

03:37.100 --> 03:45.120
We'll quickly look at the role of machine learning and AI in general in vulnerability research because that's obviously a hot topic as of late and will continue to be.

03:45.400 --> 03:56.340
And then we're going to switch over into being technical because I don't want to do a talk without being technical and we'll get into looking at one specific mitigation that is implemented in the Windows kernel.

03:56.480 --> 04:10.480
And my main point of wanting to show you that is so that if you yourself want to understand how a new mitigation works that comes out, if you want to figure out how to bypass it, how to work around it or other things or how effective it is if you're a defender,

04:10.480 --> 04:12.680
you need to go and debug it.

04:12.680 --> 04:16.720
It's really the only way you can learn other than taking other people's published information.

04:16.720 --> 04:23.180
So every time a new mitigation comes out I love to jump in to debuggers and disassemblers and go and understand it as best I can.

04:23.380 --> 04:24.440
And then we'll do some takeaways.

04:24.440 --> 04:25.860
That is the agenda.

04:26.320 --> 04:41.720
So the golden years, I'm not one, it's not my right to say what the golden years of hacking is but I have been doing it long enough and I remember reading, it was before my time, but I left one smash in the stack for fun and profit and other papers released around that time,

04:41.720 --> 04:54.220
open wall, work that Brad Spengler was doing, so many other brilliant researchers and when you, when I personally think about what the golden years is, it's before all these mitigations became really effective.

04:54.340 --> 05:03.760
You'll see on a diagram that I put together coming up in a moment that there are certain years where stuff got real serious and it's only gotten harder and harder since then.

05:03.760 --> 05:12.300
So I would say the golden years of memory corruption bugs is long over but still possible and those bugs are very valuable now and you'll see that in a moment.

05:13.280 --> 05:28.420
But you see here Windows up at the top and we can go way back to when trust from escape and wag that was what became Emmet or at least some of the controls and mitigations there became the enhanced mitigation experience tool kit which of course now today is exploit guard.

05:28.420 --> 05:32.660
But Windows it wasn't until XP service pack 2 where mitigations were a thing.

05:32.820 --> 05:39.820
I remember when that dropped and admins were freaking out because it was over a gigabyte update and there were a lot of new mitigations published.

05:40.180 --> 05:41.100
You can see them listed there.

05:41.100 --> 05:45.380
I'm not going to go through every one of them but notable ones like data execution prevention, that's huge.

05:45.380 --> 05:46.680
And in stack canaries.

05:46.920 --> 06:06.960
Linux down below, I was doing some research and thankfully Brad Spengler pointed me to some great talk from maybe a decade or so ago that really went through every single mitigation when it came out, the bug classes and gave credit where credit is due to all the brilliant researchers and that's a really hard thing to do.

06:06.960 --> 06:18.500
There's a lot of confusion when you go out there trying to find out who the original source was that published a technique for exploitation or some documentation and I try my best to give that credit.

06:18.800 --> 06:32.800
So the information there under Linux all the way back to 1997, I mean people were thinking about security way back in 1997 especially on the Linux side of the house which as expected is always first in that realm.

06:33.660 --> 06:35.740
But open wall was a big one for that one.

06:35.740 --> 06:38.240
Mac OS you can see was a bit late to the game.

06:38.420 --> 06:41.800
ASLR like randomization didn't come out until like 2011.

06:41.900 --> 06:43.660
That's way behind Vista even.

06:43.820 --> 06:47.840
So all the operating systems now though are at a pretty good state.

06:49.000 --> 06:52.400
Some notable mitigations, this is not complete by any means.

06:52.400 --> 06:55.640
I put this together, there's always possibilities, there's mistakes.

06:55.640 --> 07:01.140
A lot of times mitigations come out like before the official OS release of that mitigation.

07:01.240 --> 07:10.880
You might hear well low fragmentation heap that was around during XP service pack 2 or 3 but it didn't fully get implemented to replace the front end heap allocator until Windows Vista.

07:11.420 --> 07:13.740
And then they got rid of the look aside list except for in the kernel.

07:13.740 --> 07:15.840
So like a lot of this stuff can be fuzzy.

07:15.900 --> 07:18.480
So the arrows going back that means back ported.

07:18.480 --> 07:22.920
A lot of times mitigations come out, some of them get back ported, some of them don't get back ported.

07:23.040 --> 07:29.000
But you can see some other notable ones like Windows 10 obviously came out, control flow guard was a significant one.

07:29.000 --> 07:32.740
Microsoft was pretty proud of that one and made some pretty bold claims about it.

07:32.740 --> 07:36.920
But none of these mitigations by themselves are a one stop shop.

07:36.920 --> 07:39.460
They are complementary to one another.

07:39.460 --> 07:50.440
If there's one weak link in the chain, if one single mitigation is not working properly or if one library is not compiled to participate in a mitigation, it breaks the whole thing.

07:51.000 --> 07:53.540
So it can be difficult to get all of them there.

07:53.540 --> 08:09.740
I usually put up a Venn diagram that shows overlapping circles where you've got different categories of mitigations like those enforced by the operating system, those enforced by the compiler, those enforced by a tool kit like exploit guard or malware bytes or whatever you might be using.

08:09.880 --> 08:17.120
And if you get to the merged areas in the circles, you're taking advantage of multiple categories and that's where things become much more effective.

08:17.420 --> 08:22.980
Because depending on the type of exploit you're using or you're writing, a mitigation might not even matter.

08:22.980 --> 08:25.180
For example, font protection.

08:25.180 --> 08:30.240
Like they introduced font protection because I think it was Dooku or Stuxnet, it was a font based vulnerability.

08:30.240 --> 08:36.140
It was a sign extension bug and it affected the Windows kernel and was a brilliant exploit.

08:37.280 --> 08:43.680
That font mitigation just says you can't use any fonts unless it's in a system 32 fonts folder.

08:43.840 --> 08:45.860
So no third party fonts to come along.

08:45.860 --> 08:49.300
But obviously that only targets a very specific thing.

08:49.420 --> 08:53.480
So some of these mitigations don't matter when you're exploiting things.

08:54.420 --> 08:56.900
So this is not something we're going to walk through.

08:56.900 --> 09:00.240
It's a pretty ugly slide but it's something you can take a picture of.

09:00.280 --> 09:14.860
All it's showing is that with all of those mitigations and that was not comprehensive by any means, it's a cat and mouse game where you've got a mitigation that comes out due to a bug class or an exploit technique.

09:14.880 --> 09:19.860
For example, look at arbitrary code guard or export address table filtering.

09:19.860 --> 09:28.000
EAF specifically targets shell code and how it accesses the exports table inside libraries like kernel 32.

09:28.140 --> 09:37.580
So they target very specific things and it's that cat and mouse game because when a new exploit technique comes out or a new bug class, a mitigation goes in to try to kill it.

09:37.580 --> 09:40.820
And then a workaround comes out and then they update the mitigation.

09:40.900 --> 09:49.180
A perfect example is back in 2014 and I was just hanging out with Corlan Coder like a week ago in Amsterdam at a hack fest that we had out there.

09:49.360 --> 09:52.720
And he and I have something very in common with each other.

09:52.720 --> 09:54.700
Actually I'll show you in a diagram coming up very soon.

09:54.700 --> 09:56.020
It might be the next one.

09:56.380 --> 09:57.800
It is the next one.

09:57.800 --> 10:05.740
So this is the last version that Microsoft published outwardly that I've seen anyway from Matt Miller and other folks at MSRC.

10:05.960 --> 10:09.640
And you notice it only goes up to like 2013 or so.

10:09.640 --> 10:10.940
Or 2015, 16.

10:10.940 --> 10:12.100
I can't even see it.

10:12.260 --> 10:21.840
But what I want you to look at here is, and unfortunately I don't have a laser pointer on this thing, but look at the gray area to the right side and see how it's a very wide gap.

10:22.180 --> 10:25.120
And then all of a sudden after that it shrinks down.

10:25.360 --> 10:36.520
The reason that happened is because Microsoft in 2014 introduced a couple mitigations that really killed specific types of bug classes in the browser.

10:36.520 --> 10:38.660
Like type confusion, use after free.

10:39.080 --> 10:50.100
I brought up Core Lan Coder because he and I both were writing quite a few exploits per year against a browser and then all of a sudden in June, July 2014 they stopped working.

10:50.100 --> 10:51.440
The exploits stopped working.

10:51.440 --> 10:57.200
Because they put in deferred free, isolated heaps and then MemGC came shortly after.

10:57.340 --> 11:08.240
And I remember even seeing people like Skylines who was releasing lots of vulnerabilities or selling exploits or disclosing them, saying one time in a tweet, hey does anybody have a MemGC bypass?

11:08.240 --> 11:12.780
I'm literally sitting on a bunch of edge vulnerabilities that I can't exploit.

11:12.960 --> 11:23.560
So that's the job of the OS developers who work with mitigations is to identify and understand a specific exploit technique or bug class and try to kill it.

11:23.900 --> 11:30.400
Deferred free or MemGC I should say is so effective because it does validation of references.

11:30.400 --> 11:41.980
Microsoft used C++ smart pointers to do dynamic tracking of objects and reference tracking and the way in which they chose to track references allowed for a certain type of exploit to be quite possible.

11:42.060 --> 11:54.960
So by adding the MemGC control in deferred free, there's validation going on to make sure that there are no other references to the object that's about to get freed before giving it back to garbage collector for reuse to get recycled.

11:55.260 --> 11:57.380
And that's why it shrinks down so much.

11:57.480 --> 12:02.760
So Microsoft is very kind as I said before in getting me this diagram and the next one.

12:02.860 --> 12:07.380
This one is remote code execution CVEs by patch year.

12:07.860 --> 12:12.220
So you have to imagine that the majority of CVEs that come out are privately disclosed.

12:12.220 --> 12:14.660
Meaning that there is no public exploit code.

12:14.660 --> 12:24.040
And that's why there's a lot of exploit framework vendors out there like Rapid 7 with Metasploit and Core Impact and Immunity Canvas and Saint.

12:24.040 --> 12:33.260
There's all these different frameworks and what they want to be able to say is we have the most exploits for privately disclosed CVEs.

12:33.260 --> 12:41.640
Because if you're a red team or some other offensive group and you want to be able to break in obviously to targets , most companies are terrible about patching.

12:42.380 --> 12:59.440
So if we can get some really smart people to do things like patch diffing, identify the delta in the code and weaponize these end day vulnerabilities, then we're going to have a much more valuable framework because we're able to allow you to exploit things that no one else can.

12:59.640 --> 13:04.120
I would say close to like 90% of CVEs are privately disclosed.

13:04.120 --> 13:05.720
No public exploit code.

13:05.720 --> 13:12.160
So that is absolutely a profitable business to go and write or weaponize end day vulnerabilities.

13:12.160 --> 13:14.780
Because again organizations are terrible about patching.

13:14.880 --> 13:17.280
But you can see we're not going to walk through all the data.

13:17.280 --> 13:20.080
I'm going to tweet this afterward and the slides obviously will come out.

13:20.080 --> 13:29.500
But this is great stuff to use internally with your teams and your threat intel folks and SOC and everyone else to say hey these are some things we should be considering.

13:29.540 --> 13:31.300
How effective are the mitigations?

13:31.300 --> 13:33.740
What bug classes are the most popular right now?

13:33.780 --> 13:35.740
And this specifically is for RCE.

13:35.740 --> 13:38.180
And you can see the number in the middle.

13:38.400 --> 13:42.460
The next one here is overall CVEs by patch here.

13:42.460 --> 13:49.920
So this is not just memory safety or if you go back to that initial slide that I had up that was all memory corruption for the most part.

13:49.920 --> 13:50.860
All of it.

13:50.900 --> 13:59.120
And I remember some patch Tuesdays there would be like 50 patches coming out for Internet Explorer and Edge alone.

13:59.200 --> 14:04.380
It was a serious problem and they had to solve it with these mitigations and did quite an effective job.

14:04.580 --> 14:17.820
But this shows you memory corruption if you look at the left that's the big green one in the middle and if you look to the left it's getting less and less and sometimes it gets bigger and smaller but that is happening because obviously secured code initiatives,

14:17.820 --> 14:25.720
introducing rust into the kernel to protect critical components, the mitigations being very effective, that is what changes the trajectory here.

14:26.120 --> 14:30.920
And you can see things like deserialization and other types of bugs start to pop up and get more popular.

14:30.980 --> 14:34.420
Again, cat and mouse game and we're always trying to find new ways of getting in.

14:35.120 --> 14:37.420
So how mitigations have affected payouts?

14:37.420 --> 14:40.800
I'll quickly go through this one because again I want to make sure I have enough time.

14:41.220 --> 14:51.660
And if you want more information on this if you go to the off by one security channel on YouTube look at last week's stream I spent like two hours almost talking specifically about this process.

14:51.860 --> 14:54.740
But quickly going through there are different categories of buyers.

14:54.740 --> 15:00.340
You can always go to the vendor themselves like Microsoft, Google, Apple and they will pay you.

15:00.340 --> 15:02.580
Some companies have bounties, some don't.

15:02.580 --> 15:09.140
But they typically don't pay as much as third party buyers out there depending on where they sit on the realm of ethical boundaries.

15:09.440 --> 15:11.400
But they'll pay you and it's gotten better.

15:12.240 --> 15:13.420
Then you go a little bit further.

15:13.420 --> 15:23.180
Okay, we can go to ZDI, the Zero Day Initiative or go out to CanSecWest and participate in Pwn2Own or Bug Crowd, HackerOne, iDefense which I don't think are buying exploits anymore.

15:23.360 --> 15:27.500
But those are third parties who do work with the vendor and they get it patched.

15:27.500 --> 15:29.500
The exploit code never goes public.

15:30.240 --> 15:33.160
When you sell an exploit it's no longer your exploit.

15:33.160 --> 15:34.540
Typically they don't pay you.

15:34.540 --> 15:44.020
The money gets put into an escrow and you have to wait to get paid because they want to make sure you're not trying to double dip and sell it to multiple buyers out there until you build up a good trust.

15:44.140 --> 15:54.440
So we go out further and I'm not going to name any names because they get mad, but there are all kinds of different third party buyers on behalf of different intelligence agencies and governments around the world.

15:54.900 --> 15:59.180
Believe me, I've sat with them many times and they are looking for bugs from you.

15:59.240 --> 16:09.520
Now you typically don't go knock on the front door of the NSA, I don't advise that, but there are third parties out there and they will pay more than the below ones that we just talked about.

16:09.520 --> 16:10.440
How much?

16:10.440 --> 16:12.180
We'll talk about some money here in a moment.

16:12.660 --> 16:25.680
You go further than that, there are these third party companies that are exploit acquisition companies that refer to themselves as crowd fences, a relatively new one, you heard of Zerodium, I don't think they're buying anymore, they used to be Voopin.

16:25.680 --> 16:33.760
And there's Voln Point, I don't know anything about Voln Point, but there's some hefty amounts of money that you can make there.

16:33.820 --> 16:38.160
Millions, I think up to 9 million US dollars for an iOS bug.

16:38.240 --> 16:41.440
I mean full chain, obviously, it's got to be all the things.

16:41.820 --> 16:48.140
And then you've got kind of the most unethical place you can go, which are random people.

16:48.400 --> 16:53.360
This is where you've got to be really careful because you don't know who you're selling to and you don't know who they're selling it to.

16:53.360 --> 16:54.820
You don't know who the buyer is.

16:55.080 --> 17:08.140
But this could be over Tor, Telegram, people, if you start getting known for selling exploits or having the skills to find zero days and weaponize them, especially in today's climate with how hard it is, they will find you.

17:08.140 --> 17:13.160
But you've got to be really careful when you're selling this stuff to protect you and your family and other things.

17:13.160 --> 17:19.900
I really, again, recommend watching that stream if you're interested in that space because I go into some good detail about that.

17:20.140 --> 17:23.600
So examples of how much you get paid for some of this stuff.

17:23.600 --> 17:26.340
Now, this example is one for me personally.

17:26.960 --> 17:28.180
I've always sold things.

17:28.180 --> 17:29.980
I don't sell to unethical buyers, though.

17:29.980 --> 17:31.520
Personally, that's my choice.

17:31.520 --> 17:34.440
Yes, you get paid less, but that's, you know, your choice.

17:34.520 --> 17:47.420
So someone like iDefense or ZDI, back in 2014, before those mitigations I told you about dropped, you could expect to get $10,000 to $30,000 US dollars for like a USAPTA free exploit.

17:47.520 --> 17:50.660
And back then, you typically didn't need a big chain.

17:50.660 --> 17:56.220
Maybe one exploit or two, like an information disclosure bug to bypass ASLR if you needed it.

17:56.220 --> 18:03.500
But if anyone remembers, and I'm sure some of you do, JRE6, the Java Runtime Environment 6, MSVCR71.DLL.

18:03.500 --> 18:09.300
That made me a lot of money because they didn't add dynamic rebasing to that module.

18:09.300 --> 18:13.440
And it also had all the gadgets you need to get around data execution prevention.

18:13.440 --> 18:14.560
So it's a beautiful thing.

18:14.560 --> 18:21.420
So if you found one remote code execution, USAPTA free against the browser , that's all you needed.

18:21.420 --> 18:24.860
There was no sandboxing on Internet Explorer Edge back then.

18:25.000 --> 18:27.200
And so you could expect to get paid that amount.

18:27.200 --> 18:28.800
But now it's a lot harder.

18:29.040 --> 18:35.640
On the more unethical side of it, you can expect to get paid 10 to 20 times more.

18:35.860 --> 18:39.220
So you can see an example there from CrowdFence.

18:39.220 --> 18:41.160
They say offering up to $400,000.

18:41.160 --> 18:42.460
That's straight from the website.

18:43.140 --> 18:45.140
Another example is iOS.

18:45.160 --> 18:46.440
Zero click.

18:46.740 --> 18:54.560
Apple created something called Blastor to try to triage text messages coming in to make sure code execution isn't occurring.

18:54.560 --> 18:59.320
It's going to be a lot harder to jailbreak or root that phone because of Blastor.

18:59.320 --> 19:03.700
So you got to have like 4 to 6 zero days chained together at least.

19:03.700 --> 19:06.540
And it's not one person out there doing this anymore.

19:06.540 --> 19:13.280
Back in 2014, you and yourself could find enough to get around all the things and get code execution .

19:13.280 --> 19:19.660
But nowadays, especially in the kernel with HVCI and other cutting edge mitigations you could say, it's hard.

19:19.660 --> 19:21.120
The execute primitive is gone.

19:21.120 --> 19:25.880
You get read write opportunities but even that can be challenging with code signing and all kinds of other things.

19:25.880 --> 19:28.280
But that is why the price tag goes up so much.

19:28.700 --> 19:36.480
So you can see 2014, I remember Zerodium was offering up to $2 million, $2.5 million for iOS and Android full chain zero clicks.

19:36.760 --> 19:42.280
Now you can get up to $9 million with VulnPoint and CrowdFence I think I saw.

19:42.280 --> 19:52.260
And then this example here, if you've ever seen Operation Zero, it literally says on the Twitter page, on their home page, the only Russian backed exploit acquisition program.

19:52.260 --> 19:55.540
And it literally says, we are non-NATO friendly.

19:56.680 --> 19:58.180
But $20 million U.S.

19:58.180 --> 19:59.440
dollars, you could retire.

19:59.440 --> 20:00.500
That's amazing.

20:00.500 --> 20:01.320
But look who you're selling.

20:01.320 --> 20:03.420
You are literally doing treason at that point.

20:03.420 --> 20:04.580
I'll stop saying literally.

20:04.580 --> 20:07.160
And they will use that to attack your country.

20:07.160 --> 20:10.540
So I don't know if you want to be in that position, but it's an option for you.

20:11.560 --> 20:16.320
So we'll jump now into machine learning for vulnerability research.

20:16.320 --> 20:22.860
This one is one that I have a lot of interest in because it saves you time.

20:23.380 --> 20:32.080
You already know, but automation and machine learning, or the umbrella of AI in general, are things that aren't going away.

20:32.080 --> 20:36.840
And we don't want to fight it, we want to leverage it and use it to complement our skills.

20:36.840 --> 20:38.780
If you fight it, you will lose.

20:39.940 --> 21:00.680
When chat GPT was made public, I think it was November or December 2022, shortly after that spring, I believe, Project Zero started an initiative, of course, to go and see how AI in general, machine learning, can help with vulnerability research, specifically for memory corruption bugs.

21:00.860 --> 21:07.920
If you remember a long time ago, DARPA, back in like 2016, they had a challenge .

21:08.120 --> 21:10.540
And they paid, I think, 2 or 3 million U.S.

21:10.540 --> 21:23.900
dollars to the winning team, and the challenge was, we want you to write basically machine wars, automated hacking, automated detection and defense, where the machines are fighting each other, almost like a capture the flag.

21:23.900 --> 21:30.120
And back then there was a lot of universities looking into very basic exploitation techniques, like stack overflows.

21:30.120 --> 21:32.380
That's a pretty easy thing to weaponize.

21:32.380 --> 21:36.780
Okay, the buffer is overrun and you overwrite a return point, that's very basic.

21:36.940 --> 21:41.940
So it's not so hard to write something that will do that for you automatically.

21:41.940 --> 21:49.900
But when you're getting into harder bug classes, I gave a couple examples, like type confusion, those are difficult to find.

21:49.900 --> 21:53.840
Static analysis, dynamic analysis, manual code inspection, it doesn't matter.

21:53.840 --> 21:55.280
Those are tough to find.

21:55.280 --> 22:04.420
Because as a developer, you can't possibly get your code into the context or every possible situation where it might be run.

22:04.420 --> 22:13.100
Different libraries, different patch levels, different things people do to their computers, a developer can't anticipate what that code might run into in the future.

22:13.140 --> 22:16.920
So these vulnerabilities manifest thanks to things like C++.

22:17.420 --> 22:20.360
A lot of people ask, well, why aren't we already on Rust?

22:20.360 --> 22:23.440
Why isn't the Windows kernel rewritten entirely in Rust?

22:23.700 --> 22:32.480
I can't answer that 100% but I can give my opinion, which is, wow, theirs is louder than mine, that's amazing.

22:32.620 --> 22:34.160
All right, okay.

22:35.700 --> 22:36.960
Cutting me off.

22:36.980 --> 22:41.120
So Rust, remember when H.D.

22:41.120 --> 22:44.560
Moore and the Metasploit team, they were on Perl early on?

22:44.560 --> 22:46.460
Metasploit came out in 2003.

22:46.580 --> 22:52.440
And at one point they said, we need to get off Perl because the language wasn't growing at the same pace that they needed it to.

22:52.580 --> 22:57.320
And so they were going to choose between Python and what's the other one?

22:57.340 --> 22:58.240
Ruby, right?

22:58.240 --> 22:59.420
And they chose Ruby.

22:59.460 --> 23:00.840
And I remember talking to H.D.

23:00.840 --> 23:13.340
Moore at DEF CON a long time ago and I believe it was the Ruby developers were willing to work with that project because it became the largest open source Ruby project to improve the language to meet the needs of the developers.

23:13.420 --> 23:16.600
So the language developers working with the framework.

23:17.180 --> 23:22.380
I imagine it's a similar thing where C++ has been around for a long time.

23:22.380 --> 23:24.880
It's very mature, it's very powerful.

23:24.880 --> 23:26.660
So a couple things you get from that.

23:26.660 --> 23:36.600
You've got developers with decades of experience who can't just overnight over to Rust and you've got limitations in the language that might not allow it to do the things that C++ can do.

23:36.720 --> 23:49.320
And yes, Rust is mimicking like low level behavior with the speed and the power of being able to directly manipulate processor registers and memory, but unsafe languages tend to be extremely powerful.

23:49.640 --> 23:56.280
So it's those memory corruption bugs, they're difficult to squash and it's not going to be overnight where we replace everything.

23:56.280 --> 23:57.720
But it is slowly happening.

23:57.720 --> 24:01.360
I believe the first thing you saw in the Windows kernel was Win32K.SysDriver.

24:01.360 --> 24:03.840
Some implementation of that got put over to Rust.

24:04.360 --> 24:10.800
So anyway, from a high level, because I can't really go into what Google is doing at Naptime, I read the paper, that's what they called it, was Project Naptime.

24:10.880 --> 24:15.160
And I have been working on a similar thing, but as a single person, so they've got a team of people.

24:15.160 --> 24:19.080
I've also talked to multiple other teams out there who are doing the same thing.

24:19.220 --> 24:26.100
And that is, how do we create agents, different agents that serve different roles, they do different things.

24:26.100 --> 24:40.800
Because just like humans, if you try to give AI in general, and again that's an umbrella encompassing term for everything underneath it, if you ask a single agent or LLM to do everything for you, it's not going to do a great job.

24:40.800 --> 24:47.560
But if you break it down, just like humans, don't ask one developer to go rewrite Microsoft Office Suite, that's too much.

24:47.560 --> 24:52.320
Break it down into different groups, different agents and roles, it's going to be a lot more possible.

24:52.700 --> 25:03.180
And the gist of that, they did make some really impressive progress and they're going to continue working on it of course, but said, as it quotes on the slide, there's still a long way to go.

25:03.180 --> 25:10.800
We're not going to be replaced any time soon because there's so much nuance that it can't have, like humans can have, the way we think.

25:10.800 --> 25:12.200
It'll get better of course.

25:13.080 --> 25:25.240
But going into that a little bit more, this is an example of something called crew AI, if you've heard of that, there's multiple frameworks out there for such, open source, and it has this concept of the agents and these roles that things serve.

25:25.240 --> 25:30.900
So you can see on the right, we're saying we want you to be a threat intelligence analyst, this is what your job is.

25:31.080 --> 25:40.620
And you feed it information, it uses rag and other cool technology to ingest all kinds of threat intel data and other, and then it does a thing.

25:40.800 --> 25:53.420
And to put that in like a chain, you've got over on the left, like an agent that is the threat intel agent, and it's ingesting things like PDF documents and just threat intel data, everything it can get its hands on.

25:53.420 --> 26:05.280
And then the result of that, the output, like the list of MITRE attack TTPs as an example, because everyone knows that one, gets fed into two other agents, one's the red team side and one's the blue team side.

26:05.280 --> 26:16.360
One's doing detection engineering and generating Sigma or some kind of other rules out there, and the red team side is using it for continuous automated red teaming and pen testing.

26:16.540 --> 26:20.160
So they're consuming and ingesting the same data, using it for different purposes.

26:20.160 --> 26:25.160
A lot of companies are getting into this now, a lot of managed socks out there are doing exactly that.

26:25.160 --> 26:28.100
Here's your Yara rules, here's your Sigma rules, whatever, from it.

26:28.880 --> 26:35.880
This is a pretty ugly slide, but it's one that I put together because this is what I'm working on personally and I have been for some time now.

26:36.880 --> 26:48.980
I am not anywhere close to where I want to be, and if Google's not getting the best results in the world, like meaning it can replace humans with VR or the other way around, then I'm certainly not going to be able to do it alone.

26:48.980 --> 27:06.940
But I have made some good progress, which is I feed into an LLM all the different CVEs, all the project zero or other public research out there, all GitHub, anything I can feed it around exploits and patch diffing, binary diffing and all that data.

27:07.160 --> 27:11.760
So one thing I do a lot is end day vulnerability weaponization.

27:11.760 --> 27:14.440
I download on patch Tuesday unless I don't have time.

27:14.800 --> 27:23.460
You get used to looking at this stuff, you look at all the CVEs, you look at the knowledge base articles, you try to figure out which ones are most likely exploitable.

27:23.460 --> 27:35.340
You probably still wrong, and you learn a lot, so you have to keep telling yourself, because it's very frustrating when you spend two weeks looking at a patch vulnerability that you realize you cannot weaponize, because of mitigations or some other factors.

27:35.560 --> 27:43.300
Because even if a mitigation can 100% stop a vulnerability from being exploitable, they're still going to patch it.

27:43.780 --> 27:46.320
Because what if somebody turns a mitigation off?

27:46.680 --> 27:51.380
It's a good habit to clean that stuff up.

27:51.560 --> 28:09.240
So when you do a patch diff and you look at the delta of the code, use something like diaphora or bin diff, and you take a look at the changes at the function or the code level, you can give that information to the LLM and teach it how and why it's a certain type of vulnerability.

28:09.340 --> 28:17.220
And then the output from that can go into the next agent, which is really doing the patch diffing for new vulnerabilities that got patched.

28:17.220 --> 28:23.740
So it's taking the patch, it's extracting it, or grabbing it from Winbindex, doing the diffing, and it's looking at the delta.

28:23.740 --> 28:32.000
And it's knowledge of all the prior diffs that it has learned about and all the information about exploits that are public or private.

28:32.000 --> 28:37.980
It's using that to make a good guess as to what most likely is the vulnerability type.

28:37.980 --> 28:47.640
And then we have a corpus generation agent, which is trying to generate trigger files that you can then feed to whatever it is and hopefully trigger the vulnerability.

28:47.640 --> 28:50.660
And then of course you would have to go in and see if you can actually weaponize it.

28:51.020 --> 29:04.140
So it's automating the process of binary diffing and trying to find where the bug is and trying to help you generate malformed documents or whatever you need to send to the target to try and get it to crash.

29:04.200 --> 29:09.780
I've got this working pretty good, it's not great, but it's saving me a ton of time.

29:09.780 --> 29:18.220
I would say probably like 10 to 20 times it's saving me on that research effort, which is pretty damn good for me anyway.

29:19.020 --> 29:22.800
So understanding how mitigations work, we're going to jump into the more technical part now.

29:23.720 --> 29:27.200
There's so many mitigations, so I just chose one random one.

29:27.200 --> 29:33.680
And also on my channel I do a lot of exploit mitigation reversing, if you're interested in that stuff, there's videos on that.

29:33.720 --> 29:44.100
But a lot of these mitigations, especially the more classic ones that came out with emits and the initial exploit guard, what they do is they will hook something.

29:44.100 --> 29:47.400
So for example, there are things called critical functions on Windows.

29:47.400 --> 29:57.060
Critical function of one type will be any function that can change permissions in memory, like virtual alloc, virtual protect, heap create, write process memory, those are critical APIs.

29:57.200 --> 29:59.180
So we want to monitor those.

29:59.240 --> 30:13.460
So if we understand things about different bug classes out there and different ways in which people exploit vulnerabilities, then we can hook the flow of execution and before we allow the function to be called that will in fact change permissions in memory,

30:13.460 --> 30:14.920
we inspect it.

30:14.960 --> 30:29.020
And they can do that, you could do that by overwriting an entry in the imports table, so when it calls that function where it's linked, it'll actually call your code first, or more likely they're going to hot patch or put a patch in the very beginning of the function entry point,

30:29.020 --> 30:39.760
and it will first jump to another location, execute some code, typically points into something called payload restrictions dot DLL, and it evaluates the environment to make sure things look good.

30:39.760 --> 30:51.020
I'll give you one simple example, if you've heard of stack pivoting before, Microsoft had the blue hat challenge, and that was 2012, that was a long time ago, but they paid over a million dollars U.S.

30:51.020 --> 31:01.400
to the first place winner, and then they had three places, first, second, third, and what they were looking for is help from the community to stop return oriented programming.

31:01.400 --> 31:14.400
And one of the main things that we would do in use after free exploits on browsers, is we would pivot the stack pointer out to the heap, because the stack pointer is a register that only is supposed to point to the current thread stack at the top of it,

31:14.400 --> 31:22.140
let's not get into speculative execution and such, but you know what I mean, and we like the stack pointer because of three powerful instructions, push, pop, rep.

31:22.160 --> 31:25.240
That's the only register that those instructions exist for.

31:25.280 --> 31:37.160
So that power, we want that in other places in memory, so what we would do is use an exchange gadget and it would exchange or pivot the stack pointer with another register like the accumulator register.

31:37.180 --> 31:43.280
That would make it so the stack pointer points out on the heap somewhere, where maybe our ROP chain is, our exploit code is.

31:43.280 --> 31:44.340
So great, it works.

31:44.340 --> 32:02.320
So anti-ROP, which came out right before Blue Hat, was on Windows 8, all it did was it looked at something called the thread information block at the stack boundaries, the stack high and stack low limits, to make sure that the stack pointer points where it's supposed to before allowing a critical API to be called.

32:02.320 --> 32:09.240
Very simple thing and it was very easy to get around, but it showed you Microsoft was taking return oriented programming seriously.

32:09.260 --> 32:17.440
And then after that a whole suite of mitigations came out, like 6, 7, 8, simulate the execution flow, just many others .

32:17.740 --> 32:22.220
So again, a lot of these hook and then they inspect and you move on.

32:22.240 --> 32:28.500
Not all of them though , some of them are enforced in user LAN, some of them are enforced in the kernel, and other factors.

32:28.500 --> 32:30.960
So let's look at one more closely.

32:31.760 --> 32:40.340
So create process, a little C++ program I put together, lifted code of course too, and all it does is it calls create process.

32:40.340 --> 32:47.120
There was a mitigation that Microsoft came out with called, do not allow child processes.

32:47.420 --> 32:55.040
And that was called the calculator killer, because obviously a lot of times people would use shell code to pop a calculator to prove that it worked.

32:55.040 --> 32:58.280
Well this mitigation would kill that and prevent it from happening.

32:58.380 --> 33:05.400
So a lot of times if you're exploiting like Microsoft Word or a browser or anything else, you want to create a new process.

33:05.700 --> 33:09.220
This mitigation would stop you from being able to do it.

33:09.220 --> 33:22.440
So when I first saw the mitigation, I just assumed that it hooked create process in user LAN, somewhere around NTDLL or something, it grabbed it, and then payload restrictions would just inspect it and it would just prevent you from being able to do it.

33:22.440 --> 33:25.420
But this one ended up being a kernel in force protection.

33:25.860 --> 33:30.520
So first off, this is the code, you compile it, and great, simple.

33:30.560 --> 33:32.960
When you run it,

33:36.340 --> 33:39.980
so I'll make sure this seems to be acting weird here.

33:44.100 --> 33:45.140
All right, there we go.

33:45.580 --> 33:49.260
So when you run it, you can see on command line right there, a calculator pops up.

33:49.420 --> 33:50.340
Exciting, right?

33:50.340 --> 33:52.040
But that's what it's job was.

33:52.040 --> 33:56.780
That's what it was supposed to do, is just pass in an argument and it executes and creates a process with that argument.

33:56.780 --> 33:57.440
Simple.

33:57.560 --> 34:05.140
Then I go into exploit guard, that's a little snippet on the top right, and I turn that specific mitigation on.

34:05.140 --> 34:09.240
You can see there's audit mode and then there's enabled mode, and I just enabled it.

34:09.440 --> 34:14.300
And then when we try to run it, you can see the command prompt in the middle, it said create process failed.

34:14.420 --> 34:16.240
Okay, the mitigation is working.

34:16.440 --> 34:21.200
Down at the bottom, you can see that as a defender, you want to watch these things.

34:21.200 --> 34:23.160
So here's one thing, I'll take a step back.

34:23.160 --> 34:29.180
A lot of administrators are afraid to turn on these mitigations, the ones that aren't turned on by default by Microsoft.

34:29.540 --> 34:36.000
And Microsoft's kind of in a catch-22 situation because if they turn all the mitigations on that are available, they might break your applications.

34:36.040 --> 34:40.360
Because some of your developers have to adhere to the way in which these mitigations work.

34:40.360 --> 34:44.000
But if they don't turn them on, then you're mad at them because they didn't protect you.

34:44.000 --> 34:45.660
So they're kind of in a bad spot.

34:45.660 --> 34:47.820
So they wait until things are mature enough.

34:47.820 --> 34:50.180
A perfect example would be shadow stacks.

34:50.180 --> 34:54.760
If you've heard of shadow stack, it's a relatively newer mitigation though not in theory.

34:55.000 --> 34:57.780
Early 2000's someone mentioned the idea of that.

34:57.780 --> 35:05.460
It creates a copy of return pointers and it requires at least an Intel Tiger Lake CPU.

35:05.940 --> 35:10.920
So obviously not everybody's running one of the newest processors and they're not just going to turn that on by default.

35:10.920 --> 35:12.220
So they have to wait.

35:12.260 --> 35:15.100
So a lot of these, you do have to go on and turn them on.

35:15.100 --> 35:23.800
I remember Microsoft released a paper a long time ago and said the adoption rate for the enhanced mitigation experience tool kit, Emmet, was under 5%.

35:23.800 --> 35:29.240
So under 5% of organizations were actually using Emmet in any way shape or form.

35:29.240 --> 35:35.800
Because the admins maybe don't understand how the mitigations work at a very technical level and they don't want to do the screen test.

35:35.800 --> 35:39.020
There's also performance hits associated with these mitigations.

35:39.120 --> 35:42.080
One nice thing you can do though is turn on that audit mode.

35:42.080 --> 35:50.200
It's almost like an intrusion detection versus intrusion prevention where it tells you about a potential problem but it doesn't actually block it.

35:50.300 --> 35:53.940
So you've got the power to do that and then you can look in the event logs.

35:53.940 --> 35:59.040
There's a specific event log area for user LAN mitigations and kernel LAN mitigations.

35:59.040 --> 36:00.860
And that's what you're seeing at the bottom there.

36:00.860 --> 36:07.720
When I ran that program to execute the calculator, that new log popped up that said a mitigation was blocking it.

36:07.820 --> 36:10.520
That's right there what told me it was kernel enforced.

36:11.160 --> 36:20.480
So looking at the NTOS kernel here, when I set a break point on create process and let it continue, it went straight into the kernel.

36:20.480 --> 36:25.560
So it told me right there, validated that this is not a kernel, sorry user LAN enforced mitigation.

36:25.780 --> 36:34.300
So I went into hex, I used hex rays obviously and I used wind debug and went in and set some break points on those functions right there.

36:34.300 --> 36:43.080
Like PSP get no child process restricted policy or SC token is no child process restriction enforced.

36:43.080 --> 36:48.840
These are by symbol name because thankfully Microsoft gives us the symbols, the PDB files.

36:48.840 --> 36:53.860
We can go and look for things that look like they might be associated with the mitigation that we're curious about.

36:53.860 --> 36:58.480
So I set the break points on there and then we run it, it immediately gets hit.

36:58.480 --> 37:00.000
But look where it gets hit.

37:00.000 --> 37:08.160
It gets hit when I'm in the command prompt trying to start that C++ wrapper program, the create process program.

37:08.360 --> 37:15.180
Because that's the program we turned exploit guard mitigation on in the settings as you saw in the last slide.

37:15.460 --> 37:16.680
So it makes sense.

37:16.800 --> 37:22.820
So we hit a break point on the setting API, the one that sets the mitigation.

37:23.300 --> 37:30.180
Over on the right there, if you're not familiar with the Virgilious project, it's everybody I know's go to if you're looking at kernel structures.

37:30.260 --> 37:38.760
It is a brilliant resource and every single Windows version, kernel version, every build, every creator's update, whatever, is tracked there.

37:38.760 --> 37:45.440
Because a lot of times when you're doing things like token stealing in the kernel, you need to make sure that your offsets are correct.

37:45.580 --> 37:55.900
There might be a structure like E process or K process, K thread, E thread and you need to make sure that what you think like AP links at a certain offset is still there depending on the kernel version.

37:55.900 --> 38:00.240
So you can look at these structures, look at the members and you can update your shellcode accordingly.

38:00.560 --> 38:12.080
But either way, I saw an instruction and you can see in the code in the top middle, in the white area, it says move into racks, GS segment register, offset 188 hex.

38:12.120 --> 38:20.340
So the GS register, while under the context of the kernel, points to a structure called the kernel processor control region, a very large kernel structure.

38:20.400 --> 38:27.040
And nested inside of that is something called KPRCB, the kernel processor region control block, which is a mega structure.

38:27.280 --> 38:33.260
What it's telling us at offset 8 within that nested structure is what we're dereferencing.

38:33.260 --> 38:35.740
It ends up being the K thread pointer.

38:36.020 --> 38:40.240
K thread and E thread and K process and E process are kernel things.

38:40.240 --> 38:46.360
If you've ever heard of the process environment block in user land, the PEB, E process is like the equivalent in the kernel.

38:46.360 --> 38:54.100
If you've ever heard of the TIB, the thread information block, K thread, E thread, the executive and kernel thread, those are the relative entries in the kernel.

38:54.100 --> 38:56.100
Not 1 to 1, but it's pretty close.

38:56.200 --> 39:01.140
So either way, we're dereferencing and grabbing the K thread pointer for the current thread.

39:02.220 --> 39:05.580
So let me go in further and we're checking out our progress here.

39:05.580 --> 39:11.660
You can see that I run this fancy window bug command and we're basically saying, what is our current process?

39:11.740 --> 39:17.460
And it tells us that the current process is the, uh, which one, command.exe.

39:17.460 --> 39:18.940
That's not the process I want to be in.

39:18.940 --> 39:20.300
So we let it continue.

39:20.400 --> 39:26.940
We hit the break point again and then we look at the current process and now we're in the create process C++ program where we want to be.

39:26.940 --> 39:30.060
So now we know where we want to be, where we're at, where we want to be.

39:30.120 --> 39:38.740
It's important to mention that because when you set these types of break points, they will get hit often unless you set process specific break points as a kernel debugging session.

39:38.740 --> 39:42.720
So you want to make sure you understand what context you're under for each, you know, process.

39:43.060 --> 39:49.620
And then we hit our break point on the SC token set no child process restricted function.

39:49.960 --> 40:00.820
So this means that we're under the context of the create process C++ program and that mitigation function has just been called and it says set no child process restricted.

40:01.100 --> 40:08.860
So you go into hex rays and you decompile it and you say, hey, let's take a look at this function and that's what you're seeing on the right there.

40:08.860 --> 40:11.260
I know it's kind of small, again slides will be released.

40:11.380 --> 40:15.440
Put some circles around some variables because we don't know what those variables are.

40:15.480 --> 40:17.460
Thankfully we get symbols from Microsoft.

40:17.460 --> 40:23.700
Thankfully hex rays and IDA pro are brilliant, it's a brilliant disassembler and we get the function prototype data.

40:23.700 --> 40:30.940
As long as you know what the structure is, you can say, hey, I know this is a token structure because MSDN told me on the left, on the top there.

40:30.980 --> 40:39.480
And then once you do that, you see that it's able to then go in and add all the symbols, define everything that you want to see.

40:39.480 --> 40:54.520
On the right there, I did a stream a while ago on documenting undocumented structures and it was all about looking at different bit masks in the kernel and E process and the token structure to understand what the mitigation bits are and to show you kind of how to do that.

40:54.520 --> 41:09.500
This is a reference from Google that shows us that these different bit mask numbers, you'll see lots of booleans like ands and ors and those are either turning on or clearing bits in the bit mask so that the mitigation flags are set to the state that they're supposed to be in.

41:09.720 --> 41:18.260
So I went through here and I added a bunch of comments because obviously it's helpful especially if you're not used to debugging or disassembling and decompiling kernel structures.

41:18.440 --> 41:20.880
But that defines everything that's happening.

41:20.880 --> 41:23.980
Basically we're getting a token or acquiring a lock on the token.

41:23.980 --> 41:28.120
We're initializing a variable which ends up being the token , the current token.

41:28.140 --> 41:32.340
And then we're going in and we're checking bits that are set in the bit mask.

41:32.340 --> 41:37.260
And these bit masks bits are things like, is it in audit only mode?

41:37.260 --> 41:39.300
Should it be turned on and enforced?

41:39.300 --> 41:41.620
Is the low box token thing associated with it?

41:41.620 --> 41:43.560
What setting should I do?

41:43.560 --> 41:49.720
And through the boolean operations it turns on the appropriate bit which then sets the mitigation on.

41:50.560 --> 42:06.180
That is pretty much how that mitigation works and that's why it's being blocked because the next thing that would have happened had we kept going, the get function would have gotten called and it would have checked that bit to see if that program has the authority to spawn a new process.

42:06.660 --> 42:12.520
So that's kind of what we learned by going through that and that's how easy it can be to understand mitigations to see if you can get around them.

42:12.520 --> 42:17.440
So from that you're like, well then can I get around this somehow?

42:18.040 --> 42:27.160
Obviously the first thing you want to do is Google, go to chat GPT or your favorite AI LLM whatever and say, hey can you tell me about any bypass techniques that may be publicly available?

42:27.160 --> 42:34.460
But if there are no publicly available ones, hey you've got a great opportunity to do some cool research and make it public if you can find something.

42:34.720 --> 42:45.420
Some examples down there towards the bottom, there was a technique , I forget who discovered it but I put the link there where you can impersonate the anonymous token to get around the mitigation and spawn a new process.

42:45.420 --> 42:47.860
I don't think that still works but it was an option.

42:48.020 --> 42:57.540
You can use WMI like if you're in the context of Microsoft Office and you can use some cool PowerShell or WMI to get around the mitigation that way.

42:57.540 --> 43:03.780
There's process migration potentially, you can use reflexive DLL loading where you load from memory, something into memory.

43:03.780 --> 43:12.660
That also gets you around other mitigations like CIT, ones that are preventing you from loading an unsigned DLL from your Windows box.

43:12.820 --> 43:19.540
And again, setting it accordingly, enforcing the protection and getting around it with things like reflexive DLL.

43:19.540 --> 43:25.360
So, there's a bunch of ways we could potentially get around it and that's why it's so important that you put a bunch of these together.

43:25.360 --> 43:28.340
That you're not just relying on any one mitigation.

43:28.340 --> 43:42.240
I remember Microsoft made a pretty bold claim, somebody there, said CFG, control flow guard, should be a strong enough mitigation that it can prevent the majority of exploitation techniques where Emmet may not be needed as much.

43:42.240 --> 43:46.660
That ends up not being entirely true because CFG is another one you could potentially get around.

43:46.660 --> 43:50.800
People have demonstrated that even with V8 on Chrome.

43:52.280 --> 43:55.060
So, this right here, I just wanted to point it out.

43:55.240 --> 44:01.720
There are two fields and rest in peace to Jeff Chappelle, brilliant individual who passed away recently, sadly.

44:01.780 --> 44:17.940
But he maintained this site and I hope it stays up forever because every time Microsoft would make a structural change or add a new mitigation, like if you can see the ones towards the bottom on the right, mitigation flags too, you see things like control flow enforcement technology and shadow stacks.

44:17.940 --> 44:19.860
Those are relatively new mitigations.

44:19.860 --> 44:25.240
And these are bit masks that are set as a member of the e-process structure.

44:25.300 --> 44:27.560
And those are the things that are being checked.

44:27.560 --> 44:38.060
That's why a lot of times you might hear people getting around SMEP, like supervisor mode execution prevention, by setting a bit or flipping a bit inside a control register while under a certain context.

44:38.440 --> 44:41.500
Getting around patch guard by doing it fast and doing a race condition.

44:41.640 --> 44:49.800
So, the more you understand from an offensive perspective about these mitigations, the more you'll be able to get around them potentially or know when to call it a day.

44:49.800 --> 44:51.580
For me, it's all about saving time.

44:51.580 --> 45:00.840
If I know a mitigation is likely on and I'm doing a patch dip or find a zero day and I think it's not going to be fruitful for me to continue down that path, you got to pay your dues though.

45:00.840 --> 45:03.500
You will have those harsh, frustrating days.

45:03.500 --> 45:04.900
I still have them all the time.

45:05.200 --> 45:22.100
From a defensive perspective, it really helps you to understand how these mitigations work so that if you don't want to turn all of them on, you know which ones are going to be more beneficial, which ones have less overhead, which ones actually do stop an exploit technique and which ones are pretty useless.

45:23.300 --> 45:41.000
So, some takeaways, I think I went through some already, but it's a lot of nuance and I think that that gives us power where AI won't take over our jobs anytime soon because the circumstances in which you will be doing your research requires something that machine learning just can't do right now.

45:41.520 --> 45:44.720
And there's synergy there as well when working with other researchers.

45:45.140 --> 45:49.800
The golden years of binary exploitation can be behind us, but it's not going away anytime soon.

45:49.800 --> 45:54.140
People ask me, they probably ask you all the time, for how much longer am I going to be able to do this?

45:54.960 --> 45:56.500
As long as it's possible.

45:56.500 --> 45:57.680
People are going to keep doing it.

45:57.680 --> 46:01.280
It's a lot harder now, but I use an analogy like Tony Hawk, the skateboarder.

46:01.280 --> 46:05.460
What he was doing in the 1990s, there's like an eight-year-old kid able to do that today.

46:05.460 --> 46:16.660
We're just, all this information is out there to get you up to speed from all the research done in the past, fast, so that you can then go and bring about novel exploitation techniques and new zero days.

46:16.900 --> 46:21.100
And the ethical considerations are something that you have to understand and think about.

46:21.520 --> 46:28.060
There's new acts and new legislation out there, like Paul Maul and such, that we have to worry about.

46:28.320 --> 46:37.720
But as you probably know, the more you push researchers and say you can't do something, the more likely they're going to go unethical route and sell it on the dark net and make money that way.

46:38.120 --> 46:40.740
So, mitigations are a real thing.

46:40.740 --> 46:44.640
They're hard, but they're not going away and you just have to deal with it.

46:44.860 --> 46:48.900
You have to think about it as if there's always a way around it.

46:48.900 --> 46:51.400
And the prize will continue to grow.

46:51.400 --> 46:54.600
What was $10,000 is $500,000 now.

46:54.600 --> 46:57.140
So it is worth your time putting months into research.

46:58.120 --> 47:04.200
So references and thanks, there's always more people than I can remember to thank, but lots of researchers out there in the past.

47:04.200 --> 47:09.300
Jeremy Tinder, just a shout out to him for getting me those Microsoft documents or those updated charts, which is cool.

47:09.300 --> 47:12.860
Brad Spangler helped me out with going over some things, so I'm not going to go through everyone.

47:12.860 --> 47:19.720
Harun Mir is the individual I said that did a talk from 2010 that went through every single mitigation that ever came out.

47:19.720 --> 47:21.460
It's a beautiful document.

47:21.520 --> 47:23.060
Definitely check that one out.

47:23.100 --> 47:24.440
And a lot of other folks as well.

47:24.440 --> 47:26.200
Thanks to DEF CON for selecting a talk.

47:26.440 --> 47:27.520
That is it.

47:27.520 --> 47:29.000
I think I'm right on time here.

47:29.000 --> 47:34.240
I'm happy to, you know, chat out in the hall because I know I've got to make way if you have any questions, but thank you so much for coming to my talk.

47:34.240 --> 47:35.300
I really appreciate it.

