start	end	text
2650	25720	I can start? Okay. It's good to be here. I'm Wang Junjie Zhang. I'm a security researcher from
25720	33460	the Hearthstone Networks. My research direction is Windows vulnerability research including
33460	41060	user mode and kernel mode. And also I've been listed as the most valuable researcher of the
41060	56380	Microsoft 2020, 2022, and 2023, 2024. Yeah. Okay. So, let's just start my talk. And this is,
56380	63440	I already introduced myself and our colleague here. So, I'm Wang Junjie Zhang. I'm a
63460	68420	researcher at Microsoft. Um, firstly, let's see our agenda today. It's mainly consists of
68420	76440	four parts. Um, we'll introduce architecture of the LPC and RPC. So, we'll have a deeper
76440	84740	understanding of it. And then look at some, uh, common vulnerabilities inside LPC and RPC. And
84740	90860	we'll study some root cause of the vulnerabilities. And then I will share some details of
90860	97900	the vulnerabilities I found by myself and my team. And which can bypass the LPC, RPC, uh,
97900	104160	security mechanism. Uh, I will show you step-by-step, uh, to use, uh, this small security
104160	111840	flaw to bypass the security mitigations like SDR, DEP, XFG, and finally get system shell. Uh,
111840	120540	you won't get it from anywhere else. So, and that's the way to make a conclusion. Yeah. Uh,
120540	129120	so it's, uh, architecture, yeah. We already know, um, the LPC, uh, was introduced, uh, to
129120	136900	replace the ARPC. Uh, it's called, uh, Lightweight, Lightweight Procedure Core, uh, mainly
136900	144400	used in, uh, Windows system, uh, inside, uh, Windows system services. Uh, and it's, uh,
144400	150520	concerned by many researchers for each, it's huge attack service. Uh, so it's, uh,
150540	159800	based on the ARPC. And this is, uh, uh, uh, ARPC and RPC architecture. And why we
159800	171240	combine the ARPC and RPC together? Uh, why we combine, uh, it's together? For reason
171240	177320	listed below, uh, most, uh, RPC services is based on the ARPC or NAND pipe. So it's
177320	183060	almost, uh, based on the same, uh, security mechanism. And the security flaw inside
183060	190820	the, uh, ARPC can affect the security of RPC services. And this is, uh, also the
190820	195540	architecture of the ARPC, RPC from, uh, Windows internal. Uh, you can communicate,
195540	201200	this, uh, see the communication module inside it. And it's also support some, uh,
201200	206680	message queries and some share section. Uh, also, uh, support share section to pass
206680	216820	the message. Uh, why we use, uh, section here? Uh, because it's a more effective, uh,
216820	221860	data passing mechanism on Windows, uh, section object. Uh, more efficient and fast.
221860	226920	And, uh, what about the region? Uh, why region is, uh, represent a range of the shared
226920	232220	memory that can be opened within the context of a given port. Uh, the section can be
232220	238400	shared, uh, accessed by one process, uh, which only have a right access. And meanwhile,
238400	244400	uh, the client only have the right access. Uh, this picture, uh, describe the relationship
244400	251260	between the section. Yeah. We can split up the whole section into, uh, different region. Uh,
251260	258140	one piece is represented by, uh, one region object. Uh, we have a set, uh, size, uh,
258140	265480	which is representing the map of the set and the size of the set section. Yeah. Uh, I see
265480	273760	some, uh, historical vulnerabilities. Yeah. Um, first kind of bug is, uh, kind of logical
273760	280440	bug, uh, in ARPC when, uh, you know, there's too much, uh, uh, research, uh, on the
280440	287000	internet. Um, it related to, uh, uh, doing when the service doing some, uh, file
287000	292560	operating, uh, operations. Uh, it's need to, uh, impersonate the colors, uh, token and
292560	297500	doing some, uh, operations on file. Uh, however, you know, sometimes the failure to
297500	303660	properly handle the file operation, uh, with a file, like the symbol link, it may be
303660	310640	resulting the service being able to modify, or write, or delete, and even create, uh, some
310640	316980	files when client should not have the permission, uh, these operations. So, uh, this
316980	324940	vulnerability, uh, CVE 2020 and 0F0911 is an example of the using user's device map, uh,
324940	332540	where impersonating users and the service will operate on malicious, uh, MSAI files, uh, on
333240	338560	the user's device map installer directory, and it will directly, uh, to another path. So,
338560	343720	when the service revert to the system privilege, it also trust the content, uh, to read from
343720	350860	their client installer directory and source, um, the privilege acceleration happen, yeah.
353340	359840	Uh, uh, this kind of bug exploitation have much articles and research, uh, on the internet, uh,
359840	365880	by using tricks of, uh, firstly, uh, I think it's discovered by Google research, uh,
365880	371980	James Fosho, uh, by using tricks like NTFS junctions, uh, higher link or object symbol
371980	377960	links and, uh, opportunities locks, you can easily, uh, write exploitations, uh, on this
377960	384620	kind of bugs. Yeah. Uh, the second, second example is, um, malicious, uh, memory
384620	390900	corruption bug inside LPC, LPC kernel, uh, in recent years. Uh, we have seen a lot of, um,
390900	397360	memory corruption issues inside the LPC, LPC kernel. Uh, so the following code snippet is a
397360	402960	part of the vulnerability and is associated with the LPC section blob object. Uh, when you
402960	408580	create a LPC section, uh, in the map legacy port view function, uh, there's a race window
408580	413880	before the function with, uh, uh, view port, view object. Uh, during this race window,
413880	421980	attacker can, uh, destroy the LPC port object, uh, causing it, uh, LPC create section view
421980	430160	function, uh, access, uh, 3D pointer. The picture describe the, uh, race window, uh, in the
430160	436220	connect port function. Uh, the kernel, kernel creates the first, uh, LPC port and, uh, we can
436220	442720	try to close the handle table in the second thread. Uh, if this moment, close moment, uh,
442720	447680	between the create section and the create view port function, you can get a blue screen. Uh,
447680	453040	but however, this kind of issue is, I think it's a little bit hard to exploit because you need to
453040	460060	win the race first. Uh, what we observe is that most of these, uh, memory corruption bug, uh,
460060	466440	inside LPC kernel or LPC services, and most of them are traditionally memory corruption bug,
466440	472000	bugs, uh, due to the server side lack of check when LPC services, uh, handle data from the
472000	477600	client side. And last example is, uh, I think it's very interesting. Uh, logical
477600	483360	fallback in LPC RPC discovered in 2016-2017. Uh, research found that the kernel doesn't
483360	489600	protect the shared memory privilege, uh, when using it to pass the, uh, m-message data. In
489600	495620	theory, the kernel changes the shared section protection in client sides, uh, to read only, uh,
495620	499900	preventing the client side changing the memory, uh, while server side, uh, calling stop code
499900	505260	that may be cause double fetch loss in server side. Uh, you can use the virtual protect
505260	511160	function to change the shared memory, uh, from read only to write, uh, read write, and
511160	517540	causing data race condition in server side. Uh, it's pretty, uh, predictable, right? Uh,
517540	523040	imagine, uh, we have a, have already have a, uh, RPC function, uh, accepts, uh, string
523040	527920	parameter and print it twice with a sleep, uh, between these two option. Uh, we write a
527920	532640	POC and, uh, send a string and try to call the virtual protect and change the content of the
532640	538920	string. Uh, we can see the server side print two, uh, different, uh, strings. Um, it means
538920	544300	that, uh, we can change the parameter while the server side, uh, perform any other
544300	552060	operation. Although, uh, this vulnerability has been fixed, uh, I decide to learn more from
552060	560080	it. Uh, maybe we can find, uh, more interesting stuff. So, uh, first question is, uh, is
560080	571260	really secure update patch? Yeah, uh, from my, all of the research, uh, result I know, uh,
571260	578800	shared memory is, uh, available for, uh, almost any RPC over LPC services. So I decide to write
578920	585420	a custom RPC service and try to, uh, change the, uh, memory pro-memory protection again. But
585420	593260	finally, uh, get, uh, virtual protect EX error. So, uh, what happened to after the patch? So I
593260	599400	decide to, uh, learn more from the reverse engineering. Uh, first, uh, N2S kernel try to
599400	604020	secure the view of the section. It doesn't allow to change the memory attribute from the user
604020	613080	space. And, uh, secondly, both N2S and RPC RT4 module DLL enable secure mode in mode check. It
613080	617420	means that the server will not manipulate the shared memory, uh, when it detected the shared
617420	624980	memory is unsafe. Uh, this technique, uh, this is a technique that tells, uh, the security
624980	632380	mechanism when handle shared memory from client side. Uh, kernel use map view, secure view of
632380	637540	section function to create a security view. So you secure virtual memory and you can't change,
637540	771820	uh, attribute. And when sending the attribute, uh, sending message to the server, it's check
771820	778340	the RPC section and the region we use to send the message to see if it's safe and the region
778340	784280	can't bind with more than two view objects. It's trying to change the attributes of the shared
784280	790760	memory. The address, uh, to read only. If this step falls, then the server side will be marked
790760	798980	with unsafe and the RPC RT4 dot DLL will use the shared memory to unmasher the, uh, server side.
800000	806340	And this is the code pieces, uh, from the user mode in RPC RT4. Uh, it will acquire the RPC
806340	813100	message attributes, uh, including the security flag of the RPC region. If the region is
813100	819240	unsecure, you can see, uh, it will lock its heap buffer. Uh, it's managed by Pcache object and
819240	823700	copying the shared memory to the heap buffer. So it will not cause double phishing
823700	830980	vulnerability. So when the server decide, uh, detect the region, it's unsafe. Also take a
830980	843080	look at the virtual protect ES function to, uh, see how the kernel patch, uh, the, uh,
843080	848960	special bad event object, uh, to, uh, secure them, mark the bad objects. It's a security view or
848960	856320	not. So we know that Windows kernel use MM bad object to describe one virtual address in, uh,
856320	862040	user space. It's, uh, it's, uh, describe the start and the ending of the virtual page. Uh, when
862040	867820	changing the memory of, uh, production, it will check if the bad event object is, uh, in the
874040	881180	list. Uh, unfortunately, the bad event structure symbol was deleted from Windows 11. Uh, so I
881180	887380	can only use the old symbol from Windows 10. And digging into it, uh, there's two key
887380	893540	function, uh, for address, uh, protection. One is m-i-c-w-i-s-s-l-e protection and the
893540	902020	other is revert m-i-r-e-v-e-r-t function. Uh, this is the output from the, uh, uh, debug, uh, in
902020	909120	the right picture. And you can see, uh, before and after the w-i-c-w-i-s-s-l-e protection, it's
909120	914860	changed a bit of the w-i-s-s-l-e protection from 4 to 1. Yeah, I guess it's mean to read
914860	921020	right when the value is 4 and the no access value is 1. Uh, left picture describe the p-t-u
921020	926880	content, uh, about Intel. Uh, it's also, you know, it's, uh, page table structure. Uh, after
926880	932580	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
932580	940300	0, so the whole page in the current, uh, current side will change to the read only. Uh, but the
940300	946620	server side with another, will use another page table, uh, so when, what about the w-i-s-s-l-e
946620	953980	protection? Uh, I think it's, uh, this bit from 60, 60 to 62 is reversed according to, uh,
953980	960340	Intel's documentation, so I guess Microsoft use it for some special purpose, yeah. And, uh,
960340	965160	when changing the address protection, it's called m-m-m-check security, uh, secure vat to
965160	973340	check if there's, uh, uh, special vat event, as we talked before. And, um, uh, we, when we
973340	978420	call the compare p-t-e protection, it will compare the page table. Finally, compare the
978420	985420	page table, uh, protection with, with the desired protection mask, uh, uh, we, uh, process
985420	995760	the, uh, we pass to the virtual protect e-x, uh, to see, uh, return change, uh, attribute if
995760	1001980	two value is the same. If it's not equal to the virtual protect e-x, it will return error.
1001980	1007940	Unfortunately, uh, WS protection now is one, so it's not the same as before. Uh, it's really
1007940	1014780	has some weird errors you see when changing the protection from the address. It's really, uh,
1014780	1024800	not the same as we thought. Uh, I should actually try to bypass, uh, this function. Uh, so
1024800	1037930	it's changing the p-t-e... so it's changing... you're right, it's changing the p-t-e
1037950	1049950	function. Can you hear me? Oh, now it's okay, yeah. Uh, so I tried to bypass the, uh, this
1049950	1055330	function, uh, and, uh, it's changed the protection one page. So, if you allow the shared
1055330	1059970	memory for more than two page, and you only write data to the first page without it doing
1059970	1067850	any other operations, so, um, the operation will fail. Uh, but the security function, uh,
1068430	1074070	you know, uh, because, uh, the rest of the page doesn't even have the page table, uh, so you
1074070	1081970	can't change the attributes. Okay, let's, uh, see the vulnerability details, uh, we found
1081970	1090710	in, uh, the region. Uh, the kernel always do try to alignment the allocation size to one page.
1090810	1097710	Uh, you can skip the session object, uh, the starting of session, actually, um, it's auto
1097710	1103230	increased, uh, based on the, uh, uh, last region and the offset. However, the allocation size
1103230	1112250	is unchecked. So, what about this, um, small security, uh, um, flaw? This small undiscovered
1112250	1119730	issue can cause, uh, afterwards. Uh, but you still remember the previous picture, yeah. Uh,
1119730	1124770	assuming we had located, uh, we already allocated four, uh, region. Uh, the size of the first
1124770	1133630	region is 0x1000, so the start of, start offset of the second region, uh, is actually, will be
1133630	1140610	one, 0x1000. Based on the info in the picture, we can know a starting offset of the region
1140610	1147570	three is 0x, uh, 4000, uh, which is pretty easy to understand and, uh, calculate it. Uh, so
1147570	1153810	based on the, this, uh, info we know, we can see how unchecked section, unchecked, uh, section
1153810	1162110	size, uh, we can do in the following. Uh, if we allocated, uh, which region was extremely big
1162110	1173470	size, 0x002 is actually minus, uh, FFFE. Uh, based on the region, uh, and the view granularity,
1173470	1179350	the final offset of region two is actually will be zero. So, the allocation size, uh, will be
1179350	1186470	still zero. So, what does this mean? Uh, uh, this means that the region two will overlap with
1186470	1193470	the region one, and they will be mapping to the same physical address. Uh, we can use the
1193470	1199310	view one to send and receive the LLPC message, and this view will be protected by the LLPC
1199310	1204770	kernel, by using secure view against the write, uh, function. But the second view will be
1204770	1211470	left, and the kernel will do nothing on it. So, because we don't even use it, um, so we can use
1211470	1219050	the address of the second region, it actually change, um, the content. It's writable, so the
1219050	1224190	double fish will happen again. Uh, the secure view, uh, write against the write function, uh,
1224190	1230790	can't protect you anymore. So, it is, uh, there will be many, still many questions, uh, for
1230790	1237070	you. Uh, as you see in the previous page, uh, the region allocation size is zero. Uh, so
1237070	1242650	while you still can change the content of the shared memory, um, you know, because, uh, the
1242650	1248910	map view function support mapping size of zero, uh, you allocate a page with size, uh, one
1248910	1254710	page by default, so we don't need to worry about it. And the second, if you set the map view
1254710	1262630	function, it cannot, uh, cannot, it can't accept zero size? Why don't you pass zero size? Uh,
1262630	1268650	because it's unacceptable. There was a, there's a check, uh, before the allocation, uh,
1268650	1276110	allocate the view, create view, create, uh, section view function. It's also, um, the region
1276110	1281890	object can't use it in more than two views, uh, but the situation I've never encountered, uh,
1281890	1289550	uh, so let's, uh, rest again on the Windows 11 again. Uh, based on the custom, uh, PC
1289550	1296890	service, uh, we created, uh, two views with the same section offset. So, uh, overlap happened,
1296890	1300690	and the kernel only secured the first view, uh, leaving the second view at address
1300690	1305530	writable. So you can see, we successfully changed the content of the, uh, service, uh,
1305530	1311630	parameter without changing the protection of the, uh, first view. Uh, the RPC services, uh,
1311630	1319510	will be vulnerable again. So we have already win the race. So, from the page table entry, uh,
1319510	1325490	from the win debug, uh, you can see two address pointed to same pages frame, uh, page frame
1325490	1331090	number. It means that it's been to the, uh, pointed to the same physical memory. And, uh,
1331090	1335790	we can see from the protection, we break into the debug when server trying to, uh, print the
1335790	1342390	stream from client. So, the first page is, uh, read only, and it's writable, but it's, uh, the
1342390	1346490	second page is writable, uh, on the same physical memory. Uh, which will result in
1346490	1354230	confirm our ideas, and the result is the result from the terminal. So, from the exploitation
1354230	1363170	analyze. Uh, so let's discuss some, uh, possible exploitation, uh, from the assessment
1363170	1371330	before. Uh, there's two way to, uh, exploit. Uh, one is, uh, you can use Windows services, or
1371330	1377770	third party services using, uh, file operations, uh, for exploitation techniques. Uh, use, uh,
1377770	1383610	created by Jamf Spatial, uh, change to write system DLL, or, and get any, uh, system
1383610	1389230	privilege, or bypass some security check in, and access some functions, uh, which, uh, the
1389230	1398550	main user, uh, can access, or bypass, uh, UAC on, UAC on the Windows 11. Uh, uh, the, on
1398550	1404510	the other side, we can also use, uh, memory corruption, uh, exploitation techniques. Uh,
1404510	1411490	firstly, I can almost crush any RPC services, or over ARPC services, and even can get
1411490	1418490	system shell. So, I must, uh, admit that, uh, I'm lazy sometimes, just want to make the
1418490	1425510	exploitation as easy as possible. So, unfortunately, uh, Microsoft is also stupid. Uh, they
1425510	1432850	were deleted the services code, which, uh, several years ago, that Thomas used to exploit, uh, to
1432850	1438910	exploit this type of issue. Uh, we need to find, uh, another possible way. But, however, it's
1438910	1444110	likely possible to find the RPC services, uh, meet, uh, these conditions. It's impossible, I
1444110	1449250	think. Uh, first, uh, the service need to use the shell memory without copying it to another
1449250	1456110	address, and also need to have some sensitive operations on the file. So, consider this, uh,
1456110	1462410	situations, it's almost impossible to find this kind of service. At least, I didn't find one.
1462410	1471970	Uh, you can try it. Uh, but I think it's possible on some, uh, third party, uh, services. Uh,
1471970	1476770	next, we should know what kind of, uh, argument can we use to double fish. Uh, simple
1476770	1482770	structure or pointed, uh, like, uh, integer pointers, string, uh, double string use, uh,
1482770	1489190	shell memory. Uh, the context structure is also, you call, uh, you may not call, you may know
1489190	1493810	it's called the longest struct, uh, without copying to heap buffer. Uh, you may confuse
1493810	1500230	about what is the, uh, complex, uh, or simple structure. To put it simple, uh, you just
1500230	1507810	remember, if a structure contains a pointer, it will be a complex structure. Uh, this is the
1507810	1512150	example of the simple complex structure, uh, we've seen. Uh, and they were, uh, treated
1512150	1519150	differently when RPC unmashered them. Uh, and above is, uh, Bambi's structure, uh, which we
1519150	1528370	will never use, uh, uh, in the shell memory. So, which below is the example of the, uh,
1528370	1532950	complex structure? Uh, so we need to understand RPC format and the type format first. And, uh,
1532950	1538610	proc format is, uh, one server function infos, uh, parameter type, and, uh, store the, uh,
1538610	1544510	it's stored offset, uh, inside the parameter. And, for example, if we have, uh, output one
1544510	1551950	function in server side, uh, the proc format will generate, uh, IDL, uh, compiler from the
1551950	1557070	compiler, uh, storing the parameter into, like, the parameter type offset and the location
1557070	1561990	info of the parameter. And the IDL compiler also generates the comment for every...
1562950	1683970	Oh, I see. Oh, it's okay now? Yeah. And then we can see, uh, the difference between, uh, the
1683970	1692210	simple and, uh, complex structure in, uh, type format. Okay, the proc mark, uh, give us
1692210	1696570	where the parameter type definition located in the type format string. So we can see
1696570	1702730	different, uh, between the simple and the complex structure. In the header flag, you can see
1702730	1711790	them in the comment. Uh, there's three situation buffer flow I can cause. Uh, I try to find
1711790	1718870	the exploitation services by code auditing, uh, or faster contents. Uh, but one, uh, one
1718870	1723990	condition is inside the RPC, uh, string marshal function. Uh, the pre-memory content we can
1723990	1730110	control. So one service has multiple output string, uh, result sending to the client. So it's
1730110	1734410	also, well, we use the shared memory to send to the client. So we can fill the whole shared
1734410	1741770	memory and the argument gap. Assuming the first string is 0x50 less and the second is 0x50
1743090	1749370	less. So we can fill the argument gap in the memory, uh, after the server finished the
1749370	1757950	subcode and returned to the RPCRT4. And the client size will be over 0x1000. So it's the
1758470	1765810	maximum size in shared memory will cause the crash of the service. And, uh, also another
1765810	1771770	heap operation, uh, which means, uh, uh, which means the size of the string store, uh, in
1771770	1777090	side a pointer. So it's not easy to find this part of the server. So we can change the size
1777090	1781450	of the string when the server on marshal, the server resulting in the string, uh, sending
1781450	1788230	to the client. Uh, however, it's still, uh, uh, possible, not possible to exploit. You can
1788230	1794090	only cause the shared memory output, uh, outbound read. Uh, so when calling the pre-memory
1794090	1801750	function, so it's a pity. And, uh, third exploitation is, uh, spore service, uh, uh,
1802450	1806910	spore server service. Uh, when it opened a printer, it will double check, access the name
1806910	1814090	of the printer. And the first time, uh, the server will cause WCs, a string result, uh,
1814090	1821370	offset, uh, can be a large offset and then allocate a string again. And I recalculated
1821370	1825970	the string length. So this time the string can be small size. So you will cause out of
1825970	1833830	bound write a null pointer, a null bytes. Uh, but this issue is how to exploit. So we also
1833830	1839690	need to win the race and the doing heap feng shui, uh, to construct some usable target. So
1839690	1846170	it's really a huge challenge. So, um, what should I do? So I decided to, uh, try to do some
1846170	1855110	easy stuff first. Let's see. Uh, we're passing UIC. Uh, how is it works? Uh, the key
1855110	1862990	function inside the application information service, uh, in a UIC, uh, service. Uh, luckily
1862990	1867670	the service access the command line argument from the shared memory, uh, without copying
1867670	1874990	it to the heap buffer. So we can have a chance to use this. Um, and also the program name
1874990	1881750	and the CMD line argument are also stored in the shared memory. Uh, the UIC has a special
1881750	1886470	feature. Uh, when the client executes some special program, you have not launched the
1886470	1892010	save confirm window. So we can use the features to launch the arbitrary program without any
1892010	1899530	launch any confirm window, uh, from APP info service. So we can bypass it. Uh, it's also
1900070	1905950	not the easy as we analyzed. Uh, there's a white list, uh, inside the service. Uh, you
1905950	1912270	should know that it is also argument the white list, uh, for some special program, uh, which
1912270	1918570	you can, which you not, not, you not, not need to launch the, uh, confirm window. Uh,
1918570	1923910	so also the new process, uh, we launched the by IPP info service, uh, will suspend the
1923910	1928950	first. That means that we still cannot execute our payload. So server will check the process
1928950	1933810	image section with the program file section, uh, means although we have a launch, uh,
1933810	1938190	malicious program result, confirm window, the IPP info, well, every info service or
1938190	1944110	also, um, launch, launch the, uh, confirm window because the true image are not the
1944110	1950610	same. So it's, Microsoft is not stupid, stupid, really a good solution to prevent a launching
1950610	1955990	from any malicious program. So, but unfortunately they, uh, doesn't check the argument
1955990	1961250	program by launch. Uh, after the launching the program, it doesn't know, doesn't the
1961250	1966150	check the argument. So we still have to change. Uh,
1966150	1971530	the good thing is we can create a malicious MSCC file and there's just a research on
1971530	1977170	the MSCC file when MSCC, uh, open and auto-launch the CMT shell, uh,
1977170	1978990	with a malicious strip. Uh, you know,
1978990	1983990	service.msc is in the white list of the UIC, uh,
1983990	1988700	UIC services. So, uh, we can see,
1988700	1994080	launch a high integrated command line shell without any other problem. Uh,
1994080	1997380	but I'm not satisfied in doing this. Uh,
1997380	1999920	it's even not a vulnerability to Microsoft.
1999920	2005400	So you should be an administrator first and a main system to the system.
2005400	2008960	It's not a security boundary as we seen from the, uh, Microsoft.
2011220	2015620	So last is, uh, get system privilege. Uh, another good thing is,
2015620	2022880	it's truly exploitable. Uh, I found a service in DCOM launch. Uh,
2022880	2026640	the key is that key service in Windows system, uh, interface, uh,
2026640	2031140	normal user can access, uh, the list, uh, the service dual ID,
2031140	2036580	service, uh, uh, pass. So, and the service function, uh,
2036580	2041940	I used to exploit, uh, it's a game, get game name, uh, config. Yeah.
2042120	2043960	It's truly, and it's true.
2043960	2048020	And the three parameter with simple structure means the service can use the
2048020	2052540	shared memory. It would obviously get the execution from the start point.
2055000	2057700	And that's the first parameter is the dual ID stream.
2057700	2062160	It's come from the registry, uh, representing a game. As you know,
2062160	2066320	dual ID in the picture, uh, this dual ID represent the battlefield.
2066320	2070400	I think some of you might played it before. Uh,
2070980	2074840	most importantly is the key is a key is fully controlled by the current user
2074840	2079640	because every user in the system have the, uh, 80 independent, uh,
2079640	2081820	game store configuration in the user hive.
2081840	2086420	So you can just traverse the key, current key and the final one.
2086580	2090600	Uh, next we may start, what can we do in the service? Uh,
2090600	2095280	because we cannot pass in the, uh, uh, parameters through the shared memory.
2095280	2097640	So we can, uh, pretty lucky.
2097640	2102160	We can do memory leak and array buffer or array overflow in this function.
2102440	2106400	So first the function directly write a string, uh, pointer to the shared memory,
2106400	2110180	which means we can leak the shared memory address mapped in the server side.
2110280	2114020	Although the memory is unmapped after the request,
2114020	2115940	but the address will never change.
2115940	2122340	So we can use the shared memory to construct our fake object and the V tables
2122340	2125960	and the plus this stack array buffer floor upon access.
2125960	2128900	And after the information leak on the share memory,
2128900	2134020	you can see the function directly use the index from the share memory and the
2134020	2138360	writer share memory or the dress a pointer out of a bond on the stack. Uh,
2138360	2141740	this means that we can do info leak and the stop off for all floor, uh,
2141740	2145700	just in one function. And, uh, it's a good and, uh, really,
2145700	2149780	and the good right pump primitive. Uh,
2149780	2153140	this is just a strategy, a strategy I use. Uh,
2153140	2158560	the first I need to leak the share memory address and we just, uh,
2158560	2160500	call the server function and the, you know,
2160500	2165320	those thread to repeatedly read the share memory so we can get the pointer.
2165820	2168780	And when we get the share memory, we can create a fake object.
2168780	2172280	The V table are based on the liquid information in the step one.
2172340	2173900	And then finally, uh,
2173900	2177200	we can try to change the index of the share memory to trick the stack array,
2177720	2178480	uh, floor,
2178480	2183420	overflow to load our evil DRL to the service and to get system shell.
2184260	2188620	Uh, I'll show you one step up by step. And this is, uh,
2188620	2190660	I'll put on the windy bug window.
2190660	2193680	We can see several right the share memory pointer on the share memory.
2193680	2198680	We just read it repeatedly from the kind until, uh, we read the, uh,
2198680	2203140	pointer, share, share pointer. Uh, next the real problem cam.
2203140	2206840	So we can get a staff or a buffer or floor, but, uh,
2206840	2210680	how and where to write, right. I don't know what to write. Uh,
2210680	2214500	I choose to write the RPC message object on the stack. Uh,
2214500	2219540	first the RPC message is a member in MIT or some message and the object is
2219540	2222340	allocated on the stack. So before I see you call the server,
2222340	2226960	it's easy to over override it. And there's all the share memories, uh,
2226960	2230580	not executable. So we can just overwrite and the return.
2230580	2233980	If we choose to override the return address, uh,
2233980	2239040	we cannot directly do the ROP. Uh, uh,
2239040	2242360	let's see what we write from the view of the wind debug. Uh,
2242360	2245660	RCX is a rain decks. Uh, we can fully a contrary it.
2245660	2250340	RX is a shimmer memory address and then we also can't fully control it.
2250340	2254720	So you can see, uh, we easily override RPC message pointer on the stack.
2255000	2257440	So when a server you turn to RPC core engine,
2257440	2261120	it will be operated on the fake object. Uh,
2261120	2266660	so we can see from the engine call NDR get buffer RCX already being the share
2266660	2271480	memory address. And this is a layout of the share memory. Uh,
2271480	2275200	there's also some type check, uh, because we can't fully control it.
2275200	2276940	So it's not a problem. Uh,
2276940	2280940	I choose to construct that fake RPC binding handle, uh,
2280940	2285940	in the share memory, uh, real problem cam, uh,
2286280	2289560	where you can see finally you arrive to the virtual function calling.
2289560	2292380	It's a XFG check. Um,
2293460	2297680	the first, uh, uh, of a table and, um, uh,
2297680	2301580	I want to actually low, uh, uh, directly call to the load library,
2301580	2306240	but you can see, uh, the V table and the, uh, first parameter is overlapped.
2306240	2311240	So we can directly onto, we can not directly call the load library. Uh,
2311240	2315700	so, uh, we can always find a way. Uh,
2315700	2317780	if I can directly call a load library,
2317780	2322220	I can find a legal callable function to, to register pivoting.
2322220	2324880	So we know there's a technique, uh,
2324880	2329500	called a stack pivoting in CTF exportation techniques where you can directly
2329500	2333940	RP on the current stack. So for the register pivoting,
2333940	2337680	I just need to find a function which can exchange the content of the register
2337680	2340760	RCX. And, uh, uh,
2340760	2344300	then the register were appointed to the DRL pass. And luckily I found this kind
2344300	2347740	of, uh, uh, function. It can't reach your cage. It's changed.
2347740	2351640	The register is inside the combats DRL. Okay.
2351640	2356840	Directly called bypass the XFG check is a callback function.
2356840	2362720	And this is a layout. Uh, RCX is before we call into the callback,
2362720	2367320	it's pointing to bind handle object and the value in a purple color is the type
2367320	2370610	of information and the callback function. Uh,
2370610	2375430	we can call low libraries with log in function to with the DRL pass in the
2375430	2378530	second parameter. So luckily before the control for all check,
2378530	2380510	the validity of the callback function,
2380510	2384850	the function is not the first member of the Vtable is at the 0x70.
2384850	2389570	So the start location of the Vtable we can use to put out with DRL pass. Uh,
2389570	2393910	so without worrying about the function validity because we were never used.
2394670	2399750	So then we can load our custom DRL without any resistance. Yeah.
2400060	2402660	And I will show you the demo.
2407430	2409980	I use a, uh, a normal user.
2410960	2412920	It's a user group
2415770	2419060	and I write it in all the POC in that person
2421430	2425900	and you can see is a normal user with a medium privilege.
2425900	2428160	It's not in our administrator group.
2430570	2431130	Okay.
2431130	2438050	And then we check the DECOM service to see if we can load our malicious DRL.
2441130	2441790	Okay.
2441790	2446910	We can see the shared memory and the COM base and we see we already know that
2446910	2453850	our evil DRL and there's a shell coming and we type who am I and we get a
2453850	2462720	system privilege. It's all the privilege.
2462720	2464000	Thank you. Thank you. Thank you.
2471410	2479970	Oh, thank you. And, uh, a conclusion.
2479970	2484150	So the voices. So to be continue, um,
2485710	2490330	I think there's still some research I need to do in the future.
2491230	2497150	I like the automation info extract from the RPC interface.
2497150	2498630	I need to find this, um,
2498990	2503510	exportation service and the argument which made the exportation bar. Uh,
2503510	2507430	if you have any good ideas and you can please share it to me,
2507430	2512810	I also want to know some good ideas for the two develop developing.
2512970	2515090	And there's a much special, more, uh,
2515090	2520290	special features in RPC and the need to be X mind and the more effective
2521190	2524670	exportation techniques. If you're on the other, any good ideas,
2524670	2527390	feel free to contact me. Yeah.
2529190	2529750	Yeah.
2529750	2532870	And the right Bob, uh, this is our bunk hunting experience.
2532870	2537190	I want to share with you and the first don't trust any patches from the render.
2537190	2540750	It may still not patch the vulnerability effectively.
2540750	2545310	And also the patch analyze is still more effect in back hunting.
2545590	2550150	You should be more creative and the criticizing when criticizing,
2550150	2555990	when back hunting. Yeah. You should dare to do it and we should be patient.
2556370	2560990	But bunk hunting is a long way medicine. And our last, uh,
2560990	2565790	don't meet any, meet any, miss any other, any side effect.
2565790	2569890	This effect may cause security flaw afterwards.
2571350	2576090	Yeah. And, uh, this, uh, for this type of service, uh,
2576090	2580650	we mentioned in the talk, there's still much special feature is the RPC RPC.
2580950	2585930	Uh, we need to XMI and the security of RPC is actually effect.
2585930	2588950	The security of the RPC, uh, for Microsoft, uh,
2588950	2593990	we can see it's really done a great tireless works on the security of the RPC
2593990	2598430	services. Although we cause the double fish in the RPC services, uh,
2598430	2601950	we need to still find the, uh, export both service in the,
2601950	2606490	and the parameters still meet us very strict bars.
2607630	2612590	And this is a reference of our talk. And, uh, thank you.
2612590	2613950	Uh, is there another questions? Uh,
2613950	2617810	because there is a microphone has any problems and sorry for that. Yeah.
2630580	2631660	Oh, thank you.
