WEBVTT

00:02.650 --> 00:04.750
I can start?

00:04.750 --> 00:06.270
Okay.

00:10.540 --> 00:20.860
It's good to be here.

00:20.980 --> 00:23.460
I'm Wang Junjie Zhang.

00:23.460 --> 00:27.680
I'm a security researcher from the Hearthstone Networks.

00:27.680 --> 00:35.940
My research direction is Windows vulnerability research including user mode and kernel mode.

00:36.380 --> 00:46.580
And also I've been listed as the most valuable researcher of the Microsoft 2020, 2022, and 2023, 2024.

00:46.580 --> 00:47.380
Yeah.

00:48.080 --> 00:49.240
Okay.

00:50.520 --> 00:54.900
So, let's just start my talk.

00:55.500 --> 01:02.660
And this is, I already introduced myself and our colleague here.

01:02.660 --> 01:03.440
So, I'm Wang Junjie Zhang.

01:03.440 --> 01:03.460
I'm a researcher at Microsoft .

01:03.820 --> 01:07.360
Um, firstly, let's see our agenda today.

01:07.360 --> 01:09.460
It's mainly consists of four parts.

01:09.460 --> 01:14.440
Um, we'll introduce architecture of the LPC and RPC.

01:14.440 --> 01:17.720
So, we'll have a deeper understanding of it.

01:17.720 --> 01:24.020
And then look at some, uh, common vulnerabilities inside LPC and RPC.

01:24.220 --> 01:27.960
And we'll study some root cause of the vulnerabilities.

01:29.020 --> 01:34.160
And then I will share some details of the vulnerabilities I found by myself and my team.

01:34.160 --> 01:39.340
And which can bypass the LPC, RPC, uh, security mechanism.

01:39.340 --> 01:51.300
Uh, I will show you step-by-step, uh, to use, uh, this small security flaw to bypass the security mitigations like SDR, DEP, XFG, and finally get system shell.

01:51.300 --> 01:54.160
Uh, you won't get it from anywhere else.

01:54.160 --> 01:57.520
So, and that's the way to make a conclusion.

01:58.720 --> 01:59.700
Yeah.

02:00.200 --> 02:03.960
Uh, so it's, uh, architecture, yeah.

02:04.020 --> 02:11.180
We already know, um, the LPC, uh, was introduced, uh, to replace the ARPC.

02:11.180 --> 02:22.380
Uh, it's called, uh, Lightweight, Lightweight Procedure Core, uh, mainly used in, uh, Windows system, uh, inside, uh, Windows system services.

02:22.380 --> 02:29.600
Uh, and it's, uh, concerned by many researchers for each, it's huge attack service.

02:29.880 --> 02:31.080
Uh, so it's, uh, based on the ARPC.

02:31.080 --> 02:37.040
And this is, uh, uh, uh, ARPC and RPC architecture.

02:37.540 --> 02:44.440
And why we combine the ARPC and RPC together?

02:47.700 --> 02:50.900
Uh, why we combine, uh, it's together?

02:50.900 --> 02:56.920
For reason listed below, uh, most, uh, RPC services is based on the ARPC or NAND pipe.

02:56.920 --> 03:01.140
So it's almost, uh, based on the same, uh, security mechanism.

03:01.140 --> 03:07.700
And the security flaw inside the, uh, ARPC can affect the security of RPC services.

03:09.060 --> 03:14.040
And this is, uh, also the architecture of the ARPC, RPC from, uh, Windows internal.

03:14.160 --> 03:18.460
Uh, you can communicate, this, uh, see the communication module inside it.

03:18.860 --> 03:23.460
And it's also support some, uh, message queries and some share section.

03:23.680 --> 03:28.100
Uh, also, uh, support share section to pass the message.

03:30.080 --> 03:33.800
Uh, why we use, uh, section here?

03:34.140 --> 03:40.040
Uh, because it's a more effective, uh, data passing mechanism on Windows, uh, section object.

03:40.040 --> 03:41.860
Uh, more efficient and fast.

03:41.860 --> 03:43.560
And, uh, what about the region?

03:43.660 --> 03:50.660
Uh, why region is, uh, represent a range of the shared memory that can be opened within the context of a given port.

03:50.660 --> 03:57.260
Uh, the section can be shared, uh, accessed by one process, uh, which only have a right access.

03:57.320 --> 04:00.900
And meanwhile, uh, the client only have the right access.

04:01.760 --> 04:05.940
Uh, this picture, uh, describe the relationship between the section.

04:06.040 --> 04:06.780
Yeah.

04:07.140 --> 04:10.980
We can split up the whole section into, uh, different region.

04:11.020 --> 04:15.200
Uh, one piece is represented by, uh, one region object.

04:15.200 --> 04:22.220
Uh, we have a set, uh, size, uh, which is representing the map of the set and the size of the set section.

04:23.420 --> 04:24.120
Yeah.

04:24.200 --> 04:28.180
Uh, I see some, uh, historical vulnerabilities.

04:28.220 --> 04:28.860
Yeah.

04:30.540 --> 04:41.140
Um, first kind of bug is, uh, kind of logical bug, uh, in ARPC when, uh, you know, there's too much, uh, uh, research, uh, on the internet.

04:41.320 --> 04:48.860
Um, it related to, uh, uh, doing when the service doing some, uh, file operating, uh, operations.

04:48.860 --> 04:55.180
Uh, it's need to, uh, impersonate the colors, uh, token and doing some, uh, operations on file.

04:55.180 --> 05:13.460
Uh, however, you know, sometimes the failure to properly handle the file operation, uh, with a file, like the symbol link, it may be resulting the service being able to modify, or write, or delete, and even create, uh, some files when client should not have the permission,

05:13.460 --> 05:15.260
uh, these operations.

05:15.260 --> 05:36.740
So, uh, this vulnerability, uh, CVE 2020 and 0F0911 is an example of the using user's device map, uh, where impersonating users and the service will operate on malicious, uh, MSAI files, uh, on the user's device map installer directory, and it will directly,

05:36.740 --> 05:38.300
uh, to another path.

05:38.300 --> 05:50.860
So, when the service revert to the system privilege, it also trust the content, uh, to read from their client installer directory and source, um, the privilege acceleration happen, yeah.

05:53.340 --> 06:12.780
Uh, uh, this kind of bug exploitation have much articles and research, uh, on the internet, uh, by using tricks of, uh, firstly, uh, I think it's discovered by Google research, uh, James Fosho, uh, by using tricks like NTFS junctions, uh, higher link or object symbol links and,

06:12.780 --> 06:19.400
uh, opportunities locks, you can easily, uh, write exploitations, uh, on this kind of bugs.

06:19.980 --> 06:20.940
Yeah.

06:21.100 --> 06:28.560
Uh, the second, second example is, um, malicious, uh, memory corruption bug inside LPC, LPC kernel, uh, in recent years.

06:28.560 --> 06:35.200
Uh, we have seen a lot of, um, memory corruption issues inside the LPC, LPC kernel.

06:35.420 --> 06:42.620
Uh, so the following code snippet is a part of the vulnerability and is associated with the LPC section blob object.

06:42.620 --> 06:52.380
Uh, when you create a LPC section, uh, in the map legacy port view function, uh, there's a race window before the function with, uh, uh, view port, view object.

06:52.380 --> 07:04.940
Uh, during this race window, attacker can, uh, destroy the LPC port object, uh, causing it, uh, LPC create section view function, uh, access, uh, 3D pointer.

07:05.660 --> 07:11.720
The picture describe the, uh, race window, uh, in the connect port function.

07:11.720 --> 07:19.460
Uh, the kernel, kernel creates the first, uh, LPC port and, uh, we can try to close the handle table in the second thread.

07:19.500 --> 07:27.520
Uh, if this moment, close moment, uh, between the create section and the create view port function, you can get a blue screen.

07:27.520 --> 07:34.520
Uh, but however, this kind of issue is, I think it's a little bit hard to exploit because you need to win the race first.

07:35.760 --> 07:53.020
Uh, what we observe is that most of these, uh, memory corruption bug, uh, inside LPC kernel or LPC services, and most of them are traditionally memory corruption bug, bugs , uh, due to the server side lack of check when LPC services, uh, handle data from the client side.

07:53.700 --> 07:57.080
And last example is, uh, I think it's very interesting.

07:57.080 --> 08:01.540
Uh, logical fallback in LPC RPC discovered in 2016-2017.

08:01.540 --> 08:09.380
Uh, research found that the kernel doesn't protect the shared memory privilege, uh, when using it to pass the, uh, m-message data.

08:09.380 --> 08:24.000
In theory, the kernel changes the shared section protection in client sides, uh, to read only, uh, preventing the client side changing the memory, uh, while server side, uh, calling stop code that may be cause double fetch loss in server side.

08:24.000 --> 08:33.440
Uh, you can use the virtual protect function to change the shared memory, uh, from read only to write, uh, read write, and causing data race condition in server side.

08:33.440 --> 08:36.420
Uh, it's pretty, uh, predictable, right?

08:37.160 --> 08:47.080
Uh, imagine, uh, we have a, have already have a, uh, RPC function, uh, accepts, uh, string parameter and print it twice with a sleep, uh, between these two option.

08:47.080 --> 08:53.000
Uh, we write a POC and, uh, send a string and try to call the virtual protect and change the content of the string.

08:53.000 --> 08:57.740
Uh, we can see the server side print two, uh, different, uh, strings.

08:57.740 --> 09:04.900
Um, it means that, uh, we can change the parameter while the server side, uh, perform any other operation.

09:05.160 --> 09:12.880
Although, uh, this vulnerability has been fixed, uh, I decide to learn more from it.

09:12.880 --> 09:16.780
Uh, maybe we can find, uh, more interesting stuff.

09:17.480 --> 09:22.640
So, uh, first question is, uh, is really secure update patch?

09:24.620 --> 09:37.680
Yeah, uh, from my, all of the research, uh, result I know, uh, shared memory is, uh, available for, uh, almost any RPC over LPC services.

09:37.680 --> 09:44.980
So I decide to write a custom RPC service and try to, uh, change the, uh, memory pro-memory protection again.

09:44.980 --> 09:48.540
But finally, uh, get, uh, virtual protect EX error.

09:48.560 --> 09:52.980
So, uh, what happened to after the patch?

09:52.980 --> 09:57.020
So I decide to, uh, learn more from the reverse engineering.

09:57.200 --> 10:01.300
Uh, first, uh, N2S kernel try to secure the view of the section.

10:01.300 --> 10:04.960
It doesn't allow to change the memory attribute from the user space.

10:05.080 --> 10:13.040
And, uh, secondly, both N2S and RPC RT4 module DLL enable secure mode in mode check.

10:13.040 --> 10:19.320
It means that the server will not manipulate the shared memory, uh, when it detected the shared memory is unsafe.

10:20.560 --> 10:29.520
Uh, this technique, uh, this is a technique that tells, uh, the security mechanism when handle shared memory from client side.

10:29.520 --> 10:34.760
Uh, kernel use map view, secure view of section function to create a security view.

10:34.760 --> 10:38.720
So you secure virtual memory and you can't change, uh, attribute.

10:39.040 --> 10:39.060
And

12:46.380 --> 13:01.780
when sending the attribute, uh, sending message to the server, it's check the RPC section and the region we use to send the message to see if it's safe and the region can't bind with more than two view objects.

13:01.780 --> 13:04.880
It's trying to change the attributes of the shared memory.

13:05.120 --> 13:07.420
The address, uh, to read only.

13:07.440 --> 13:18.980
If this step falls, then the server side will be marked with unsafe and the RPC RT4 dot DLL will use the shared memory to unmasher the, uh, server side.

13:20.000 --> 13:24.880
And this is the code pieces, uh, from the user mode in RPC RT4.

13:24.880 --> 13:32.380
Uh, it will acquire the RPC message attributes, uh, including the security flag of the RPC region.

13:32.380 --> 13:36.340
If the region is unsecure, you can see, uh, it will lock its heap buffer.

13:36.340 --> 13:41.260
Uh, it's managed by Pcache object and copying the shared memory to the heap buffer.

13:41.260 --> 13:44.600
So it will not cause double phishing vulnerability.

13:44.740 --> 13:48.640
So when the server decide, uh, detect the region, it's unsafe.

13:50.100 --> 14:07.680
Also take a look at the virtual protect ES function to, uh, see how the kernel patch, uh, the, uh, special bad event object, uh, to, uh, secure them, mark the bad objects.

14:07.680 --> 14:09.400
It's a security view or not.

14:09.400 --> 14:17.060
So we know that Windows kernel use MM bad object to describe one virtual address in, uh, user space.

14:17.060 --> 14:21.280
It's, uh, it's, uh, describe the start and the ending of the virtual page.

14:21.380 --> 14:27.820
Uh, when changing the memory of, uh, production, it will check if the bad event object is, uh, in the

14:34.040 --> 14:35.080
list.

14:35.740 --> 14:40.680
Uh, unfortunately, the bad event structure symbol was deleted from Windows 11.

14:40.780 --> 14:43.940
Uh, so I can only use the old symbol from Windows 10.

14:44.720 --> 14:50.300
And digging into it, uh, there's two key function, uh, for address, uh, protection.

14:50.380 --> 14:56.900
One is m-i-c-w-i-s-s-l-e protection and the other is revert m-i-r-e-v-e-r-t function.

14:57.540 --> 15:02.900
Uh, this is the output from the, uh, uh, debug, uh, in the right picture.

15:03.000 --> 15:13.220
And you can see, uh, before and after the w-i-c-w-i-s-s-l-e protection, it's changed a bit of the w-i-s-s-l-e protection from 4 to 1.

15:13.220 --> 15:19.260
Yeah, I guess it's mean to read right when the value is 4 and the no access value is 1.

15:19.280 --> 15:22.840
Uh, left picture describe the p-t-u content, uh, about Intel.

15:23.020 --> 15:26.080
Uh, it's also, you know, it's, uh, page table structure.

15:26.140 --> 15:38.020
Uh, after the function of the m-i-r-e-v-e-r-t, uh, value the p-t-e, the r and the right bit will set to 0, so the whole page in the current, uh, current side will change to the read only.

15:39.200 --> 15:47.420
Uh, but the server side with another, will use another page table, uh, so when, what about the w-i-s-s-l-e protection?

15:47.420 --> 15:58.880
Uh, I think it's, uh, this bit from 60, 60 to 62 is reversed according to, uh, Intel's documentation, so I guess Microsoft use it for some special purpose, yeah.

15:59.660 --> 16:09.780
And, uh, when changing the address protection, it's called m-m-m-check security, uh, secure vat to check if there's, uh, uh, special vat event, as we talked before.

16:09.940 --> 16:17.200
And, um, uh, we, when we call the compare p-t-e protection, it will compare the page table.

16:17.200 --> 16:37.180
Finally, compare the page table, uh, protection with, with the desired protection mask, uh, uh, we, uh, process the, uh, we pass to the virtual protect e-x, uh, to see, uh, return change, uh, attribute if two value is the same.

16:37.180 --> 16:41.980
If it's not equal to the virtual protect e-x, it will return error.

16:41.980 --> 16:47.260
Unfortunately, uh, WS protection now is one, so it's not the same as before.

16:47.340 --> 16:53.060
Uh, it's really has some weird errors you see when changing the protection from the address.

16:53.060 --> 16:56.660
It's really, uh, not the same as we thought.

16:58.200 --> 17:02.000
Uh, I should actually try to bypass, uh, this function.

17:02.620 --> 17:10.840
Uh, so it's changing the p-t-e... so it's changing...

17:16.810 --> 17:17.950
you're right, it's changing the p-t-e function .

17:17.950 --> 17:18.790
Can you hear me?

17:23.070 --> 17:24.850
Oh, now it's okay, yeah.

17:27.150 --> 17:33.550
Uh, so I tried to bypass the, uh, this function, uh, and, uh, it's changed the protection one page.

17:33.610 --> 17:44.970
So, if you allow the shared memory for more than two page, and you only write data to the first page without it doing any other operations, so, um, the operation will fail.

17:45.270 --> 17:56.270
Uh, but the security function, uh, you know, uh, because, uh, the rest of the page doesn't even have the page table, uh, so you can't change the attributes.

17:57.770 --> 18:04.710
Okay, let's, uh, see the vulnerability details, uh, we found in, uh, the region.

18:04.770 --> 18:10.710
Uh, the kernel always do try to alignment the allocation size to one page.

18:10.810 --> 18:21.910
Uh, you can skip the session object, uh, the starting of session, actually, um, it's auto increased, uh, based on the, uh, uh, last region and the offset.

18:21.910 --> 18:24.150
However, the allocation size is unchecked.

18:24.150 --> 18:30.350
So, what about this, um, small security, uh, um, flaw?

18:30.830 --> 18:34.490
This small undiscovered issue can cause, uh, afterwards.

18:35.410 --> 18:39.350
Uh, but you still remember the previous picture, yeah.

18:39.350 --> 18:43.690
Uh, assuming we had located, uh, we already allocated four, uh, region.

18:43.690 --> 18:55.470
Uh, the size of the first region is 0x1000, so the start of, start offset of the second region, uh, is actually, will be one, 0x1000.

18:55.470 --> 19:06.850
Based on the info in the picture, we can know a starting offset of the region three is 0x, uh, 4000, uh, which is pretty easy to understand and, uh, calculate it.

19:06.850 --> 19:16.270
Uh, so based on the, this, uh, info we know, we can see how unchecked section, unchecked, uh, section size, uh, we can do in the following.

19:17.550 --> 19:28.250
Uh, if we allocated, uh, which region was extremely big size, 0x002 is actually minus, uh, FFFE.

19:28.470 --> 19:36.910
Uh, based on the region, uh, and the view granularity, the final offset of region two is actually will be zero.

19:36.910 --> 19:40.330
So, the allocation size, uh, will be still zero.

19:40.330 --> 19:41.910
So, what does this mean?

19:42.510 --> 19:50.990
Uh, uh, this means that the region two will overlap with the region one, and they will be mapping to the same physical address.

19:51.350 --> 20:03.390
Uh, we can use the view one to send and receive the LLPC message, and this view will be protected by the LLPC kernel, by using secure view against the write, uh, function.

20:03.470 --> 20:07.670
But the second view will be left, and the kernel will do nothing on it.

20:07.770 --> 20:17.230
So, because we don't even use it, um, so we can use the address of the second region, it actually change, um, the content.

20:17.230 --> 20:20.790
It's writable, so the double fish will happen again.

20:20.790 --> 20:26.210
Uh, the secure view, uh, write against the write function, uh, can't protect you anymore.

20:26.910 --> 20:31.410
So, it is, uh, there will be many, still many questions, uh, for you.

20:31.550 --> 20:36.850
Uh, as you see in the previous page, uh, the region allocation size is zero.

20:36.850 --> 20:51.770
Uh, so while you still can change the content of the shared memory, um, you know, because, uh, the map view function support mapping size of zero, uh, you allocate a page with size, uh, one page by default, so we don't need to worry about it.

20:52.030 --> 21:00.530
And the second, if you set the map view function, it cannot, uh, cannot, it can't accept zero size?

21:00.530 --> 21:02.050
Why don't you pass zero size?

21:02.050 --> 21:04.330
Uh, because it's unacceptable.

21:04.330 --> 21:12.910
There was a, there's a check, uh, before the allocation, uh, allocate the view, create view, create, uh, section view function.

21:12.910 --> 21:26.870
It's also, um, the region object can't use it in more than two views, uh, but the situation I've never encountered, uh, uh, so let's, uh, rest again on the Windows 11 again.

21:27.150 --> 21:33.930
Uh, based on the custom, uh, PC service, uh, we created, uh, two views with the same section offset.

21:34.630 --> 21:41.270
So, uh, overlap happened, and the kernel only secured the first view, uh, leaving the second view at address writable.

21:41.270 --> 21:49.530
So you can see, we successfully changed the content of the, uh, service, uh, parameter without changing the protection of the, uh, first view.

21:49.870 --> 21:53.090
Uh, the RPC services, uh, will be vulnerable again.

21:53.170 --> 21:55.810
So we have already win the race.

21:56.750 --> 22:06.030
So, from the page table entry, uh, from the win debug, uh, you can see two address pointed to same pages frame, uh, page frame number.

22:06.030 --> 22:09.870
It means that it's been to the, uh, pointed to the same physical memory.

22:10.430 --> 22:16.810
And, uh, we can see from the protection, we break into the debug when server trying to, uh, print the stream from client.

22:16.810 --> 22:25.590
So, the first page is, uh, read only, and it's writable, but it's, uh, the second page is writable, uh, on the same physical memory.

22:25.590 --> 22:30.070
Uh, which will result in confirm our ideas, and the result is the result from the terminal.

22:31.830 --> 22:35.290
So, from the exploitation analyze.

22:38.290 --> 22:44.130
Uh, so let's discuss some, uh, possible exploitation, uh, from the assessment before.

22:44.270 --> 22:46.750
Uh, there's two way to, uh, exploit.

22:46.830 --> 22:55.970
Uh, one is, uh, you can use Windows services, or third party services using, uh, file operations, uh, for exploitation techniques.

22:56.030 --> 23:16.230
Uh, use, uh, created by Jamf Spatial, uh, change to write system DLL, or, and get any, uh, system privilege, or bypass some security check in, and access some functions, uh, which, uh, the main user, uh, can access, or bypass, uh, UAC on, UAC on the Windows 11.

23:16.970 --> 23:23.290
Uh, uh, the, on the other side, we can also use, uh, memory corruption, uh, exploitation techniques.

23:23.990 --> 23:32.570
Uh, firstly, I can almost crush any RPC services, or over ARPC services, and even can get system shell.

23:33.230 --> 23:40.770
So, I must, uh, admit that, uh, I'm lazy sometimes, just want to make the exploitation as easy as possible.

23:40.770 --> 23:44.630
So, unfortunately, uh, Microsoft is also stupid.

23:44.850 --> 23:54.230
Uh, they were deleted the services code, which, uh, several years ago, that Thomas used to exploit, uh, to exploit this type of issue.

23:54.530 --> 23:57.550
Uh, we need to find, uh, another possible way.

23:57.810 --> 24:03.010
But, however, it's likely possible to find the RPC services, uh, meet, uh, these conditions.

24:03.010 --> 24:04.850
It's impossible, I think.

24:05.050 --> 24:14.170
Uh, first, uh, the service need to use the shell memory without copying it to another address, and also need to have some sensitive operations on the file.

24:14.410 --> 24:19.770
So, consider this, uh, situations, it's almost impossible to find this kind of service.

24:19.770 --> 24:22.410
At least, I didn't find one.

24:22.410 --> 24:23.870
Uh, you can try it.

24:23.870 --> 24:28.890
Uh, but I think it's possible on some, uh, third party, uh, services.

24:31.450 --> 24:36.050
Uh, next, we should know what kind of, uh, argument can we use to double fish.

24:36.050 --> 24:43.650
Uh, simple structure or pointed, uh, like, uh, integer pointers, string, uh, double string use, uh, shell memory.

24:43.670 --> 24:52.010
Uh, the context structure is also, you call, uh, you may not call, you may know it's called the longest struct, uh, without copying to heap buffer.

24:52.690 --> 24:58.190
Uh, you may confuse about what is the, uh, complex, uh, or simple structure.

24:58.190 --> 25:05.110
To put it simple, uh, you just remember, if a structure contains a pointer, it will be a complex structure.

25:06.830 --> 25:11.010
Uh, this is the example of the simple complex structure, uh, we've seen.

25:11.010 --> 25:15.010
Uh, and they were, uh, treated differently when RPC unmashered them.

25:15.130 --> 25:21.990
Uh, and above is, uh, Bambi's structure, uh, which we will never use, uh, uh, in the shell memory.

25:21.990 --> 25:28.370
So, which below is the example of the, uh, complex structure ?

25:28.370 --> 25:32.510
Uh , so we need to understand RPC format and the type format first.

25:32.650 --> 25:41.170
And, uh, proc format is, uh, one server function infos, uh, parameter type, and, uh, store the, uh, it's stored offset, uh, inside the parameter.

25:41.630 --> 25:59.030
And, for example, if we have, uh, output one function in server side, uh, the proc format will generate, uh, IDL, uh, compiler from the compiler, uh, storing the parameter into, like, the parameter type offset and the location info of the parameter.

25:59.210 --> 26:01.990
And the IDL compiler also generates the comment for every...

26:02.950 --> 26:03.470
Oh

26:07.910 --> 26:08.730
, I see.

27:48.830 --> 27:59.170
Oh, it's okay now?

27:59.850 --> 28:00.670
Yeah.

28:01.010 --> 28:06.770
And then we can see, uh, the difference between, uh, the simple and, uh, complex structure in, uh, type format.

28:09.670 --> 28:15.950
Okay, the proc mark, uh, give us where the parameter type definition located in the type format string.

28:15.950 --> 28:20.350
So we can see different, uh, between the simple and the complex structure.

28:21.230 --> 28:23.870
In the header flag, you can see them in the comment.

28:24.690 --> 28:29.850
Uh, there's three situation buffer flow I can cause.

28:30.170 --> 28:36.530
Uh, I try to find the exploitation services by code auditing, uh, or faster contents.

28:36.790 --> 28:42.350
Uh, but one, uh, one condition is inside the RPC, uh, string marshal function.

28:42.350 --> 28:44.550
Uh, the pre-memory content we can control.

28:44.550 --> 28:49.050
So one service has multiple output string, uh, result sending to the client.

28:49.050 --> 28:52.830
So it's also, well, we use the shared memory to send to the client.

28:52.830 --> 28:56.910
So we can fill the whole shared memory and the argument gap.

28:57.210 --> 29:04.250
Assuming the first string is 0x50 less and the second is 0x50 less.

29:04.250 --> 29:12.850
So we can fill the argument gap in the memory, uh, after the server finished the subcode and returned to the RPCRT4.

29:12.850 --> 29:16.930
And the client size will be over 0x1000.

29:17.030 --> 29:22.450
So it's the maximum size in shared memory will cause the crash of the service.

29:24.070 --> 29:33.170
And, uh, also another heap operation, uh, which means, uh, uh, which means the size of the string store, uh, in side a pointer.

29:33.170 --> 29:36.090
So it's not easy to find this part of the server.

29:36.090 --> 29:42.250
So we can change the size of the string when the server on marshal, the server resulting in the string, uh, sending to the client.

29:42.290 --> 29:47.770
Uh, however, it's still, uh, uh, possible, not possible to exploit.

29:47.770 --> 29:51.970
You can only cause the shared memory output, uh, outbound read.

29:51.970 --> 29:55.970
Uh, so when calling the pre-memory function, so it's a pity.

29:56.610 --> 30:03.630
And, uh, third exploitation is, uh, spore service, uh, uh, spore server service.

30:03.630 --> 30:08.230
Uh, when it opened a printer, it will double check, access the name of the printer.

30:08.230 --> 30:19.550
And the first time, uh, the server will cause WCs, a string result, uh, offset, uh, can be a large offset and then allocate a string again.

30:19.650 --> 30:22.190
And I recalculated the string length.

30:22.190 --> 30:24.390
So this time the string can be small size.

30:24.410 --> 30:28.970
So you will cause out of bound write a null pointer, a null bytes.

30:29.130 --> 30:31.770
Uh, but this issue is how to exploit.

30:31.770 --> 30:38.830
So we also need to win the race and the doing heap feng shui, uh, to construct some usable target.

30:39.170 --> 30:41.130
So it's really a huge challenge.

30:41.130 --> 30:43.510
So, um, what should I do?

30:43.510 --> 30:47.130
So I decided to, uh, try to do some easy stuff first.

30:47.690 --> 30:48.990
Let's see.

30:49.150 --> 30:51.930
Uh, we're passing UIC.

30:52.470 --> 30:54.150
Uh, how is it works?

30:54.230 --> 31:01.730
Uh, the key function inside the application information service, uh, in a UIC, uh, service.

31:02.190 --> 31:09.070
Uh, luckily the service access the command line argument from the shared memory, uh, without copying it to the heap buffer.

31:09.070 --> 31:12.550
So we can have a chance to use this.

31:12.550 --> 31:19.690
Um, and also the program name and the CMD line argument are also stored in the shared memory.

31:19.990 --> 31:22.670
Uh, the UIC has a special feature.

31:22.670 --> 31:27.730
Uh, when the client executes some special program, you have not launched the save confirm window.

31:27.730 --> 31:35.750
So we can use the features to launch the arbitrary program without any launch any confirm window, uh, from APP info service.

31:35.910 --> 31:37.530
So we can bypass it.

31:38.570 --> 31:41.890
Uh, it's also not the easy as we analyzed.

31:42.030 --> 31:45.310
Uh, there's a white list, uh, inside the service.

31:45.330 --> 31:57.070
Uh, you should know that it is also argument the white list, uh, for some special program, uh, which you can, which you not, not, you not, not need to launch the, uh, confirm window.

31:58.090 --> 32:04.250
Uh, so also the new process, uh, we launched the by IPP info service, uh, will suspend the first.

32:04.250 --> 32:07.250
That means that we still cannot execute our payload.

32:07.250 --> 32:24.470
So server will check the process image section with the program file section, uh, means although we have a launch, uh, malicious program result, confirm window, the IPP info, well, every info service or also, um, launch, launch the, uh, confirm window because the true image are not the same.

32:24.870 --> 32:32.270
So it's, Microsoft is not stupid, stupid, really a good solution to prevent a launching from any malicious program.

32:32.270 --> 32:37.890
So, but unfortunately they, uh, doesn't check the argument program by launch.

32:37.890 --> 32:42.090
Uh, after the launching the program, it doesn't know, doesn't the check the argument.

32:42.830 --> 32:45.330
So we still have to change.

32:45.690 --> 32:58.670
Uh, the good thing is we can create a malicious MSCC file and there's just a research on the MSCC file when MSCC, uh, open and auto-launch the CMT shell, uh, with a malicious strip.

32:58.670 --> 33:05.230
Uh, you know, service.msc is in the white list of the UIC, uh, UIC services.

33:05.570 --> 33:13.340
So, uh, we can see, launch a high integrated command line shell without any other problem.

33:13.560 --> 33:16.840
Uh, but I'm not satisfied in doing this.

33:16.840 --> 33:19.920
Uh, it's even not a vulnerability to Microsoft.

33:19.920 --> 33:25.400
So you should be an administrator first and a main system to the system.

33:25.400 --> 33:28.960
It's not a security boundary as we seen from the, uh, Microsoft.

33:31.220 --> 33:33.580
So last is, uh, get system privilege.

33:33.620 --> 33:37.980
Uh, another good thing is, it's truly exploitable.

33:38.680 --> 33:41.820
Uh, I found a service in DCOM launch.

33:42.080 --> 33:53.080
Uh, the key is that key service in Windows system, uh, interface, uh, normal user can access, uh, the list, uh, the service dual ID, service, uh, uh, pass.

33:53.380 --> 34:01.200
So, and the service function, uh, I used to exploit, uh, it's a game, get game name, uh, config.

34:01.200 --> 34:01.940
Yeah.

34:02.120 --> 34:03.960
It's truly, and it's true.

34:03.960 --> 34:08.760
And the three parameter with simple structure means the service can use the shared memory.

34:08.760 --> 34:12.540
It would obviously get the execution from the start point.

34:15.000 --> 34:17.700
And that's the first parameter is the dual ID stream.

34:17.700 --> 34:21.060
It's come from the registry, uh, representing a game.

34:21.060 --> 34:26.320
As you know, dual ID in the picture, uh, this dual ID represent the battlefield.

34:26.320 --> 34:29.740
I think some of you might played it before.

34:29.960 --> 34:41.820
Uh, most importantly is the key is a key is fully controlled by the current user because every user in the system have the, uh, 80 independent, uh, game store configuration in the user hive.

34:41.840 --> 34:46.420
So you can just traverse the key, current key and the final one.

34:46.580 --> 34:50.000
Uh, next we may start, what can we do in the service?

34:50.080 --> 34:55.280
Uh, because we cannot pass in the, uh, uh, parameters through the shared memory.

34:55.280 --> 34:57.640
So we can, uh, pretty lucky.

34:57.640 --> 35:02.160
We can do memory leak and array buffer or array overflow in this function.

35:02.440 --> 35:10.180
So first the function directly write a string, uh, pointer to the shared memory, which means we can leak the shared memory address mapped in the server side.

35:10.280 --> 35:15.940
Although the memory is unmapped after the request, but the address will never change.

35:15.940 --> 35:25.960
So we can use the shared memory to construct our fake object and the V tables and the plus this stack array buffer floor upon access.

35:25.960 --> 35:37.920
And after the information leak on the share memory, you can see the function directly use the index from the share memory and the writer share memory or the dress a pointer out of a bond on the stack.

35:37.920 --> 35:43.020
Uh, this means that we can do info leak and the stop off for all floor, uh, just in one function.

35:43.220 --> 35:47.640
And, uh, it's a good and, uh, really, and the good right pump primitive.

35:49.280 --> 35:52.660
Uh, this is just a strategy, a strategy I use.

35:52.660 --> 36:05.320
Uh, the first I need to leak the share memory address and we just, uh, call the server function and the, you know, those thread to repeatedly read the share memory so we can get the pointer.

36:05.820 --> 36:08.780
And when we get the share memory, we can create a fake object.

36:08.780 --> 36:12.280
The V table are based on the liquid information in the step one.

36:12.340 --> 36:23.420
And then finally, uh, we can try to change the index of the share memory to trick the stack array, uh, floor, overflow to load our evil DRL to the service and to get system shell.

36:24.260 --> 36:26.840
Uh, I'll show you one step up by step.

36:26.860 --> 36:30.660
And this is, uh, I'll put on the windy bug window.

36:30.660 --> 36:33.680
We can see several right the share memory pointer on the share memory.

36:33.680 --> 36:40.860
We just read it repeatedly from the kind until, uh, we read the, uh, pointer, share, share pointer.

36:41.380 --> 36:43.140
Uh, next the real problem cam.

36:43.140 --> 36:48.920
So we can get a staff or a buffer or floor, but, uh, how and where to write, right.

36:48.920 --> 36:50.160
I don't know what to write.

36:50.260 --> 36:53.480
Uh, I choose to write the RPC message object on the stack.

36:53.920 --> 37:00.520
Uh, first the RPC message is a member in MIT or some message and the object is allocated on the stack.

37:00.520 --> 37:04.800
So before I see you call the server, it's easy to over override it.

37:04.880 --> 37:07.960
And there's all the share memories, uh, not executable.

37:07.960 --> 37:10.580
So we can just overwrite and the return.

37:10.580 --> 37:16.360
If we choose to override the return address, uh, we cannot directly do the ROP.

37:17.200 --> 37:21.880
Uh, uh, let's see what we write from the view of the wind debug.

37:21.880 --> 37:23.780
Uh, RCX is a rain decks.

37:23.780 --> 37:25.660
Uh, we can fully a contrary it.

37:25.660 --> 37:30.340
RX is a shimmer memory address and then we also can't fully control it.

37:30.340 --> 37:34.720
So you can see, uh, we easily override RPC message pointer on the stack.

37:35.000 --> 37:39.820
So when a server you turn to RPC core engine, it will be operated on the fake object.

37:40.440 --> 37:47.700
Uh, so we can see from the engine call NDR get buffer RCX already being the share memory address.

37:48.220 --> 37:50.620
And this is a layout of the share memory.

37:50.800 --> 37:55.200
Uh, there's also some type check, uh, because we can't fully control it.

37:55.200 --> 37:56.260
So it's not a problem.

37:56.380 --> 38:09.560
Uh, I choose to construct that fake RPC binding handle, uh, in the share memory, uh, real problem cam, uh, where you can see finally you arrive to the virtual function calling.

38:09.560 --> 38:11.720
It's a XFG check.

38:12.040 --> 38:26.240
Um, the first, uh, uh, of a table and, um, uh, I want to actually low, uh, uh, directly call to the load library, but you can see, uh, the V table and the, uh, first parameter is overlapped.

38:26.240 --> 38:30.600
So we can directly onto, we can not directly call the load library.

38:30.720 --> 38:35.000
Uh, so, uh, we can always find a way.

38:35.000 --> 38:42.220
Uh, if I can directly call a load library, I can find a legal callable function to, to register pivoting.

38:42.220 --> 38:51.200
So we know there's a technique, uh, called a stack pivoting in CTF exportation techniques where you can directly RP on the current stack.

38:51.580 --> 38:58.440
So for the register pivoting, I just need to find a function which can exchange the content of the register RCX.

38:58.640 --> 39:03.140
And, uh, uh, then the register were appointed to the DRL pass.

39:03.140 --> 39:06.040
And luckily I found this kind of, uh, uh, function.

39:06.040 --> 39:06.980
It can't reach your cage.

39:06.980 --> 39:07.740
It's changed.

39:07.740 --> 39:11.340
The register is inside the combats DRL.

39:11.340 --> 39:11.640
Okay.

39:11.640 --> 39:16.840
Directly called bypass the XFG check is a callback function.

39:16.840 --> 39:18.400
And this is a layout.

39:19.120 --> 39:29.840
Uh, RCX is before we call into the callback, it's pointing to bind handle object and the value in a purple color is the type of information and the callback function.

39:29.840 --> 39:36.530
Uh, we can call low libraries with log in function to with the DRL pass in the second parameter.

39:36.730 --> 39:44.850
So luckily before the control for all check, the validity of the callback function, the function is not the first member of the Vtable is at the 0x70.

39:44.850 --> 39:48.750
So the start location of the Vtable we can use to put out with DRL pass.

39:49.050 --> 39:53.910
Uh, so without worrying about the function validity because we were never used.

39:54.670 --> 39:58.730
So then we can load our custom DRL without any resistance.

39:58.730 --> 39:59.750
Yeah.

40:00.060 --> 40:02.660
And I will show you the demo.

40:07.430 --> 40:09.980
I use a, uh, a normal user.

40:10.960 --> 40:25.900
It's a user group and I write it in all the POC in that person and you can see is a normal user with a medium privilege.

40:25.900 --> 40:28.160
It's not in our administrator group.

40:30.570 --> 40:31.130
Okay.

40:31.130 --> 40:38.050
And then we check the DECOM service to see if we can load our malicious DRL.

40:41.130 --> 40:41.790
Okay.

40:41.790 --> 40:54.970
We can see the shared memory and the COM base and we see we already know that our evil DRL and there's a shell coming and we type who am I and we get a system privilege.

40:55.470 --> 40:57.570
It's all the privilege.

41:02.160 --> 41:03.180
Thank you.

41:03.180 --> 41:03.560
Thank you.

41:03.560 --> 41:04.000
Thank you.

41:11.410 --> 41:12.990
Oh, thank you.

41:17.530 --> 41:19.970
And, uh, a conclusion.

41:19.970 --> 41:20.930
So the voices.

41:20.930 --> 41:30.330
So to be continue, um, I think there's still some research I need to do in the future.

41:31.230 --> 41:37.150
I like the automation info extract from the RPC interface.

41:37.150 --> 41:42.950
I need to find this, um, exportation service and the argument which made the exportation bar.

41:42.950 --> 41:52.810
Uh, if you have any good ideas and you can please share it to me, I also want to know some good ideas for the two develop developing.

41:52.970 --> 42:02.590
And there's a much special, more, uh, special features in RPC and the need to be X mind and the more effective exportation techniques.

42:02.590 --> 42:06.410
If you're on the other, any good ideas, feel free to contact me.

42:06.410 --> 42:07.390
Yeah.

42:09.190 --> 42:09.750
Yeah.

42:09.750 --> 42:12.870
And the right Bob, uh, this is our bunk hunting experience.

42:12.870 --> 42:17.190
I want to share with you and the first don't trust any patches from the render.

42:17.190 --> 42:20.750
It may still not patch the vulnerability effectively.

42:20.750 --> 42:25.310
And also the patch analyze is still more effect in back hunting.

42:25.590 --> 42:31.250
You should be more creative and the criticizing when criticizing, when back hunting.

42:31.250 --> 42:31.850
Yeah.

42:31.850 --> 42:35.990
You should dare to do it and we should be patient.

42:36.370 --> 42:39.030
But bunk hunting is a long way medicine.

42:39.870 --> 42:45.790
And our last, uh, don't meet any, meet any, miss any other, any side effect.

42:45.790 --> 42:49.890
This effect may cause security flaw afterwards.

42:51.350 --> 42:52.630
Yeah.

42:53.150 --> 43:00.650
And, uh, this, uh, for this type of service, uh, we mentioned in the talk, there's still much special feature is the RPC RPC.

43:00.950 --> 43:05.930
Uh, we need to XMI and the security of RPC is actually effect.

43:05.930 --> 43:14.750
The security of the RPC, uh, for Microsoft, uh, we can see it's really done a great tireless works on the security of the RPC services.

43:14.750 --> 43:26.490
Although we cause the double fish in the RPC services, uh, we need to still find the, uh, export both service in the, and the parameters still meet us very strict bars.

43:27.630 --> 43:30.030
And this is a reference of our talk.

43:31.070 --> 43:32.590
And, uh, thank you.

43:32.590 --> 43:33.790
Uh, is there another questions?

43:33.790 --> 43:37.290
Uh, because there is a microphone has any problems and sorry for that.

43:37.290 --> 43:37.810
Yeah.

43:50.580 --> 43:51.660
Oh, thank you.

