WEBVTT

00:08.680 --> 00:10.000
Hello everyone.

00:10.120 --> 00:21.860
Today I'm going to be talking about Windows Kernel and how it's, from a security research perspective, how it changed in the past years and how we need to adapt.

00:22.900 --> 00:32.160
And so it will be mainly in the view of memory corruptions, not because I think that's most important, but just because I like them, as I like the Kernel and the risers.

00:33.820 --> 00:37.800
So, at first, we can start with a small introduction of who I am.

00:37.900 --> 00:39.880
I'm Peter Zierman.

00:39.880 --> 00:43.320
I'm working currently for KeyLab at Ensys.

00:43.320 --> 00:57.820
I'm a former team employee, a team member, and I was also ranked in MSS since 108 several times and also on 1.1 with my team, with our team several times, and this is my focus.

00:57.820 --> 00:59.540
It's on Windows Kernel.

00:59.760 --> 01:05.660
The risers, basically, are not too much about machine learning.

01:05.660 --> 01:15.400
It's understanding how it works, every kind of internals, but mainly about fuzzing and the machine learning to understand how to fuzz it in a good way.

01:16.220 --> 01:22.580
And also I like to apply the mitigations, understand them, correct them, and hopefully improve them.

01:22.580 --> 01:30.660
And also sometimes you can see me talking somewhere, for example, at home, or during the night, or somewhere else.

01:31.000 --> 01:40.760
And because I'm Chinese, I also like Wushu, but I don't particularly like it.

01:41.800 --> 01:57.860
So when it comes to security research and you ask somebody, some security researcher, to get code execution targets, first what comes to his mind is what is sandbox.

01:59.160 --> 02:06.180
It's basically some set of policies which tell you what you can and what you cannot do.

02:06.180 --> 02:14.240
For example, when you want to attack some target and get code execution into it, first you need to find a vulnerability.

02:14.240 --> 02:17.900
For this one, it's essential how easy it is to attack your place.

02:17.900 --> 02:28.200
But when your sandbox policies tell you that you are not allowed to call a lot of functionality, that means it's bad news for you.

02:28.200 --> 02:34.280
Because you have harder times to find a vulnerability because you don't have so many options.

02:34.280 --> 02:41.020
And on the other hand, even if you find a vulnerability, you may not be able to exploit it.

02:41.020 --> 02:54.620
Because exploitation and finding vulnerabilities, maybe you need to have two different resources, which overlap, but it can happen that you find a vulnerability but you cannot exploit it.

02:54.620 --> 03:11.400
And except for syscalls, I mean, also intactly depending on sys, everything about syscalls, but explicitly disabling some syscalls, it's very important to restrict those access to file system or registry.

03:11.420 --> 03:22.760
Because registry is basically configuration of your computer, and when you are able to configure someone else's computer to register you, and the same applies for file access.

03:22.760 --> 03:31.340
Basically, because when you are able to read and write any file on the user system, you won't anyway, because that's what you really want to do.

03:31.860 --> 03:41.700
And another thing is that it's really important to also restrict how some processes can communicate with some other processes.

03:41.800 --> 03:42.480
Why?

03:42.480 --> 03:44.660
And that's exactly because of sandbox.

03:44.660 --> 03:50.080
Because sandbox policies can restrict you to something, and it can be really restrictive in your targets.

03:50.200 --> 04:03.680
But when you can access different processes, then you may be able to escape and get code execution to the process, and that process has a less restricted sandbox.

04:03.760 --> 04:09.940
And you can access more on the surface and use more options how to call the system.

04:10.920 --> 04:16.100
And as I just mentioned, there are different kinds of sandboxes and different input levels.

04:18.800 --> 04:21.240
Less restrictive means more problems for you.

04:22.160 --> 04:31.220
But still, even when you have a sandbox, it can look like, okay, it can be... I mean, it's tougher, definitely, but it's not game over.

04:31.220 --> 04:39.160
Because still, for example, somebody develops an application, you want the targets.

04:39.160 --> 04:43.600
But that application essentially needs to interact with the system.

04:43.740 --> 04:48.440
For example, it may need to store some files on the disk.

04:48.840 --> 05:01.360
But this is dangerous, because even if sandbox allows you to store some files in some new directory just for you, there are some other entities, some other processes, which can scan this file.

05:01.720 --> 05:06.040
And as well, in this scanning process, there can be some vulnerabilities.

05:06.040 --> 05:12.780
And you can end up dropping files, and by that file you are dropping a different process, which is usually less restricted.

05:13.880 --> 05:18.040
And another thing, as I mentioned, is inter-process communication.

05:19.760 --> 05:21.780
Processes need to communicate.

05:21.780 --> 05:28.660
And especially with an application, it can be said, okay, I want to apply sandbox policies to this application.

05:28.900 --> 05:40.540
Because I know that, for example, some parts can just compute something, other parts may just pop up some nice windows and graphics, and some other parts doing some network communication.

05:40.660 --> 05:47.120
So for every part, I can have different sandboxes, and these can be different policies applied to different parts.

05:47.120 --> 05:53.560
Some of them can have restricted access to some parts, and some of them will be restricted to other parts.

05:53.640 --> 05:58.880
But at the end, all of them cooperate to achieve the same goal of the application.

05:58.880 --> 06:00.940
So they need somehow to communicate.

06:01.360 --> 06:06.460
And you can most likely also attack this infrastructure.

06:06.700 --> 06:25.940
That means when in your application, you communicate with other components, different processes in your application, but, for example, when in one application you cannot access, for example, certain syscalls, you may extend to the second process, which may be semi-technical at all,

06:25.940 --> 06:29.860
but there are some different restrictions, and it does have some limitations.

06:30.200 --> 06:33.980
It's a better background for you to start building exploits.

06:35.320 --> 06:45.000
And I said that Windows Kernel syscalls, but when you access any resource on machines, everything is about syscalls.

06:47.440 --> 06:55.860
So when it comes to Windows Kernel, I'm focusing on Windows Kernel, not because I think it's most important, but because I like it.

06:56.120 --> 07:08.080
And in the past, in fact, it was probably one of the most important parts, because all these sandbox policies not all, but a lot of crucial ones are decided in the kernel.

07:08.080 --> 07:14.740
So once you get some read-write in the kernel, with some control over the kernel, you can change the policy.

07:16.000 --> 07:17.740
And it's pretty neat.

07:18.420 --> 07:33.980
So when it comes to finding vulnerabilities and exploitation in kernel, then usually by sandboxes, for example, like C++, there are a few different categories of Windows Kernel, where you want to look for.

07:33.980 --> 07:35.420
It's top priority.

07:35.640 --> 07:36.600
I would suggest Swing.

07:36.600 --> 07:39.420
It's OK, because it's really huge.

07:39.440 --> 07:46.240
It's really old code, and I mean, they have more than 1,000 syscalls.

07:46.360 --> 07:49.520
It's a lot of things that are going to happen wrong.

07:50.280 --> 07:55.960
But recently they are going to refactor it, and we'll change the way we're talking later on.

07:56.220 --> 07:59.060
But the other thing, another part is ntusk kernel.

07:59.060 --> 08:11.580
It's also big, but on the other side, when you look at the CVs published by Microsoft, you cannot see too much, at least for memory corruption, too much memory corruption related to this part.

08:11.660 --> 08:12.480
And why?

08:12.480 --> 08:14.400
It's also really big.

08:14.400 --> 08:16.380
It's hundreds of syscalls.

08:16.380 --> 08:35.700
But the reason is that in this component, it's heavily used access-privileged checks and tokens, and it's restricted to not only what kind of syscall you can access, but what you can do.

08:35.700 --> 08:42.540
And it's checking, OK, you are not allowed to access this resource, so it just denies it.

08:42.540 --> 08:57.800
And the other thing is that logic that you can alter from via syscalls for these components, it's not so heavy for the work that they need to do, it's not so complicated.

08:57.800 --> 09:02.860
You can alter, for example, allocating memory, you free memory, you protect memory.

09:02.860 --> 09:06.600
Yeah, it's complex, but what you can alter, it's not so much.

09:06.600 --> 09:12.320
And also some lock or unlock mechanics, not so heavy logic you can play with.

09:13.320 --> 09:15.600
At least not for memory protection.

09:15.600 --> 09:18.940
You can find this, but it's hard, at least for int2k.

09:19.940 --> 09:39.680
But today it's not only about core components like MQS kernel or graphics subsystem, but there are a lot of different drivers, the windows kernel, but fortunately or unfortunately, it depends how you look at it, for our sandbox, usually you don't have access to it,

09:39.680 --> 09:41.320
at least most of the parts.

09:41.380 --> 09:45.840
But still, there are some interesting drivers which you can access.

09:46.440 --> 09:55.380
And when you're doing security research, you should be able to look further and to be more creative to find your different targets.

09:55.380 --> 10:05.660
Because when you find some links, some way how to attack some new attack surface, it's not like a jackpot for you, because it's probably not so well researched, it's not so well protected.

10:07.980 --> 10:14.320
So, taking interconnection with int2k, as I said, it's a really huge codebase and it's really old.

10:14.780 --> 10:33.840
So, at least for example, 4 years ago, when I started with exploitation, multi-networking, and hinting, I was really disappointed when I got my hands on int2k, because I got from my colleague a PDF bug, and OK, make exploitation.

10:33.840 --> 10:42.380
So I spent, I think, maybe one or two weeks just for understanding of how PDF works and basically analyzing the root cause of the bug.

10:42.660 --> 10:48.460
But then I get somehow, OK, I can inspect it once, so I can do some memory write or something.

10:48.540 --> 10:53.400
Then it takes me only, for example, two days to finish full exploit with code execution.

10:53.400 --> 10:59.560
And it was pretty much disappointing, because it was not my challenge.

11:00.320 --> 11:04.680
But it's changing, and it's very good.

11:05.020 --> 11:10.440
I mean, from my perspective, because I enjoy it more, and from security perspective, because it's becoming harder.

11:11.140 --> 11:18.840
And some changes that was introduced was that because, for example, 4 years ago, as I mentioned, I was working on TTF exploitation.

11:19.080 --> 11:23.500
But for now, TTF bugs, it's not so prominent now.

11:23.500 --> 11:33.760
Because they put it from the kernel mode, from custom foams to user modes, they get into some fairly restricted sandbox.

11:33.820 --> 11:52.120
So it means even if you can somehow find the vulnerabilities, for example, system foams, where you can't load your custom, if you can't load your custom foams, and you try to exploit, even if you exploit successfully, you end up in fairly restricted environments,

11:52.120 --> 11:55.780
most likely more restricted than you begin with.

11:56.000 --> 11:58.240
And that's the problem of 4 years exploiting.

11:59.200 --> 12:02.760
And also then, there is still Mint2K.

12:03.300 --> 12:07.940
For example, I mostly have Mint2K for several of my parts.

12:07.980 --> 12:10.860
A few of them are user parts and GTF parts.

12:10.920 --> 12:17.460
GTF part is responsible for driving a lot of some pretty nice things on screen.

12:17.940 --> 12:21.020
And the magic of this part is that you have a lot of objects.

12:21.020 --> 12:27.520
You have Bitmap, you have PC, you have Region, you have Palette, you have a lot of different objects.

12:27.840 --> 12:31.780
And the joy of this is that you can actually interact with each other.

12:31.780 --> 12:33.980
And the interaction is a problem.

12:34.060 --> 12:48.480
Because even if there will be no such complex code behind, it's still, when you say OK, for some object, OK, do this thing, but it incorporates this second object, it introduces a lot of problems.

12:48.480 --> 12:51.360
Because it needs, it has some connection.

12:51.360 --> 12:53.820
It can have some reference counting to each other.

12:53.820 --> 12:57.340
It can have some members dependent on the other members.

12:57.340 --> 12:59.460
And it can cause different problems.

12:59.460 --> 13:02.780
Like user-to-preset confusions, even overflows.

13:03.120 --> 13:10.220
But fortunately, Microsoft started to link this one some years ago.

13:10.220 --> 13:13.060
And they introduced, they started refactoring the code.

13:13.060 --> 13:21.860
And it's adding some filter sets, which basically tell you, OK, you cannot access these Ciscos, but you can access most of the Ciscos.

13:21.860 --> 13:24.100
Depends how you set your filter.

13:24.580 --> 13:28.980
But it's even better, you can even prohibit all of the big 2K Ciscos.

13:28.980 --> 13:30.240
That's pretty nice.

13:30.240 --> 13:35.100
But at the end, when the application is basically working, interactive user, you need it.

13:35.100 --> 13:37.960
So at some point your application, some process, will have access.

13:37.960 --> 13:41.620
But this filter set is meant for this one.

13:41.620 --> 13:46.440
And it's access only to the necessary functionality of this 3G 2K.

13:48.180 --> 13:50.240
And of course, there's the user part.

13:50.240 --> 13:53.080
And the user part is a huge thing.

13:53.080 --> 14:03.420
Actually, it was about 10 years ago, 15 years ago, there were some nice researches about using more callbacks.

14:03.460 --> 14:07.340
Basically, you decide, OK, I will call to Kernel.

14:07.340 --> 14:11.060
But Kernel will decide, OK, no, no, no, I need some more information.

14:11.060 --> 14:14.880
So what it will do, it will just stop and call back to user modes.

14:14.940 --> 14:17.800
But without exiting actual Cisco.

14:17.800 --> 14:32.720
And this is actually a big problem, because it's basically your state is pending, and you can involve some other threads to do something with the states of the country that this object is behind.

14:34.060 --> 14:36.000
It's hard to mitigate.

14:36.000 --> 14:39.040
But, as I said, with filter sets, it's harder to...

14:40.140 --> 14:42.800
It should be harder, to be true.

14:42.800 --> 14:47.140
But unfortunately, filter set allows all of this, user mode callbacks.

14:47.340 --> 14:49.000
And this is still a big issue.

14:52.140 --> 14:56.440
So, as I said, they're starting with filtering Cisco's.

14:56.440 --> 14:57.920
And it's the shortest request.

14:57.920 --> 15:05.820
I think this is the most efficient way how to protect some crucial parts of anything.

15:06.480 --> 15:14.440
And then, they don't stop here, but they go further for, OK, user vulnerability.

15:14.480 --> 15:15.760
That's the techniques.

15:15.760 --> 15:18.440
But now, can you somehow use this vulnerability?

15:18.600 --> 15:22.660
And that's, for example, this tag installation I will tell you about later.

15:22.660 --> 15:33.120
And as well, for target no mitigations, basically telling you, OK, you're using your vulnerability, you managed to somehow work with it, but can you actually use it for something meaningful?

15:33.120 --> 15:37.220
Like, read the rights to your targets, to get them.

15:38.040 --> 15:41.300
And also, the other thing is that excessive mitigations.

15:42.220 --> 15:53.160
Since Microsoft started to pay attention to this one, and they introduced a lot of programs like MS-DACI, Tobana, JIT, they need to decide their bounties.

15:53.580 --> 15:59.360
And all of this somehow encouraged researchers to publish, to report the more bugs.

15:59.360 --> 16:01.020
And you can see on the...

16:01.460 --> 16:13.500
For example, when I was fuzzing, when I was fuzzing the Mint 2.0 game, before, I found some bugs, some shallow bugs, but it can survive.

16:13.500 --> 16:15.520
One year, no problem.

16:16.280 --> 16:22.280
I don't make POC because I want to do more work, for example, on fuzzer itself.

16:22.540 --> 16:29.040
And I can come back to the bug, I think, one year later, and then I can make POC and make it useful, for example, on different competitions.

16:29.040 --> 16:41.420
But last year, I said, I still work on improving fuzzer, but then I see, OK, I have some bunch of bugs, but three months later, it was fixed.

16:41.420 --> 16:47.020
It was OK for some other bugs instead, but those bugs were fixed already.

16:47.020 --> 16:48.340
And it was really unexpected.

16:48.480 --> 16:58.000
So it seems that this is helping that security researchers are reporting bugs, and that they should probably do some internal fuzzing, which is really good for security.

16:58.960 --> 17:03.900
But on the other side, still, if it's OK, it's still alive.

17:04.080 --> 17:04.540
Why?

17:04.540 --> 17:15.260
It's because even when you have a more explicit filter set, still, you can access a lot of DirectX syscalls.

17:15.620 --> 17:27.180
And DirectX is pretty much a huge part, and still, it's, for example, the main component, which handles Microsoft itself.

17:27.180 --> 17:37.540
It's not so heavy logic, because it's only some allocations behind, but still, it's about four or five different objects, and you can interact, so you can find the bugs there.

17:37.840 --> 17:42.640
It's not promising as a user-oriented API, but still, good address interface.

17:42.920 --> 17:54.580
And in addition, when you're able to reach some bugs, which is not coded by Microsoft, but third-party vendors, like graphic vendors, they usually do some data parsing in Kernel, and this is probably the best.

17:55.800 --> 18:06.320
And as I mentioned, user-mode callbacks, still there, even with big filter sets, so this is also a problem, but probably they will somehow change it, maybe.

18:06.320 --> 18:06.720
Let's see.

18:06.720 --> 18:10.880
For now, it can be good source of bugs, and we'll care for it.

18:12.100 --> 18:20.800
And still, yes, it's still a smart part of GDR, but it's early, less and less, that you can attack, which is good.

18:21.820 --> 18:41.280
But still, even when you have applied, for example, all of these filter sets and lockdowns on IP2K, still it's possible that you can, as I said, your IPP can have more processes connected to each other, and some of them can have less restrictions on this IP2K.

18:41.280 --> 18:48.880
And so it's just a matter of getting it to get to those different processes, which you can use to call more systems.

18:49.640 --> 18:50.920
It's possible.

18:52.080 --> 18:55.800
So, coming to the next part, it's about the end-use kernel.

18:56.240 --> 19:00.840
This end-use kernel is also big, but it's harder to find a buyer for that.

19:00.840 --> 19:01.560
Why?

19:01.980 --> 19:24.400
The reason why is that, because this core component, as I heard from Max's guys, they put a lot of effort to review the code, it's a long time, and that's STL, and they take pretty much care that the things that you can use that you can access from low privilege level,

19:24.400 --> 19:25.960
it's well-reviewed.

19:26.460 --> 19:41.140
And that's for attacker, it's really bad, because, I mean, when you have logic like a lock, unlock, allocate, it's free of using the pipe or using the LPC, and it's really without defense.

19:42.220 --> 19:45.260
You can have a hard time to find that bug.

19:45.420 --> 19:54.480
And even, for example, LPC, LPC is quite big, and it's good features and documenting, so you can hope that you can find more bugs there.

19:54.480 --> 20:07.000
I think you can find bugs there, but, for example, when Windows exploits some bugs using LPC mechanism, I can see from the code that it's really written with some security perspective in mind.

20:07.000 --> 20:09.940
There's a lot of security checks that I didn't expect.

20:10.160 --> 20:11.880
And it's pretty nice to see.

20:12.660 --> 20:26.520
And also, when you look at NQS, sometimes you might lack luck, like we had before, one or two years ago, when we discovered some new attacker interface, well, new for community, because not too many people know about it, this one.

20:26.680 --> 20:36.960
And it was TN driver and CLT driver, which, for them, basically, you can access some goods that are passing by in kernel with low privileges.

20:37.320 --> 20:42.880
But that's almost gone for CLTs, because it's now locked down from low-privileged processes.

20:44.940 --> 20:46.640
And that's LPC.

20:46.640 --> 20:48.100
LPC is pretty cool.

20:48.100 --> 20:54.120
It also communicates between processes, or between different processes.

20:54.420 --> 21:13.340
And when you strip apart, OK, my target may not be necessarily the kernel, but it can be some other process, which has more privileges, and you're looking for it, so LPC can be a good way to go for it, because, against that concept, you may target not the kernel part,

21:13.340 --> 21:21.420
or the mechanism, but you may target the parts where the different processes basically process your packet you send to them.

21:22.400 --> 21:30.820
And good news, not news, but good things, is that, I think, every process has to open at least one LPC port.

21:31.340 --> 21:44.460
And with some part of luck, you may find that some of your processes that you can open, or you have already opened, if that thing works, and open a few different and promising attack circuits.

21:44.940 --> 21:50.780
But it's based on LPCs that are undocumented, so it means that you can have a hard time to understand it.

21:50.860 --> 21:56.440
But fortunately, there was some good research by Alex Yunescu, which brings more light to this area.

21:56.660 --> 22:05.400
And also, there were recent papers about the attacking of Vista, and it was pretty nice.

22:06.960 --> 22:10.760
But ok, let's assume we have known everything.

22:11.360 --> 22:14.200
But it's game over, it's easy to explain.

22:14.560 --> 22:16.120
Well, let's see.

22:17.580 --> 22:23.460
Before freeze, yes, it was quite straightforward, it was easy.

22:23.480 --> 22:24.820
But now we're changing it.

22:24.820 --> 22:28.260
I'm not saying that it's impossible, or it's really hard.

22:28.280 --> 22:31.820
But definitely it's a bit harder, at least.

22:31.820 --> 22:36.740
And sometimes it can be not possible, in some corner cases.

22:37.660 --> 22:46.640
For example, as I mentioned, you have the filter sets, that restrict you some part of the syscode that you can use.

22:46.760 --> 22:50.480
Then you have lockdowns, which was applied for graphics, and also for CLFS.

22:50.960 --> 22:56.680
Before freeze, we find that CLFS is very dangerous, from under the level.

22:56.780 --> 23:03.300
And this year we see that, ok, there are lockdowns, it's nice.

23:04.060 --> 23:14.740
And then you have, ok, that's the first thing, if you have a vulnerability, you think, can I use it?

23:14.740 --> 23:17.820
Can I really trigger that vulnerability and use it somehow?

23:17.820 --> 23:24.340
That's for its tactical mitigations, and some kind of time isolation and other things.

23:24.420 --> 23:32.740
But even after, ok, I achieved the rights, now I want to do some code execution, and data flow control.

23:33.840 --> 23:38.880
Data flow control is still, somehow, not so well mitigated.

23:39.460 --> 23:41.700
I mean, probably not at all.

23:41.780 --> 23:47.540
But about the code execution, it's starting to be more challenging.

23:47.540 --> 23:52.060
There are a lot of bugs, as you can see on the right side.

23:52.500 --> 23:54.200
It's a lot of bugs.

23:54.360 --> 23:56.200
So what are these bugs for?

23:56.200 --> 24:00.100
If you don't know about them, I recommend those two articles.

24:01.820 --> 24:03.460
Those are pretty much essential.

24:03.500 --> 24:19.720
They finally open the priorities, what are they doing, what they are doing, what are plans, what are the problems with my implementation, and some weaknesses.

24:22.300 --> 24:26.600
I mean, it's pretty much informative, those two articles.

24:27.400 --> 24:29.780
And especially for you when you want to apply

24:34.900 --> 24:37.160
some public APIs.

24:38.540 --> 24:41.380
So for process mitigation, it's CFG.

24:41.380 --> 24:45.760
Probably most of you guys already know about this one, so just pay attention.

24:45.980 --> 24:58.280
Basically, when you freight writes to your targets, one pretty much common technique was just, OK, I know that, for example, it's C++ code, and you still need toggles.

24:58.280 --> 25:15.720
So my target is, OK, I just find the input table, I change it, and next time, when there will be some object which I can invoke in the virtual world, basically it will just use this address and jump to where I want, and I get code execution for free.

25:15.980 --> 25:28.960
But with CFG, basically before this toggle appears, it's just checking if it's destination address is relatively correct, or not.

25:31.820 --> 25:33.000
It's just some approximation.

25:33.080 --> 25:34.940
But how can they do it?

25:34.940 --> 25:49.440
Actually, when you compile your process, your application, the CFG, it adds some information to its header, and at runtime, they can restore those information in an efficient way.

25:50.200 --> 26:03.740
To do a quick check, as quick as possible, and to do some approximation of what is valid and what is not valid, it's a little bit error-free.

26:03.740 --> 26:17.860
I mean, it's not so effective when you have, for example, you're working with a target which has JavaScript inside or some scripting engine, because simply you don't need to use this technique to generate some input table.

26:18.100 --> 26:27.200
But for some remote attacks, for example, if you want to attack through SMB or through Hyper-V, it can be a real issue.

26:27.720 --> 26:31.800
And that's the only thing for mitigations.

26:31.820 --> 26:34.980
To make it harder for execution.

26:37.990 --> 26:38.490
And so...

26:39.170 --> 26:49.470
But this is some fatal flaw, because you protect only from forward edges, only from when you want to invoke some call.

26:49.510 --> 26:56.830
And so it means backward edges, like changing the return address, it's still heavily unprotected.

26:56.830 --> 27:09.310
So what you will do, changing the input table, if you can just make it easy, at least in JavaScript, and just on this tag invite the return address.

27:09.590 --> 27:15.110
That is true, but I mean that for quite a reason, because there are a lot of terrible things.

27:15.590 --> 27:17.430
And Neo4j was pretty nice.

27:17.510 --> 27:36.890
I mean, it was a nice idea, because they introduced new memory, and what they're doing, when you do a call, they basically, at the beginning of the function, which is protected by this technology, this special region, the same return address.

27:37.450 --> 27:42.950
And at the return, they will check if the return address still matches with this one you've already saved.

27:42.950 --> 27:44.770
And if it doesn't match, it's failed.

27:44.970 --> 27:49.350
But if it matches, it means you should be safe.

27:49.550 --> 27:54.910
You should be safe, because it has some weaknesses.

27:56.450 --> 28:14.690
At first, I need to emphasize that I think it's a splendid idea, because it means that through this kind of methods, you can, for example, for Compound Logging Microsoft, I believe it can be hard to develop mitigation on large scale, because you need to deal with a lot of legacy stuff.

28:15.130 --> 28:27.830
And this way was very genius, I think, because you just compile, for example, your DLL with this technology, and you can just load it to unprotected process, and it will work.

28:27.830 --> 28:38.990
And you can load it to protected process, RNG, so it's pretty nice, doesn't break legacy, it's fast, only about 5 instructions, it's pretty neat.

28:39.390 --> 28:46.850
But the key weakness is that it's, as you can see on the previous slides, it has base conditions, I will show them in a moment.

28:47.130 --> 28:49.770
And the other thing is that it's backward-based.

28:49.810 --> 28:56.990
I mean, for this one, for example, for the shadow stack, it's in user mode, so it means you can write for this one.

28:57.530 --> 28:59.810
So, it's a problem.

28:59.990 --> 29:06.190
Now, what's the point that you can write, if you're already writing in Vue?

29:06.190 --> 29:08.290
You need to just find and rewrite it.

29:08.350 --> 29:09.490
But that's the key.

29:10.030 --> 29:25.370
The whole idea behind RNG was that we have no memory-pointed leaks to this region, and as you have terabytes of memory space, basically, if you hit the bed, then your process can be down and be killed.

29:25.770 --> 29:30.450
So, it's cool, it's just inefficient to search for it, because it's no memory leaks.

29:30.450 --> 29:32.250
But, what is the problem here?

29:32.250 --> 29:38.710
Because we have CPUs, which are not properly designed for security, and we have all those sidechannels.

29:38.710 --> 29:42.110
So, it means, second, this protection doesn't work.

29:43.510 --> 29:47.630
And, as I mentioned, first, those are base conditions.

29:47.630 --> 29:59.650
As you can see in the prologue and the epilogue, you can raise instructions, because, when you do call, the instruction will just redirect us to a normal stack.

30:00.450 --> 30:06.730
And the software can emulate it, so it will load it to your shadow stack.

30:06.730 --> 30:15.430
It basically cannot emulate, it just can wait until it's called, then it can read from the stack when it was original stored, and then put it on the shadow stack.

30:15.910 --> 30:19.270
And this is a bit of a risk condition.

30:21.490 --> 30:23.890
I believe that's... I think that's...

30:23.890 --> 30:32.410
There was people thinking that's OK, of course they know about this risk condition, but it's been in some reasonable manner.

30:32.650 --> 30:40.430
But in fact, as this happened, some submission, successfully, it was able, and was able to safely to do it.

30:42.990 --> 30:57.290
But, if allergies do some, at least, for example, it's for this to be consistent, it's cooled down, so it's, again, it's not protected by allergies, but no worries, it will go to your back, and maybe in three years, five, I don't know

31:00.450 --> 31:08.910
and that will mean that it will be protected calls and returns by half itself, which is always pretty neat.

31:08.910 --> 31:22.350
It will be not probably 100% secure for attacks against hijacking counterflow, but it's built pretty much by boundary for you to bypass.

31:24.010 --> 31:32.250
And, but, let's say that OK, forward and backward edges is still important, but it seems they don't stop there.

31:32.250 --> 31:33.230
Why?

31:33.390 --> 31:41.290
Simply because before, and also nowadays, when you have, for example, CFG and whites, and you start with error ping.

31:41.290 --> 32:03.210
Error ping is pretty nice, but it can be problematic when you need to do all payloads, just by error ping, call all the syscalls, all the arguments, and that's why the people usually just allocate new memory, put their codes, into the executable, and then just jump this one,

32:03.210 --> 32:08.230
for example, through changing the return address.

32:08.830 --> 32:13.250
And that's where CAG, ACG, and the other codes come to play.

32:15.030 --> 32:19.990
To prevent this kind of execution, your own codes inside your targets.

32:20.050 --> 32:26.850
So first, CAG, Code Integrated Guards, is linked to be, OK, it will be a trivial, then you can just, through error ping,

32:30.070 --> 32:37.250
and that's it, because the library can be wrong if you before drop the file, and basically, you won already.

32:37.710 --> 32:48.730
But CAG says, OK, no, no, you cannot do it, because it's not a valid signature, and as an attacker, it probably shouldn't be easy for you to get a valid signature.

32:50.670 --> 33:07.750
But still, OK, we can unload the library, but OK, we can go for allocating memory and making an executable, so OK, Arbitrary Code Guards say, OK, no, you cannot do it, because once memory is breakable, you can't change it to executable anymore.

33:08.090 --> 33:10.950
And then, wow, but this is interesting.

33:11.290 --> 33:24.910
Then when it comes to browsers, like Niche, they have JIT, JIT Engine, and what they really need is, but OK, and this is also a pretty nice design, so how do they deal with this one?

33:24.910 --> 33:26.870
So they just say, OK, we don't need it,

33:30.070 --> 33:39.250
because in your own process, you cannot disable Arbitrary Code Guards, but what you can do, is that different processes can do it for you.

33:39.570 --> 33:51.510
So they basically introduce another process, which basically unpacks an idiom, injects the code inside your target process, and makes it executable.

33:51.910 --> 33:54.630
And of course, there are CRG and these kind of things for it.

33:55.170 --> 34:10.390
So it's also a neat design, but on the other side, there's a problem, because there's a problem, OK, what about framing the memory in my own process, when the different processes allocate bits, and getting or rewrite the memory?

34:10.890 --> 34:17.210
There are lots of tricky things to do, but I guess they will handle it step by step.

34:18.030 --> 34:23.330
So it's very nice to see that Microsoft is doing this kind of challenging thing for us.

34:24.530 --> 34:27.810
And another thing, OK, this is not the native code execution piece,

34:31.870 --> 34:44.290
but before you can get native code execution, or data boning, and just rewriting some data, I think it's pretty much equal, by the way, to data tricks and code selection attacks.

34:44.350 --> 34:46.150
It just depends on the viewer.

34:46.370 --> 34:51.430
But even before you can do this one, you need to get good control of your room already.

34:52.010 --> 34:57.690
And that one was the next point, how to mitigate those kind of things.

34:57.930 --> 35:02.070
And one of these interesting things was how isolation algorithms were used.

35:02.870 --> 35:14.610
And, for example, before we have some technique that we have some object in Kata, which have some header and other, and they are really putting together.

35:14.730 --> 35:34.410
But the problem with this one is this, that when you can from those data overflow, when you have some bug in handling your object, and you can overflow to different objects, and then you can alter this data, so that's when comes type selection in.

35:34.410 --> 35:40.650
This separates different objects, headers and data, different chunks.

35:41.050 --> 35:43.890
Not all of them, but I guess pretty much this one.

35:44.230 --> 35:49.890
Even if you have overflow, it will be hard for you to attack the critical structures.

35:50.150 --> 36:04.250
And even if you have some result-free, it will be very difficult to, or maybe impossible, it will be difficult to get the different objects that were originally supposed to be there.

36:04.910 --> 36:06.530
That's a bit nice.

36:07.070 --> 36:20.610
But, for example, when it comes to overflows, if you have some crucial thing, that it will tell, for example, about the tactical mitigations.

36:22.990 --> 36:23.470
Because...

36:23.470 --> 36:41.010
I mean, about tactical mitigations, there is another thing that's OK, that you can get another control of your vulnerability, that you can somehow put it in a good object or it would get a lot of different objects.

36:41.150 --> 36:43.370
And now we can start working with it.

36:43.390 --> 36:50.530
And it was some known techniques, like BND or BigMap attacks.

36:50.790 --> 36:53.850
And if I get attacks, and they use the same pattern,

36:57.870 --> 36:59.350
that's our pointer.

37:00.610 --> 37:02.890
And that's why I was focusing on...

37:04.750 --> 37:08.430
it's not some generic approach, it's approach one by one.

37:08.750 --> 37:17.070
But it kind of helps, because when you know that a lot of people are using this technique and blocks it, eventually maybe it will get out of the arsenal.

37:17.790 --> 37:31.930
But what's going on here is that basically when before you do some manipulation over, for example, a pointer, index or some buffer, they will check it at first.

37:31.930 --> 37:37.690
OK, is this buffer, is this index inside some outer edges?

37:37.690 --> 37:40.250
If it's a buffer, it's quite cool.

37:40.950 --> 37:43.590
And that's what's called tactical mitigation.

37:43.610 --> 37:48.810
And it somehow helps to at least bank some techniques, or at least to make them harder.

37:48.850 --> 37:55.390
But what's crucial for this mitigation is that you should not be able to...

37:57.990 --> 38:12.330
you can have some limited safe writes in some boundaries, but being inside those boundaries has an important structure, which basically checks after those boundaries, and if it affects that one, it won't.

38:12.330 --> 38:14.270
And that was happened...

38:14.270 --> 38:27.810
at that article, I referenced it a lot, it's by Mortensen, and you can read it, it was, I think, a pretty nice bypass of one particular tactical mitigation.

38:28.450 --> 38:30.050
Targeting the BND.

38:31.830 --> 38:33.510
So, how it looks like.

38:33.750 --> 38:42.190
For example, on one of our bugs, I was checking, OK, it can be used, because it looks like a write, only primitive.

38:42.190 --> 38:45.770
So I try to check if it can be used also as a write primitive.

38:45.790 --> 38:51.850
So I'm going through the code, some different branches, and then in one branch, I see this kind of check.

38:51.850 --> 39:01.430
At the beginning, you see, B19 is less than B20, and B4 is bigger than B13, it just doesn't cross it more.

39:01.550 --> 39:18.250
And this kind of checks are usually not in place when you code, because as a developer, you will write some code, and you build, for example, some objects, and you will use index to index the memory, because this should be correct, this should be valid.

39:18.510 --> 39:20.910
But when an attacker can change it,

39:23.990 --> 39:29.830
and that's why you have this kind of checks, but as a normal developer, when developing code, you will not think of this one.

39:29.830 --> 39:36.170
But when you do some mitigations, like static ones, you will check for this education.

39:37.250 --> 39:47.830
Because if it's not this check, we can use it to write anywhere in the kernel, but this checks if it's a good full boundary, and goes a bit troublesome.

39:49.490 --> 40:10.790
So in fact, in theory, because Windows is developing these mitigations pretty much fast, I would say you have, I don't know, maybe 80 or more native code execs mitigations, and you have this type of static mitigations, type of isolations, and different kind of things,

40:10.790 --> 40:12.050
which is pretty nice.

40:12.050 --> 40:33.510
So in theory, it should be pretty nice strongholds, so you cannot do any more to re-write the memory, you cannot load arbitrary modules, RIPs, and also even overflows, there will be some limits that you cannot touch anywhere in the kernel, but just in some parts.

40:33.510 --> 40:35.910
But it's some kind of suggestions in theory.

40:36.490 --> 40:57.630
It certainly makes it a little bit harder, but it's not game over, because it's still a lot of legacy, so it's hard to do it in large scale properly, and also there's a lot of, then you have some...

40:57.630 --> 41:10.170
Recently, for example, in mitigation, when you can see mitigation rules, mitigation mappable rules, you can see that it's out of scope for some categories, race conditions, and it's a butterfuck.

41:10.170 --> 41:24.950
Race conditions, I mean, when you write race conditions, it's like saying, OK, we have a really big problem, because we cannot defend against them, but it's still a big problem, because you have process, you have a lot of environments.

41:26.190 --> 41:32.110
But it looks like it's really hard to protect against some race conditions.

41:34.430 --> 41:53.190
But at least, I want to say that in Windows, what I like from past years, from now, that's the way changing, looking at the early shift towards security, and that at least makes for me, it's a bit more challenging, I can more use my brain, it's not like,

41:53.190 --> 41:56.350
OK, I just sit one or two days, and it's done.

41:56.350 --> 41:59.270
But now I need to, OK, be more creative.

41:59.370 --> 42:00.530
So for me, it's good.

42:00.770 --> 42:07.690
And also for normal users, it's good, because it makes for all the people to work harder.

42:09.330 --> 42:17.190
So, we have sandbox, we have native code executions, we have some tactical mitigations, but what else?

42:17.810 --> 42:31.390
Still, a lot of bugs, and still people bypass it, and introduce some new thing, I mean, it's not new thing, but it's coming to life, that you see, make use of virtualization.

42:31.710 --> 42:49.390
And virtualization is pretty neat, because as I said before, I enjoy Kernel, because I like it, but also because, before, you own Kernel, you own, but now you own Kernel, and it can be just one point in your checkbox, in your to-do list.

42:52.730 --> 43:02.050
And it's limited, you can link the data, and that's not all what you want, you want less data.

43:02.630 --> 43:07.250
And that's what virtualization is about.

43:07.450 --> 43:21.970
And really good is that they are using Hyper-V, because Hyper-V is well designed, when you look inside, you see that also a lot of security perspective applied to this module.

43:21.990 --> 43:34.550
And you can see that it's a lot of C++, I mean, I enjoy C++, but on the side, it can be bad because C++ is really hard to do it good, it's really easy to make mistakes, and bad mistakes.

43:34.650 --> 43:45.810
But when you look at these components, it's not C++ is good, it's code, it's pointers, they are pretty much separation of logic, it's clean design.

43:46.290 --> 43:47.990
So it's... I like it.

43:47.990 --> 44:00.410
I mean, it's challenging, when you want to find bugs there, it's a big challenge, and when you go on the kernel, and these are the applied, you may have problems.

44:02.510 --> 44:07.750
So, for example, about Hyper-V, one of the core components is VNVP.

44:07.750 --> 44:08.770
And what's VNVP?

44:09.630 --> 44:11.630
It's a virtual machine order process.

44:11.630 --> 44:16.470
It's basically the process in the host, which manages the virtual machine.

44:17.490 --> 44:25.530
Now this you can maybe, when you try to hyper-application guards, so you can try it.

44:25.530 --> 44:37.790
But you can see that it's not so useful, because you can maybe go to Twitter or watch porn sites, but it's not so useful for real applications, for real life, because all those data are just inside the container.

44:38.150 --> 44:40.910
But in the future, it will be a bit more and more applicable.

44:42.730 --> 44:43.170
And...

44:45.070 --> 44:47.410
this VNVP will be more crucial.

44:47.970 --> 45:03.170
And when you look on the virtual machine that's going inside, for example, about the emulates, you will see that it's not a lot of things, it's relatively clean, and you have minimal...

45:03.770 --> 45:09.430
you don't have too much legacy, you don't have a drag-and-drop, you have basic sessions by default,

45:13.170 --> 45:13.850
so it's...

45:15.730 --> 45:20.190
it's not a big attack surface, as some other virtual machines maybe.

45:20.790 --> 45:38.030
And it can be good, but as I use it, as I try to use it sometimes, as for example for browsing, I don't feel it too much, so I don't think it's a virtualization as boundaries right now here, but I think maybe soon will be.

45:38.030 --> 45:44.410
So for this one, the reference type of VNVP can be pretty good.

45:45.590 --> 46:05.170
So in the future, what it looks like, maybe the attack, it can be composed from many small parts, because you need, at first, to get back in your target, which can be browser, it can be some ADP, like Skype or whatever, and then it's OK, you get back.

46:05.170 --> 46:15.110
Then you need to get the remote code execution, so you need to bypass some net code execution bugs, and before, maybe you need to handle the tag isolation, this kind of things.

46:15.290 --> 46:19.590
Then, OK, I get the remote code execution, but I need to escape from the sandbox.

46:20.030 --> 46:20.870
And why?

46:22.190 --> 46:26.650
Because I'm inside the virtualization, so I need to attack the cadena, the improviser.

46:26.650 --> 46:31.830
But the improviser can attack only from the cadena, so even, for example, I got out from the sandbox,

46:35.170 --> 46:43.790
then it's true, be sure to look for the cadena, or at least, I have no need, maybe, in code execution there, but at least it writes.

46:44.290 --> 46:56.790
And from that point, you need to find the bug in virtualization, and then you have the bug in virtualization, and to be able to exploit it, and when you have exploited it, so in that host, when you are in cadena, it's OK, but when you are in user mode,

46:56.790 --> 47:01.230
then you still need to find where it was also in virtualization, it's locked down.

47:01.790 --> 47:06.710
So it can be... it's promising, it can be a good challenge in the future.

47:07.350 --> 47:13.390
They are not there, but I believe that they will be, at one point, and it will be interesting.

47:13.910 --> 47:17.050
At least, for me, it will be a nice challenge.

47:19.210 --> 47:27.690
So, but still, before all of this, when you want to exploit, make use of sandbox, you need first to find them.

47:28.110 --> 47:29.330
So how to do it?

47:30.510 --> 47:46.870
Actually, before, it was more troublesome, because you don't have too much open source tools, you need to create your own clusters, and by creating the things, I mean, it's nice to create it and everything, but it can be a little over-engineered.

47:47.350 --> 48:08.150
And at first, for example now, you have pretty much a lot of open source tools, you have syscaller, you have key, you have hypervisors, which you can utilize, which you have also, you have qm, kvm, which is not just for debugging, and you have the technologies for debugging.

48:08.150 --> 48:14.270
You can use all of these, and it will help you, and you have all the resources.

48:14.270 --> 48:19.470
But I don't recommend to start, for example, to make it faster from the scratch.

48:19.610 --> 48:25.830
At first, I guess you need to understand how the state-of-the-art tools work.

48:26.190 --> 48:40.670
Those are, for example, KFL, and when you want to work in the kernel, you can use an adaptation in the form of KFL, which you can also use for Windows or for other platforms, and the same applies for syscaller.

48:40.670 --> 48:45.330
KFL is for data-fuzzing, and syscaller is for state-fuzzing.

48:46.090 --> 49:04.450
And so at first, when you understand the square root of tools, and you know how to work with them, what their weaknesses are, and what you want to improve, then I suppose you should go further with your own tool.

49:04.830 --> 49:05.570
Depends.

49:05.570 --> 49:07.190
Depends case by case.

49:07.190 --> 49:14.110
But at first, I think it's not a good idea to rely on this wheel again and again.

49:14.110 --> 49:21.810
At first, understand, and then see if you really need to do something new, and if yes, then do it good.

49:23.570 --> 49:29.510
And then the really common question, maybe not a question, but it's there to approaches.

49:29.530 --> 49:32.950
People are a lot of times just looking for bugs.

49:36.750 --> 49:41.290
But what I would like to do is combine those two approaches.

49:41.450 --> 49:42.190
Why?

49:42.350 --> 49:43.550
Because who's fuzzing?

49:43.750 --> 49:46.190
It's fuzzing super easy.

49:46.190 --> 49:49.150
I mean, you can write a program, and you can call it fuzzer.

49:49.410 --> 49:54.270
And it's okay, because it does something, but it depends if it does something reasonable.

49:54.270 --> 49:57.990
Because it's really easy to do just fuzzer, which does nothing.

50:03.090 --> 50:12.010
If you tell him exactly what to do, or limit him too much, it will not be random enough, or will not do enough house and interesting behavior.

50:12.150 --> 50:17.350
Because people just look at some some predefinite paths.

50:18.170 --> 50:24.270
On the other side, when you're looking just by eyes, well, it can be really tiring for you.

50:25.650 --> 50:27.070
You can find...

50:27.070 --> 50:39.330
you can easily sleep some easy bug or, on that side, it's really hard to comprehend some complex connections.

50:39.370 --> 50:47.670
For example, some race conditions, or some connection five lives ago, some connections, two things together.

50:48.170 --> 50:54.610
And this can be really hard to comprehend, really, to see the bug there.

50:54.970 --> 50:56.850
And also, the same applies for the fuzzer.

50:56.850 --> 51:07.310
It's not so easy for the fuzzer to go for some deep bugs, but on that side, when you combine these two approaches together, it can have a good effect.

51:07.510 --> 51:12.630
You will just see a lot of random fuzzer, and then you will improve.

51:12.630 --> 51:19.950
OK, I get a deep bug, for example, I cover these parts, but I know that this part seems more interesting, so I want to go more deep.

51:19.950 --> 51:26.870
So I will shift the fuzzer, for example, templates, and some logic in the fuzzer, to go with that part finally.

51:27.310 --> 51:34.850
And maybe to provide some callbacks, and enhance the fuzzing.

51:35.590 --> 51:37.670
It's a lot of things, what you can do.

51:40.530 --> 51:45.670
And also, the other thing, is choosing about the targets.

51:46.890 --> 51:49.570
As you see, I'm not just about the browsers.

51:49.570 --> 51:56.130
Browsers are just one thing, which is really dangerous, if it's done wrong.

51:56.270 --> 52:00.610
But there are a lot of applications, which basically communicate with the Internet.

52:00.610 --> 52:09.690
So when you are using Skype, when you are using Slack, emails, or different applications, a lot of things communicate with the Internet.

52:10.250 --> 52:19.370
And so when you know that your target is using this program, and you know, for example, this is weaker than some browser, then you probably go for that one.

52:19.370 --> 52:20.170
Why not?

52:21.690 --> 52:23.330
And this is also SMB.

52:25.350 --> 52:27.110
Because there were some bugs,

52:31.510 --> 52:35.430
not so easy bugs, but for me it's unbelievable that those kinds of bugs exist.

52:35.430 --> 52:37.150
Non-authenticated bugs.

52:39.310 --> 52:43.910
But when you run some simple dummy fuzzing, you can find a lot of those bugs.

52:44.310 --> 52:53.190
I mean, not dummy fuzzing, but for example, more efficient, like APM, that has some strategy approach to find them.

52:53.290 --> 52:56.830
But when you just apply, I think, baseline, you will find them.

53:00.610 --> 53:02.450
I mean, internally, from Microsoft, as I hear.

53:02.990 --> 53:08.250
And from where you see from CVs, they follow CVs to Microsoft for critical stuff about SMB.

53:09.230 --> 53:11.090
And so I check it also.

53:11.750 --> 53:13.050
And it's hard to find now.

53:13.050 --> 53:19.830
I think non-authentication bugs will be a good lag, or that would be a good way to find it.

53:20.190 --> 53:26.490
But now, for example, authentication bugs are really also important, but it can be hard to find.

53:27.530 --> 53:32.970
And also, when you look in the windows, it's not about...

53:32.970 --> 53:37.490
you can find different things also in the kernel, because they introduced some new technologies.

53:37.490 --> 53:42.230
For example, Ubuntu on Windows, which is pretty nice, but it needs a whole new subsystem.

53:42.830 --> 53:47.890
And it depends on good facets, good reviews, it all depends.

53:48.270 --> 53:51.650
And maybe you can start looking at it, you can find more and more stuff.

53:52.510 --> 53:58.250
And you'll find, for example, SMB, MDP, and other things to look for.

54:03.450 --> 54:06.710
It's more and more challenging from the perspective of...

54:06.710 --> 54:09.530
you need to use more RAM to exploit something.

54:09.890 --> 54:12.750
And you have a lot of targets to exercise on.

54:14.750 --> 54:21.810
So, to think about the conclusions, the single most important thing about mitigation is attack-to-fat reduction.

54:21.810 --> 54:25.690
If you reduce me to... I can do nothing, then I just can do nothing.

54:27.430 --> 54:29.970
Then, sandboxing is very important.

54:30.890 --> 54:38.710
Because when you're living with only some small parts that I need to jump from one processor to another, I need to change multiple vulnerabilities.

54:39.230 --> 54:44.230
And that can be really annoying at this, and sometimes making it impossible.

54:45.070 --> 54:46.850
And it's also not difficult execution.

54:46.910 --> 54:51.030
I mean, it's public bypasses for them, usually.

54:51.490 --> 54:56.550
But still, for example, in the remote case, it can play a big role.

54:56.910 --> 55:03.130
And also in normal case, at least it will say, OK, but we need to bypass this one at first.

55:03.530 --> 55:07.050
Nobody will say that's impossible, but you will need to think about this one.

55:07.330 --> 55:08.950
So at least it's good.

55:09.550 --> 55:11.310
You can be more creative.

55:11.950 --> 55:13.470
Enjoy more, let's say.

