[00:00.250 --> 00:04.490] Hello everyone. Thank you for coming to our talk, [00:04.490 --> 00:08.930] Shimmy What You Got? Manipulating Shim and Office for Code Injection. [00:08.930 --> 00:12.570] We are very excited to be here. Let's introduce ourselves. [00:13.570 --> 00:17.810] My name is Ron Ben-Yitzhak. I'm a security researcher at Deep Instinct. [00:17.810 --> 00:21.590] And this is the third year in a row I'm speaking here at DEF CON. [00:25.500 --> 00:30.360] And my name is David Shandalov. I'm also a security researcher at Deep Instinct. [00:30.360 --> 00:31.920] And this is my first time here. [00:37.980 --> 00:41.120] This is what we're going to talk about today. [00:41.120 --> 00:45.440] I'll start with an intro about the app compatibility framework, [00:45.440 --> 00:48.580] what it is made of, and known techniques to abuse it. [00:48.580 --> 00:53.640] Then I'll dive into our attack surface research on Microsoft Office. [00:53.640 --> 00:56.340] I'll show how we found an interesting RPC method [00:56.340 --> 00:59.980] and combined several manipulations into a single attack [00:59.980 --> 01:04.140] that achieves both code injection and privilege escalation. [01:04.520 --> 01:07.560] Then we'll show another novel attack. [01:07.560 --> 01:10.440] We'll show the reverse engineering process of the driver [01:10.440 --> 01:15.080] and the undocumented structures that make the app compatibility mechanism. [01:15.080 --> 01:19.960] And how we discovered the finest technique to apply a malicious shim on a process. [01:19.960 --> 01:25.100] At the conclusion of the talk, we'll discuss how to detect the attacks shown here [01:25.100 --> 01:28.280] and how the community can continue our research. [01:29.640 --> 01:34.260] The app compatibility framework is used for backwards compatibility. [01:34.260 --> 01:36.900] Software developed for old versions of Windows [01:36.900 --> 01:40.300] might behave unexpectedly on newer versions. [01:40.300 --> 01:42.700] Microsoft offers many compatibility modes [01:42.700 --> 01:46.100] that might look familiar from this window. [01:46.220 --> 01:51.420] Programs might access registry paths or directories that no longer exist, [01:51.420 --> 01:54.980] such as the C-documented settings, for those who remember. [01:55.520 --> 01:58.460] Those issues are fixed with API hooking, [01:58.460 --> 02:00.400] patching the assembly of the program itself, [02:00.400 --> 02:02.680] and other runtime modifications. [02:03.540 --> 02:06.900] Behind the scenes, this is how the mechanism works. [02:06.900 --> 02:10.780] The OS uses shim database files, or SDB files, [02:10.780 --> 02:14.360] that contain the fixes and modes various applications require. [02:14.360 --> 02:17.040] The main file is sysmain.sdb. [02:17.040 --> 02:22.120] It is maintained by Microsoft and can only be modified by system updates. [02:22.180 --> 02:26.200] We can view those files using a graphic software provided by Microsoft, [02:26.200 --> 02:28.320] the compatibility administrator. [02:28.320 --> 02:32.020] Here we can see that Edge of Empires 3 [02:32.020 --> 02:35.400] requires the compatibility mode High DPI Aware. [02:35.440 --> 02:38.140] Users can also install custom SDB files [02:38.140 --> 02:40.900] by writing them to these registry paths. [02:42.120 --> 02:44.460] Like every component of the OS, [02:44.460 --> 02:46.660] people looked for ways to abuse it. [02:46.660 --> 02:48.480] There were several talks over the years [02:48.480 --> 02:51.680] about the malicious implications to the shim framework. [02:51.680 --> 02:54.600] Here you can see a DEF CON talk from almost 10 years ago [02:54.600 --> 02:57.960] that shows shims can be used for credential access, [02:57.960 --> 03:00.240] network redirection, and more. [03:00.340 --> 03:06.300] Also, Alex UNESCO released several articles about this subject back in 2007. [03:06.500 --> 03:09.160] Because this is such an old attack vector, [03:09.160 --> 03:12.400] most security products should detect malicious shim usage. [03:12.400 --> 03:16.000] And the easiest way to do it is by monitoring the registry paths [03:16.000 --> 03:18.960] used for installing custom SDB files. [03:19.820 --> 03:25.340] So, once upon a time, David and I wanted to start a new research. [03:25.340 --> 03:27.820] Initially, we thought about bypassing an EDR, [03:27.820 --> 03:29.820] or even disabling it. [03:29.820 --> 03:33.340] But apparently, some products just disable themselves. [03:34.160 --> 03:36.120] So, instead of EDR bypass, [03:36.120 --> 03:38.740] we decided to start an attack surface research. [03:38.740 --> 03:40.360] And we needed a target. [03:40.380 --> 03:43.700] One of the first choices we came up with is Office. [03:43.780 --> 03:45.960] This software is very popular. [03:45.960 --> 03:48.720] It can be found on almost every Windows machine. [03:48.720 --> 03:50.600] It is also very complex. [03:50.600 --> 03:53.160] It has COM objects, tripped-in engines, [03:53.160 --> 03:55.140] cloud synchronization, and more. [03:55.140 --> 03:56.900] The more components there are, [03:56.900 --> 03:59.280] the higher the chances to find an issue. [03:59.460 --> 04:01.340] And the most promising feature about Office [04:01.340 --> 04:03.640] is the backwards compatibility. [04:03.900 --> 04:06.540] It was released over 30 years ago. [04:06.540 --> 04:09.420] And legacy code is usually the problematic one, [04:09.420 --> 04:11.260] which is good for us. [04:11.820 --> 04:14.520] Now, let's talk about the research itself. [04:15.480 --> 04:19.460] We wanted to find RPC servers related to Office. [04:19.460 --> 04:22.960] And that led us to the service ClickToRunSVC. [04:23.220 --> 04:27.180] Here you can see the RPC interfaces it exposes. [04:27.180 --> 04:30.320] And narrowing down this list to files related to Office [04:30.320 --> 04:32.060] results in three files. [04:32.060 --> 04:35.080] The actual executable of the service, [04:35.080 --> 04:37.320] OfficeClickToRun.exe. [04:37.320 --> 04:39.480] And let's skip the long prefix [04:39.480 --> 04:42.280] and just call them virtualization.dll [04:42.280 --> 04:45.380] and subsystemcontroller.dll. [04:46.960 --> 04:49.200] We started looking into these files [04:49.200 --> 04:51.600] to see what functionality they provide. [04:51.600 --> 04:55.200] And we found an interesting string in the virtualization.dll. [04:55.360 --> 04:58.660] Could not inject subsystem.dll to child process. [04:59.240 --> 05:02.300] And lucky us, this string is used by a function [05:02.300 --> 05:04.720] that is exposed through RPC. [05:04.720 --> 05:07.320] This means that you can easily invoke it. [05:07.340 --> 05:09.920] Still, before we start reverse engineering [05:09.920 --> 05:13.120] the RPC interface and its methods, [05:13.120 --> 05:16.920] we wanted to make sure it actually performs DLL injection. [05:17.020 --> 05:20.120] So we debugged it, put breakpoints on the API [05:20.120 --> 05:23.580] used for code injection, and then we launched Word. [05:23.600 --> 05:26.920] That caused the service to call write process memory. [05:27.100 --> 05:30.840] This diagram shows the call stack that led to this API. [05:30.940 --> 05:33.940] The RPC call went through several undocumented functions [05:33.940 --> 05:37.640] in a few DLL files until it reached write process memory. [05:39.120 --> 05:41.360] So what is this DLL? [05:41.360 --> 05:44.570] The file description is Microsoft Application Virtualization [05:44.940 --> 05:47.570] Client Virtualization Manager Component. [05:48.040 --> 05:51.040] And yes, it says virtualization twice. [05:51.260 --> 05:55.360] This file exposes two undocumented RPC methods. [05:55.360 --> 05:57.740] Instead of diving headfirst into the code, [05:57.740 --> 06:01.740] we wanted to find symbols that can shed some light on these functions. [06:01.960 --> 06:04.620] We used PowerShell to find RPC clients, [06:04.620 --> 06:07.500] and that led us to a file that has symbols. [06:08.100 --> 06:10.080] subsystem64.dll. [06:10.080 --> 06:12.420] Again, I'm going to skip the long names. [06:12.420 --> 06:15.340] The functions in the client are called notifyNewProcess [06:15.340 --> 06:17.340] and notifyNewChildProcess. [06:17.340 --> 06:20.380] We didn't find anything interesting about the first one. [06:20.380 --> 06:24.460] The second function causes the server to call write process memory. [06:26.500 --> 06:30.600] Now we want to understand the flow that leads to the DLL injection. [06:30.600 --> 06:32.900] So we'll start by debugging the client. [06:33.100 --> 06:35.820] We notice that before Word performs the call, [06:35.820 --> 06:40.380] it spawns ai.exe as a child process in a suspended state. [06:40.560 --> 06:42.740] Then we reach the call itself. [06:42.740 --> 06:45.840] We reverse-engineered it and came with its definition. [06:46.020 --> 06:48.340] This syntax is for the IDL file. [06:48.340 --> 06:52.260] It sends two parameters, the process ID of ai.exe [06:52.260 --> 06:55.620] and the string subsystem64.dll, [06:55.620 --> 06:58.020] the name of the DLL that made the call. [06:58.900 --> 07:01.840] Time to switch sides to the RPC server. [07:01.840 --> 07:05.420] Like I said before, those DLL files are undocumented [07:05.420 --> 07:08.820] and we want to save time on reverse-engineering them. [07:08.820 --> 07:10.840] We searched for all the files that are related [07:10.840 --> 07:12.700] to the app virtualization platform [07:12.700 --> 07:15.400] and found out that there are files with similar names [07:15.400 --> 07:17.720] in the system32 directory. [07:17.760 --> 07:19.180] Those files have symbols [07:19.660 --> 07:22.880] and they show that the detours library is being used. [07:22.880 --> 07:25.960] This is an official library by Microsoft used for hooking [07:25.960 --> 07:29.740] and it can also inject code into another process. [07:29.740 --> 07:32.720] The functions detourUpdateProcess.dll [07:32.720 --> 07:34.860] and detourCopyPayloadToProcess [07:34.860 --> 07:38.340] are used to patch the import address table of the target process [07:38.340 --> 07:40.380] and force it to load a DLL. [07:40.620 --> 07:42.340] Comparing the two files with bindif [07:42.340 --> 07:44.600] further proves the similarities. [07:44.780 --> 07:47.460] The name primary column belongs to the office file [07:47.460 --> 07:51.640] and the name secondary column belongs to the system32 file. [07:51.640 --> 07:54.140] Those functions are a perfect match. [07:55.200 --> 07:58.020] We can easily understand how the injection is done [07:58.020 --> 07:59.980] with the source code of detours. [08:00.000 --> 08:02.040] The optional header is modified to point [08:02.040 --> 08:03.740] to a new copy of the import table [08:03.740 --> 08:06.340] that includes an additional import descriptor [08:06.340 --> 08:07.780] to the injected DLL. [08:07.860 --> 08:10.740] This is how WinDebug displays the headers. [08:10.740 --> 08:14.320] We can see the full path to the DLL, which is unusual. [08:14.420 --> 08:16.520] Compilers link the base name. [08:17.680 --> 08:20.700] This is everything done by the RPC server. [08:20.700 --> 08:22.260] Now let's go back to the client [08:22.260 --> 08:24.460] and finish going through this process. [08:24.800 --> 08:26.380] Word resumes ai.txt [08:26.380 --> 08:29.540] and since the process is not yet initialized, [08:29.540 --> 08:31.760] the loader uses the new import table. [08:31.760 --> 08:35.880] Because of that, subsystem64 is loaded into the process. [08:36.300 --> 08:39.940] We looked at what happens if we imitate the RPC call [08:39.940 --> 08:43.180] but specify a 32-bit process as the target. [08:43.180 --> 08:45.100] In this case, office click-to-run [08:45.100 --> 08:48.180] isn't writing to the memory of this process directly. [08:48.200 --> 08:50.600] It launches the tool mavinject32, [08:50.600 --> 08:53.260] which is known as a living off-the-land binary, [08:53.260 --> 08:55.160] but the injection is exactly the same. [08:56.900 --> 08:59.300] Now we want to understand exactly... [08:59.300 --> 09:02.260] now that we know exactly how the DLL is injected, [09:02.260 --> 09:03.700] what can we gain from it? [09:03.900 --> 09:07.660] Security products detect all kinds of malicious behavior. [09:07.720 --> 09:11.520] File encryption, shellcode execution, and code injection. [09:11.600 --> 09:14.420] But sometimes legitimate programs do that. [09:14.420 --> 09:15.980] We just saw an example. [09:16.100 --> 09:19.660] And to avoid generating false positive events for customers, [09:19.660 --> 09:22.700] such programs will be excluded by the products. [09:22.880 --> 09:25.200] This means that if we force office click-to-run [09:25.200 --> 09:28.620] to inject a DLL, we'll be able to bypass detection. [09:29.120 --> 09:31.900] We know the definition of the RPC method, [09:31.900 --> 09:35.620] and we can imitate it to inject subsystem64.dll. [09:35.620 --> 09:39.880] But the big question is, can we inject another DLL? [09:40.040 --> 09:43.240] As I showed before, the function receives a string, [09:43.240 --> 09:46.120] so we can just change the name of the file. [09:46.140 --> 09:48.100] But that means we'll have to write our DLL [09:48.100 --> 09:51.100] to the office directory, which is very suspicious. [09:51.220 --> 09:53.580] And it also requires admin privileges. [09:54.860 --> 09:59.220] We tried providing a full path to the file instead of the base name, [09:59.220 --> 10:01.020] and this is what happened. [10:01.080 --> 10:04.340] We changed the string to ctemp-injected.dll, [10:04.340 --> 10:07.900] and it was appended as it is to the office directory. [10:07.940 --> 10:11.100] This should raise a flag for every security researcher. [10:11.100 --> 10:14.480] It means that there are no sanity checks on the inputs. [10:14.480 --> 10:19.060] So we can go back to the 90s and use directory traversal. [10:19.060 --> 10:22.820] We can manipulate the file lookup to a completely different place. [10:22.820 --> 10:26.420] Let's display the headers of the process again with win-debug, [10:26.420 --> 10:28.960] this time after we manipulated the call. [10:28.960 --> 10:32.300] We can see our malicious string was appended to the office directory [10:32.300 --> 10:34.920] and written to the memory of the process. [10:35.900 --> 10:39.600] With this trick, we can inject any DLL we want. [10:39.660 --> 10:41.760] But there are still a few limitations. [10:42.040 --> 10:44.360] The modified import address table will be used [10:44.360 --> 10:46.660] only if the process was launched as suspended [10:46.660 --> 10:49.460] and wasn't resumed until the injection was done. [10:49.460 --> 10:51.460] It must be uninitialized. [10:51.460 --> 10:55.000] Right now, we have a new technique to force a legitimate program [10:55.000 --> 10:56.900] to inject a DLL for us. [10:56.900 --> 10:59.520] But what more can we achieve from this? [10:59.700 --> 11:04.820] A nice thing about RPC is that the client can have lower privileges than the server. [11:05.000 --> 11:08.080] The office service runs this anti-authority system. [11:08.240 --> 11:11.120] So, can we perform privilege escalation? [11:18.850 --> 11:21.230] Well, the short answer is no. [11:21.510 --> 11:25.870] The server calls RPC impersonate client before the injection is done. [11:25.870 --> 11:29.710] This means that the thread that handles our request will use our token [11:30.470 --> 11:33.310] and not the token of anti-authority system. [11:34.010 --> 11:36.810] This is done to verify that the client has enough permissions [11:36.810 --> 11:38.930] to access the remote process. [11:39.050 --> 11:43.310] After the impersonation, the request reaches a subsystem controller.dll [11:43.650 --> 11:47.230] which calls open process to gain a handle to the remote process. [11:47.230 --> 11:50.530] If we can't get this handle, so will the RPC server [11:50.530 --> 11:52.310] and the call will fail. [11:52.310 --> 11:55.970] But still, maybe we can escalate from admin to system. [11:56.810 --> 12:00.910] The first step to do that will be to launch a process [12:00.910 --> 12:04.110] with the privileges of system in a suspended state. [12:04.110 --> 12:06.810] We used API monitoring to find such calls [12:06.810 --> 12:10.930] and we found that the task scheduler service does exactly that. [12:11.170 --> 12:14.910] Scheduled tasks are a great target because there are many default ones [12:14.910 --> 12:16.530] that are configured to run a system [12:17.270 --> 12:20.070] and even some that are related to office. [12:20.990 --> 12:24.510] Such as this one, office automatic updates 2.0. [12:24.510 --> 12:26.610] Our injection will be even less suspicious [12:26.610 --> 12:31.470] if the service will inject a DLL to another process that is related to office. [12:31.470 --> 12:33.930] But we still have a few challenges ahead. [12:34.010 --> 12:38.270] The task scheduler service resumes the process shortly after it is launched. [12:38.270 --> 12:42.470] We need to find a way to hold the execution of the task scheduler service. [12:42.470 --> 12:45.810] And we can do that with an opportunistic lock. [12:47.950 --> 12:50.830] Opportunistic locks, or oplocks for short, [12:50.830 --> 12:54.130] are a special kind of locks that are used to keep data coherency [12:54.130 --> 12:56.850] across computers accessing a file server. [12:56.910 --> 12:58.790] A client can lock a file. [12:58.790 --> 13:02.910] And when another client tries to access the same file, it will wait. [13:03.070 --> 13:06.690] The server will break the lock and notify the first client. [13:06.770 --> 13:09.910] The new data will be flushed, the file will be closed, [13:09.910 --> 13:13.650] and only then the second client will be able to access it. [13:13.650 --> 13:16.650] The nice thing about oplocks is that they can be requested [13:16.650 --> 13:19.530] from the local file system by a process. [13:19.710 --> 13:23.710] This usage is effectively a semaphore managed by the local file system [13:23.710 --> 13:25.950] that synchronizes multiple processes. [13:27.190 --> 13:29.750] So, how does it relate to our attack? [13:29.910 --> 13:33.910] If we could find a file that is accessed by the task scheduler service [13:33.910 --> 13:37.490] after the process is created, but before it is resumed, [13:37.490 --> 13:41.730] we could lock it, and it will stop the service from resuming the process. [13:41.730 --> 13:45.910] Keeping the process suspended will allow us to inject a DLL to it. [13:45.910 --> 13:52.690] We monitor the system for file access while launching the scheduled tasks, [13:52.690 --> 13:55.730] and we saw that sysmain.sdb was accessed. [13:55.730 --> 13:58.190] In this image, we can see the call stack. [13:58.190 --> 14:02.830] Inside createProcessInternal, functions related to the app compatibility were called, [14:02.830 --> 14:05.310] and then the shim database was opened. [14:06.570 --> 14:11.350] At this point, we know that the task scheduler sometimes reads sysmain.sdb, [14:11.350 --> 14:14.810] but we need to understand which tasks lead to that. [14:14.810 --> 14:19.570] We need to find a task that executes a file with app compatibility settings. [14:19.570 --> 14:25.270] To do that, we locked the sdb file, launched every task registered on the machine, [14:25.270 --> 14:28.850] and checked when we were notified about the lock breaking. [14:28.950 --> 14:33.210] This led us to a task that executes Microsoft Edge updates. [14:33.210 --> 14:37.570] This file has app compatibility settings because of the following entry. [14:37.570 --> 14:43.050] The generic installer fix will be applied on every process that has the word update in it. [14:43.170 --> 14:46.510] So, this is good, but still, it's not good enough. [14:46.510 --> 14:51.930] This file is under Program Files x86, which means it is a 32-bit process. [14:51.930 --> 14:54.870] We want to find a target for 64-bit as well. [14:55.970 --> 15:02.530] We continue digging into this subject to understand under which circumstances the sdb file will be read, [15:02.530 --> 15:06.370] and we noticed a strange behavior that applies to the OS as a whole, [15:06.370 --> 15:08.530] not just the task scheduler service. [15:08.990 --> 15:13.590] The sdb file was read the first time an executable ran since the machine started, [15:13.590 --> 15:15.690] even if it didn't need a fix. [15:15.690 --> 15:18.850] And after that, in all other runs, it wasn't. [15:19.730 --> 15:25.090] If we could guarantee that the sdb file will be read any time an executable runs, [15:25.090 --> 15:28.030] we could choose any scheduled task as our targets. [15:28.350 --> 15:34.370] And, of course, we could register a custom sdb file that applies some fix to every process, [15:34.370 --> 15:36.030] but that is too noisy. [15:36.030 --> 15:39.650] We want to avoid actions that are monitored by security products. [15:39.930 --> 15:43.570] We need to find a way to manage the app compatibility mechanism. [15:43.830 --> 15:48.450] We looked for files related to this mechanism and found apphelp.dll. [15:48.510 --> 15:52.650] By looking at the code of this DLL, we understood that it wraps various operations [15:52.650 --> 15:56.710] with the API AntiAppHelpCacheControl. [15:56.730 --> 15:58.950] Let's try to understand how to use it. [16:00.070 --> 16:04.210] This is an undocumented API that is exported by NTDLL. [16:04.570 --> 16:08.950] We searched for references to this API online and in several DLL files [16:08.950 --> 16:14.130] until we found that the symbols of combase.dll contain information about it. [16:14.130 --> 16:19.330] This is a screenshot of a function from combase without any reverse engineering. [16:19.390 --> 16:21.850] We can see that the first parameter is an integer [16:21.850 --> 16:24.710] that represents the type of operation to be performed, [16:24.710 --> 16:26.730] and the second parameter is a structure [16:26.730 --> 16:30.690] with various members that are filled based on the operation chosen. [16:32.490 --> 16:36.470] We extracted those definitions and that revealed to us [16:36.470 --> 16:38.990] everything that can be done with this API. [16:39.050 --> 16:42.670] We applied the definitions on calls from other DLL files [16:42.670 --> 16:44.970] and that helped us understand them better. [16:45.050 --> 16:47.310] Let's look at createProcess, for example. [16:47.550 --> 16:50.150] Now we know that it performs the lookup operation [16:50.150 --> 16:52.970] and what information it requires. [16:53.150 --> 16:56.490] Like I said before, we encountered a strange behavior. [16:56.490 --> 16:59.850] The sdb file was read the first time in an executable run [16:59.850 --> 17:03.070] since the machine started, even if it didn't need a fix. [17:03.070 --> 17:04.770] And then, it wasn't. [17:04.770 --> 17:06.750] At this point, we had enough information [17:06.750 --> 17:10.130] to come up with an assumption on why it happens. [17:11.370 --> 17:14.790] In this scenario, cmd is going to launch calc. [17:14.790 --> 17:18.530] So we have these two processes and also the upheld cache, [17:18.530 --> 17:20.330] which is empty at this point. [17:20.410 --> 17:22.630] We know that when we call createProcess, [17:22.630 --> 17:25.090] the lookup operation is done on the cache. [17:25.090 --> 17:28.550] So cmd is going to look for an entry about calc. [17:28.550 --> 17:32.430] The cache is empty, so the response is no entry found. [17:32.430 --> 17:35.150] That causes cmd to read the sdb file [17:35.150 --> 17:39.410] to check if it contained information about fixes calc requires. [17:39.410 --> 17:41.750] It doesn't require any fix. [17:41.770 --> 17:43.990] So the next step is that the cache is updated [17:43.990 --> 17:46.010] and an entry is added. [17:46.090 --> 17:48.110] Calc, no fix needed. [17:48.450 --> 17:52.070] Then, let's say cmd launches calc again, [17:52.070 --> 17:55.170] so it queries that cache one more time. [17:55.430 --> 17:58.990] This time, the response is no fix needed. [17:58.990 --> 18:02.910] And that is why cmd doesn't read sysmin.sdb again. [18:03.070 --> 18:04.750] Based on this assumption, [18:04.750 --> 18:07.090] if we could remove this entry from the cache, [18:07.090 --> 18:09.450] the sdb file will be read again. [18:10.850 --> 18:13.830] We looked at various calls to anti-app-help-cache-controller [18:13.830 --> 18:17.150] and found out that both kernel32 and app-help [18:17.150 --> 18:19.410] perform the remove operation. [18:19.410 --> 18:22.650] In this pseudocode, we can see the information required. [18:22.650 --> 18:25.390] It requires the path and the handle to the file. [18:25.790 --> 18:29.290] Kernel32 exports a function that does most of the work for us, [18:29.290 --> 18:32.910] and it saves us the effort of recreating this call in our code. [18:33.390 --> 18:35.790] After this call, the execution of the file [18:35.790 --> 18:39.070] will once again trigger reading the sdb file. [18:40.330 --> 18:43.450] Okay, so we talked about a lot of stuff. [18:43.450 --> 18:46.770] RPC methods, locks, and undocumented API. [18:46.770 --> 18:50.010] So in case you lost track, let's put everything together. [18:50.110 --> 18:51.770] This is the flow of the attack. [18:51.870 --> 18:54.890] We'll start by writing the DLL that will be injected. [18:55.170 --> 18:57.050] Then we'll pick a scheduled task. [18:57.050 --> 18:59.890] Let's say, Office Automatic Updates 2.0. [18:59.950 --> 19:02.330] We need to take care of the shim cache. [19:02.330 --> 19:05.250] The file that will be executed might have an entry, [19:05.250 --> 19:07.350] so we're going to remove it. [19:07.910 --> 19:10.490] Then we'll lock sysmin.sdb. [19:12.010 --> 19:14.810] The next step will be to start the task, [19:14.810 --> 19:16.790] and that will launch a suspended process [19:16.790 --> 19:18.750] with the privileges of system. [19:19.070 --> 19:22.450] The task scheduler will try to read the sdb file [19:22.450 --> 19:24.110] and start waiting. [19:24.330 --> 19:27.570] That will send us a notification about the lock breaking, [19:27.570 --> 19:29.990] which means it's time to send the RPC request [19:29.990 --> 19:31.710] to the office service. [19:32.250 --> 19:34.370] This service will patch the import table [19:34.370 --> 19:38.050] of the suspended process and link it to our DLL. [19:38.210 --> 19:40.950] The last step will be to release the lock, [19:40.950 --> 19:43.850] and that will cause the task scheduler to resume the process [19:43.850 --> 19:46.050] and our DLL will be loaded. [19:47.810 --> 19:49.710] Ready to see if it works? [19:54.870 --> 19:57.570] First, we'll copy our tool to the machine. [19:57.990 --> 19:59.690] And let's even scan it. [20:01.030 --> 20:03.750] And of course, Defender won't detect it. [20:04.410 --> 20:06.210] Now, just to make it clear, [20:06.210 --> 20:09.810] we are running the latest version of Office 365, [20:11.850 --> 20:14.870] and also the latest Windows 11 build. [20:16.170 --> 20:18.330] Now that we made it clear, [20:18.330 --> 20:21.810] let's start monitoring the system and launch our tool. [20:23.920 --> 20:28.480] We can see that Office C to our client loaded our DLL, [20:28.480 --> 20:31.620] and that we gained the console with the privileges of... [20:31.620 --> 20:33.640] anti-authority system. [20:39.630 --> 20:41.110] Time to summarize. [20:41.170 --> 20:43.570] We decided to make an attack surface research [20:43.570 --> 20:45.070] on Microsoft Office. [20:45.070 --> 20:47.690] We manipulated several components of the OS [20:47.690 --> 20:50.050] into a single functioning attack. [20:50.050 --> 20:53.030] And these are the advantages of it. [20:53.150 --> 20:56.190] Security products will most likely ignore code injection [20:56.190 --> 20:57.870] done by Office click-to-run, [20:57.870 --> 20:59.930] because this is its purpose. [20:59.970 --> 21:01.990] So we'll bypass detection. [21:01.990 --> 21:05.930] It will be difficult to link this attack back to us, [21:05.930 --> 21:09.170] because not only the injection is done by another process, [21:09.170 --> 21:12.230] but the target process is spawned under the task scheduler, [21:12.230 --> 21:13.830] not under us. [21:14.130 --> 21:17.550] We escalate our privileges from admin to system, [21:17.550 --> 21:20.990] and the rest of the actions we perform aren't suspicious. [21:21.190 --> 21:23.730] It is very unlikely that someone monitors calls [21:23.730 --> 21:25.910] to anti-app-help-cache-control, [21:25.910 --> 21:28.190] or monitors using Oprox. [21:28.830 --> 21:31.370] So this is the end of my part of the talk. [21:31.370 --> 21:33.590] Now please welcome David Chandalov. [21:40.620 --> 21:42.100] Thank you, Ron. [21:42.220 --> 21:45.400] As we concluded our first attack surface research, [21:45.400 --> 21:47.740] we identified a significant knowledge gap [21:47.740 --> 21:50.840] regarding anti-app-help-cache-control. [21:50.840 --> 21:54.460] Despite extensive information available online, [21:54.460 --> 21:57.560] we found that crucial details about some data structures [21:57.560 --> 22:00.080] and flows remain unclear. [22:00.500 --> 22:03.700] Additionally, with the continuous updates and changes [22:03.700 --> 22:06.620] in Windows versions over the years, [22:06.620 --> 22:10.800] many publicly shared insights have been altered by Microsoft. [22:10.840 --> 22:13.980] Today, I'll provide a comprehensive overview [22:13.980 --> 22:16.960] of the mechanism and the modernized attack. [22:16.960 --> 22:18.940] So, let's dive right in. [22:19.780 --> 22:22.860] As we embarked on our research journey, [22:22.860 --> 22:25.380] we were driven by a fundamental question. [22:25.460 --> 22:29.320] What can we achieve with the anti-app-help-cache-control API? [22:29.460 --> 22:32.020] This inquiry became our guiding light, [22:32.020 --> 22:36.040] sparking our curiosity and determination to delve deeper. [22:36.240 --> 22:38.940] Our initial exploration gave us a foothold, [22:38.940 --> 22:40.840] but we knew we needed more. [22:40.840 --> 22:44.260] We needed to understand the technical intricacies. [22:44.580 --> 22:47.740] After all, this API controls shim fixes. [22:47.740 --> 22:49.720] Maybe we can bend it to our will [22:49.720 --> 22:54.020] and control which shim fixes are applied to specific processes. [22:55.400 --> 22:58.040] Our second question was more technical. [22:58.340 --> 23:00.340] As you can see from the screenshots, [23:00.340 --> 23:03.240] during the reading of sysmain.sdb, [23:03.240 --> 23:05.920] we noticed that anti-app-help-cache-control [23:05.920 --> 23:07.980] interacts with the kernel. [23:08.180 --> 23:12.200] This API calls a driver named ahcache.sys, [23:12.200 --> 23:15.880] which contains some intriguingly named functions. [23:15.880 --> 23:18.640] Functions like api-lookup and write-to-process [23:18.640 --> 23:21.140] and cache-lookup stood out, [23:21.140 --> 23:24.180] suggesting deeper mechanisms at play. [23:24.240 --> 23:27.260] These findings hinted at something significant [23:27.260 --> 23:29.320] inside of ahcache.sys, [23:29.320 --> 23:32.260] something that required us to dig deeper. [23:32.640 --> 23:35.300] So, down the rabbit hole we go. [23:36.480 --> 23:39.200] All right, let's lay the foundation. [23:39.200 --> 23:42.080] To understand how ahcache.sys operates, [23:42.080 --> 23:46.480] we need to start with the basics of its initialization process. [23:46.480 --> 23:50.140] When the system boots up, ahcache.sys is loaded, [23:50.140 --> 23:53.980] and it requires some initial setup to function properly. [23:54.080 --> 23:57.260] This is where the registry comes into play. [23:57.820 --> 24:00.360] The registry provides essential values [24:00.360 --> 24:03.920] that ahcache.sys reads and stores data to. [24:04.140 --> 24:06.440] These values act as a safe location [24:06.440 --> 24:08.640] for the driver's operations. [24:09.660 --> 24:12.160] This path contains binary data [24:12.160 --> 24:15.500] that the driver sorts into an AVL table. [24:15.620 --> 24:18.040] The cache needs to be properly initialized [24:18.040 --> 24:19.280] through the Windows API [24:19.280 --> 24:23.060] before these components can start working. [24:24.140 --> 24:28.040] The opposite process happens a shutdown and restart. [24:28.120 --> 24:30.680] The AVL table is dumped into the registry, [24:30.680 --> 24:33.200] into the app.compat.cache value. [24:34.820 --> 24:36.840] Let's take a moment to understand [24:36.840 --> 24:41.400] the link between sysmain.sdb, registry entries, [24:41.400 --> 24:43.620] and the app.compatibility cache. [24:43.760 --> 24:46.140] Each entry in the registry's values data [24:46.140 --> 24:49.540] is representing either a file that needs a shim fix [24:49.540 --> 24:51.580] or a file that doesn't. [24:51.640 --> 24:54.920] We'll revisit the decision-making process for applying fixes, [24:54.920 --> 24:57.400] but for now, let's focus on entries [24:57.400 --> 24:59.780] indicating files that need a fix. [24:59.920 --> 25:03.240] These entries contain several fields, [25:03.240 --> 25:05.960] the most significant being the exit tag, [25:05.960 --> 25:08.170] which points to a specific shim fix. [25:08.620 --> 25:11.180] By examining the data within these entries, [25:11.180 --> 25:13.880] we can observe notable differences. [25:14.140 --> 25:17.440] Specifically, free bytes vary across entries, [25:17.440 --> 25:20.860] and in the last entry, the free bytes are zeroized. [25:21.040 --> 25:24.020] Is it a sign for a file not needing a fix? [25:24.380 --> 25:27.200] Considering the data's little-endian format, [25:27.200 --> 25:31.260] converting it could reveal connections to sysmain.sdb. [25:33.120 --> 25:36.400] With sdbexplorer, we can search for these converted values [25:36.400 --> 25:39.480] in a readable version of sysmain.sdb. [25:39.640 --> 25:42.480] Zooming in on the fields that appear in the sdb, [25:42.480 --> 25:44.700] we have the name of the file field, [25:44.700 --> 25:47.020] and we can see the matching file field. [25:47.260 --> 25:50.360] The matching file field contains just an asterisk, [25:50.360 --> 25:54.040] so the whole name field will be compared as it appears. [25:54.520 --> 25:57.540] And lastly, we find the shim reference field. [25:57.540 --> 26:00.440] Each shim reference has a name and an ID. [26:00.440 --> 26:04.100] Some have a command line for additional arguments. [26:04.300 --> 26:07.440] Each field has an hexadecimal number attached. [26:07.440 --> 26:08.420] Why? [26:09.720 --> 26:14.440] It represents the address in the sdb that contains the exit tag [26:14.440 --> 26:18.260] as it prefixes the shimfix information block. [26:19.500 --> 26:22.500] Now that we understand what an exit tag is [26:22.500 --> 26:26.260] and how the registry cache and sysmain.sdb are linked, [26:26.260 --> 26:29.980] we wanted to look under the hood of Ahcache.sys. [26:30.000 --> 26:34.660] We started looking at the dispatch routines for device Ahcache, [26:34.660 --> 26:37.320] and we found that, among other things, [26:37.320 --> 26:39.140] anti-app-help-cache-control can [26:39.920 --> 26:42.880] update the table with hc-api-update [26:42.880 --> 26:46.440] that utilizes insert-element-api, [26:46.440 --> 26:50.020] lookup a table entry with hc-api-lookup-cdb [26:50.020 --> 26:52.540] that uses lookup-element-api, [26:53.620 --> 26:57.980] or it can remove an entry from the table with hc-api-remove [26:57.980 --> 27:00.380] using delete-element-api. [27:00.780 --> 27:04.760] We decided to continue looking through the dispatch routines. [27:06.160 --> 27:08.640] As we already have shown, [27:08.640 --> 27:12.860] anti-app-help-cache-control uses the Ahc service class enum, [27:12.860 --> 27:16.040] but it is also being used in the dispatch routine [27:16.040 --> 27:18.520] inside of Ahcache.sys. [27:18.520 --> 27:22.460] The enum has an interestingly sounding member, [27:22.460 --> 27:24.240] in its process data for short. [27:24.240 --> 27:27.280] We traced a function that is using this value. [27:27.940 --> 27:32.380] We were surprised to see no mentions of AVL table manipulation. [27:33.620 --> 27:36.040] Maybe this is what we were looking for? [27:36.040 --> 27:38.200] Writing to a process through a kernel driver? [27:38.200 --> 27:39.520] Sounds awesome! [27:40.460 --> 27:43.180] But before we check if we got the good news, [27:43.180 --> 27:45.160] let's go through some definitions. [27:45.160 --> 27:48.340] Almost every dispatch routine has a unique structure [27:48.340 --> 27:49.860] for its operation. [27:51.080 --> 27:54.840] This structure contains an undocumented data field. [27:54.840 --> 27:57.340] We tried to search the web for definitions, [27:57.340 --> 28:00.360] and with some more in-house reverse engineering, [28:01.720 --> 28:03.520] we got shim-data. [28:03.520 --> 28:07.760] It contains a fixed magic value and a fixed size value. [28:07.760 --> 28:10.940] Remember this struct, as we will come to visit it later. [28:12.320 --> 28:15.260] Diving deeper inside the function, [28:15.260 --> 28:19.080] the calling process and the target process are being checked. [28:20.000 --> 28:21.820] Now here is the tricky part. [28:21.820 --> 28:25.640] We need to have a protected signer app and PPL. [28:26.260 --> 28:29.280] And these two values will be important later. [28:30.180 --> 28:34.120] But the call fails in PSGetProcessProtection. [28:34.120 --> 28:37.700] Looking at every process in Windows 11, [28:37.700 --> 28:39.880] we concluded that no Windows apps [28:39.880 --> 28:42.780] with this kind of protection exist. [28:43.180 --> 28:45.140] We came to a dead end. [28:45.520 --> 28:48.880] But the undocumented structure I talked about before, [28:48.880 --> 28:50.720] it piqued our interest. [28:51.980 --> 28:54.660] We decided to take that strange name we found [28:54.660 --> 28:58.000] and try to look for references of this structure. [28:58.540 --> 29:01.440] Maybe we can understand by which operation it is being used [29:01.440 --> 29:03.480] and who can be the target. [29:04.840 --> 29:06.760] There were a few hits. [29:06.760 --> 29:10.200] Reverse engineering the functions that reference shim data [29:10.200 --> 29:12.880] revealed that this structure represents [29:13.320 --> 29:16.640] the shim fixes that need to be applied to a process. [29:17.960 --> 29:20.780] Let's see how a new process is born. [29:21.860 --> 29:24.180] Notepad.exe is the child process [29:24.180 --> 29:26.940] that is created on behalf of the parent process [29:26.940 --> 29:28.720] cmd.exe. [29:28.740 --> 29:31.420] The parent queries the app help cache to check [29:31.420 --> 29:34.620] if the child process requires shim fixes, [29:34.620 --> 29:37.160] as we have shown in the first attack. [29:37.920 --> 29:40.560] The parent process reads this main.sdb [29:40.560 --> 29:44.000] to retrieve the complete information about the fixes. [29:45.400 --> 29:48.180] The parent builds the structure according to [29:48.180 --> 29:51.980] the specific fixes and writes it to the memory [29:51.980 --> 29:53.660] of the child process. [29:55.740 --> 29:57.580] The parent modifies the value [29:57.580 --> 30:00.380] of the process environment blocks pshim data [30:00.380 --> 30:03.020] to point to the new structure. [30:05.220 --> 30:08.920] NTDLL is already loaded in the child process. [30:10.020 --> 30:11.620] So NTDLL's loader [30:11.620 --> 30:13.180] loads apphelp.dll [30:13.180 --> 30:16.920] if pshim data is not empty. [30:17.920 --> 30:19.740] Apphelp identifies which [30:19.740 --> 30:22.060] shim fixes are to be applied. [30:23.000 --> 30:26.060] And so apphelp.dll applies the shim fixes [30:26.060 --> 30:28.000] according to the structure. [30:29.520 --> 30:32.040] We also wanted to share the flow [30:32.040 --> 30:34.140] of the shim data structure creation [30:34.140 --> 30:36.560] for future references. [30:36.940 --> 30:39.340] The flow starts with create process internal [30:39.340 --> 30:42.700] in kernel base, goes through kernel 32 [30:42.700 --> 30:47.060] and finally ends with apphelp.dll. [30:47.120 --> 30:49.580] The finished struct is built in the [30:49.580 --> 30:52.340] sdb pack up compa data function [30:52.340 --> 30:56.280] inside of apphelp.dll. [30:56.740 --> 30:58.460] Okay. [30:58.460 --> 31:00.880] Let's consider the implications [31:00.880 --> 31:03.260] of manipulating a system component [31:03.260 --> 31:06.960] to build and trigger unauthorized fixes. [31:06.960 --> 31:09.500] This could potentially allow us to inject [31:09.500 --> 31:12.180] or alter code in a way that bypasses [31:12.180 --> 31:14.560] typical security measures. [31:15.460 --> 31:17.960] Our investigation into pshim data [31:17.960 --> 31:20.820] begins with understanding what data [31:20.820 --> 31:23.000] is being written to this specific part [31:23.000 --> 31:25.860] of the process environment block. [31:27.120 --> 31:30.280] We utilized the compatibility administrator [31:30.280 --> 31:33.380] to create and apply custom rules. [31:36.200 --> 31:38.440] By extracting the shim data [31:38.440 --> 31:40.440] directly from process memory, [31:40.440 --> 31:41.800] we gained a first insight [31:41.800 --> 31:44.320] into how the data is organized. [31:45.440 --> 31:47.340] We chose to fuzz the inputs [31:47.340 --> 31:49.680] to see the effect on the data. [31:49.680 --> 31:52.240] This process helped us identify patterns [31:52.240 --> 31:54.680] in the data handling. [31:55.080 --> 31:56.540] By following these steps, [31:56.540 --> 31:58.400] we gained a comprehensive understanding [31:58.400 --> 32:01.060] of how shim data looks like. [32:02.220 --> 32:05.840] And so, at last, we have reversed engineered [32:05.840 --> 32:07.700] the shim data structure, [32:07.700 --> 32:09.040] essential for understanding [32:09.040 --> 32:12.180] how to manipulate shims to our advantage. [32:12.960 --> 32:15.060] Here we can see the previous version [32:15.060 --> 32:17.820] of the shim data, if you can recall. [32:17.820 --> 32:20.380] This is the struct I ask you to remember. [32:20.400 --> 32:22.260] There are quite a few changes, [32:22.260 --> 32:25.180] most notably the exit tab type field, [32:25.180 --> 32:28.160] the exit tag field, and the exit count field. [32:28.160 --> 32:30.480] All are essential for correct use [32:30.480 --> 32:32.640] of shim fix manipulation. [32:34.400 --> 32:37.100] At this stage, we are preparing to use [32:37.100 --> 32:39.780] all of our accumulated knowledge for an attack. [32:39.840 --> 32:42.300] We can make a target process load a shim fix [32:42.300 --> 32:45.020] simply by building our own shim data struct [32:45.020 --> 32:48.240] and pointing to the target pshim data to it. [32:48.260 --> 32:50.520] The process won't check any condition [32:50.520 --> 32:52.720] the original rule has configured. [32:52.820 --> 32:56.100] This allows us to apply any fix we want. [32:56.280 --> 32:57.920] We chose to inject a DLL [33:00.400 --> 33:04.260] into the target process by itself. [33:12.530 --> 33:15.470] This effectively makes the attack [33:15.830 --> 33:18.290] a file-less and register-less DLL injection [33:18.290 --> 33:20.630] that can evade detection. [33:21.910 --> 33:23.590] According to this entry, [33:23.590 --> 33:26.190] rtvideo.dll will be injected [33:26.190 --> 33:29.530] if the process name starts with glj, [33:29.530 --> 33:31.530] ends with the temp extension, [33:31.530 --> 33:33.730] and it has the correct checksum. [33:33.730 --> 33:35.890] Luckily, these checks are done [33:35.890 --> 33:39.180] by the parent process and not by the child process. [33:39.550 --> 33:41.730] This means that once the exit tag [33:41.730 --> 33:44.110] in shim data points to this entry, [33:44.110 --> 33:47.390] the child process's app.ldll will apply the fix [33:47.390 --> 33:49.910] without checking the conditions. [33:50.990 --> 33:52.790] Having said all that, [33:52.790 --> 33:54.850] our attack has three limitations. [33:55.070 --> 33:59.090] The target process must be started as a suspended process. [33:59.830 --> 34:02.770] If the injected process executable file [34:02.770 --> 34:05.210] resides in this specific path, [34:05.210 --> 34:08.190] or the security identifier of the file's owner [34:08.470 --> 34:10.290] is a trusted installer, [34:10.290 --> 34:12.690] the shim fix won't be loaded. [34:13.870 --> 34:17.210] Injected DLL is not available to 64-bit processes [34:17.550 --> 34:20.230] as acgeneral.dll revealed. [34:20.610 --> 34:23.790] And you won't believe it, we found the target. [34:23.790 --> 34:27.250] And it's the Microsoft Edge updater we have shown before. [34:28.090 --> 34:30.290] Microsoft has made our lives easier [34:30.290 --> 34:32.990] as all three limitations are not present. [34:32.990 --> 34:34.410] Let's inject. [34:35.310 --> 34:38.210] At this point, we have enough knowledge [34:38.210 --> 34:40.690] to abuse the app compatibility mechanism. [34:40.690 --> 34:43.370] So let's go over all of the steps. [34:43.910 --> 34:46.070] We need to write our own DLL [34:46.070 --> 34:48.750] as the name of the rule specifies. [34:49.970 --> 34:53.550] We launch our binary as a suspended process. [34:54.410 --> 34:57.590] The struct is built with the correct tag [34:57.590 --> 34:59.190] as in our example. [35:00.650 --> 35:04.050] We write the struct to the target process's memory. [35:04.270 --> 35:07.310] We point to the struct. [35:07.930 --> 35:09.890] We resume the execution. [35:10.690 --> 35:12.430] And so app help will help us [35:12.430 --> 35:14.790] and apply our desired fix. [35:14.790 --> 35:17.670] An RT video will load to the target process. [35:17.870 --> 35:20.170] Let's see how it looks in action. [35:23.970 --> 35:27.270] shim injector.exe is dropped. [35:28.730 --> 35:31.470] And so we can see the hello message [35:31.470 --> 35:34.130] from inside of the child process. [35:34.510 --> 35:37.470] RT video.dll is loaded by our target. [35:37.630 --> 35:40.590] We can see our call stack going from install after init [35:40.590 --> 35:42.970] to ns inject dll. [35:42.970 --> 35:45.430] And lastly, to load library. [35:45.570 --> 35:48.310] We also have some logs on the command prompt. [35:48.310 --> 35:51.650] You can see the unique size, magic, exit type [35:51.650 --> 35:54.330] and exit tag we defined earlier. [36:01.420 --> 36:03.720] Let's recap our second attack. [36:03.720 --> 36:05.780] There is a long history of shim attacks [36:05.780 --> 36:09.460] and how security products typically detect and mitigate [36:09.460 --> 36:12.640] malicious shim attacks, attack vectors. [36:13.360 --> 36:16.220] We were able to uncover new definitions [36:16.220 --> 36:19.260] and insights on the app compatibility component. [36:19.260 --> 36:22.020] And we used them to change what we think about [36:22.020 --> 36:23.800] this attack vector. [36:24.760 --> 36:27.500] This new perspective allowed us to create a new [36:27.500 --> 36:30.200] file-less and registry-less attack. [36:30.940 --> 36:33.280] We essentially took care of the problem [36:33.280 --> 36:35.640] of creating a custom SDB on a system [36:35.640 --> 36:39.320] with all that comes with it, namely registry [36:39.320 --> 36:41.060] and disk tracks. [36:42.680 --> 36:46.000] By writing to a child process which is not suspicious [36:46.000 --> 36:49.040] and by loading the target dll from the suspended [36:49.040 --> 36:53.640] child process before any EDR hook can be established, [36:53.640 --> 36:56.660] we effectively bypassed EDR detection. [36:58.680 --> 37:01.700] We chose this specific shim fix because [37:01.700 --> 37:05.240] it is applicable to many scenarios and demonstrates [37:05.240 --> 37:07.220] our attack in a clear way. [37:07.480 --> 37:10.380] There are many more shim fixes that can be used [37:10.380 --> 37:13.780] for malicious purposes. This was only one of them. [37:14.940 --> 37:16.480] We've come a long way. [37:16.480 --> 37:19.020] Let's summarize both attacks and see what we can [37:19.020 --> 37:21.120] take away from this research. [37:22.520 --> 37:25.640] As for detections, let's go over how should [37:25.640 --> 37:28.120] someone detect these kinds of attacks. [37:28.560 --> 37:32.440] For the first attack, RPC is a big and early [37:32.440 --> 37:35.080] part of the first attack. So monitoring [37:35.080 --> 37:38.580] remote procedure calls made to click-to-run [37:38.580 --> 37:41.300] service can reveal the use of non-standard [37:41.300 --> 37:44.800] dll paths. Requests for opportunistic [37:44.800 --> 37:47.800] locks on critical system files like [37:47.800 --> 37:50.760] sysmain.sdb should be flagged. [37:52.120 --> 37:54.480] Implementing security policies that [37:54.480 --> 37:57.700] restrict such high-level memory write operations [37:57.700 --> 38:00.780] as it is very suspicious. Click-to-run [38:00.780 --> 38:03.660] service shouldn't write to this type of processes [38:03.660 --> 38:05.180] on its own. [38:06.580 --> 38:09.880] Regarding the second attack, keeping [38:09.880 --> 38:12.560] an eye on file system activity, particularly [38:12.560 --> 38:15.940] for the creation of dll files which are listed [38:15.940 --> 38:18.500] in sysmain.sdb and [38:18.500 --> 38:21.300] are in directories unrelated to the original [38:21.300 --> 38:24.100] files, to the original rules. [38:25.760 --> 38:27.860] Also, we invite the community [38:27.860 --> 38:30.380] to take our findings to refine our attacks [38:30.380 --> 38:33.300] and make new and better ones. [38:33.680 --> 38:36.660] Some ideas. The community could find [38:36.660 --> 38:38.720] the target for the init process data [38:39.300 --> 38:42.360] operation that we didn't find. [38:43.020 --> 38:45.160] There is much more to understand [38:45.160 --> 38:48.360] about the shim data structure and how it can [38:48.360 --> 38:52.120] affect the execution of the AHCache.sys functions. [38:53.260 --> 38:54.580] There are many more [38:54.580 --> 38:57.480] flows that can potentially manipulate the AVL table [38:57.480 --> 39:00.300] which in turn will affect which process [39:00.300 --> 39:02.300] will get what shim fix. [39:05.360 --> 39:08.520] In conclusion, [39:08.520 --> 39:11.820] in our presentation, we detailed our comprehensive [39:11.820 --> 39:15.280] methodology for conducting attack surface research. [39:16.500 --> 39:18.040] By leveraging and [39:18.040 --> 39:20.840] manipulating various system components, including [39:20.840 --> 39:23.780] services, op locks and compatibility [39:23.780 --> 39:26.820] mechanisms, we demonstrated how to consolidate [39:26.820 --> 39:30.000] these elements into a singular cohesive attack [39:30.000 --> 39:31.420] strategy. [39:32.100 --> 39:35.840] The op lock and the compatibility mechanisms could [39:35.840 --> 39:39.140] be integral parts of other multi-component [39:39.140 --> 39:42.400] sophisticated and complex attacks. [39:42.480 --> 39:44.800] Op lock can be used in many scenarios [39:44.800 --> 39:47.420] as a building block and there are many more [39:47.420 --> 39:50.420] shim fixes that can be used with malicious intent, [39:50.420 --> 39:53.800] even with 64-bit processes. [39:55.020 --> 39:57.620] Our extensive research uncovered new [39:57.620 --> 40:00.020] techniques for stealthy injection and [40:00.020 --> 40:02.900] privilege escalation, enhancing the [40:02.900 --> 40:05.260] effectiveness of these attacks. [40:06.600 --> 40:09.640] We demonstrated two attacks that won't [40:09.640 --> 40:11.780] be monitored by EDRs. [40:11.780 --> 40:14.820] The injection occurs in a very early stage, [40:15.080 --> 40:18.140] a stage where EDRs can't establish a [40:18.140 --> 40:21.360] hook yet. [40:21.360 --> 40:23.700] Through reverse engineering an undocumented [40:23.700 --> 40:27.140] API and its associated structures, we gained [40:27.140 --> 40:29.640] valuable insights that contributed to the [40:29.640 --> 40:33.160] development of these methods. [40:33.320 --> 40:35.600] Additionally, we modernized a previously [40:35.600 --> 40:38.440] known malicious technique, transforming it into [40:38.560 --> 40:41.880] a more elusive fileless and registryless attack. [40:42.680 --> 40:45.080] Lastly, we once again encourage the [40:45.080 --> 40:47.140] community to continue building on our [40:47.140 --> 40:49.320] research, exploring the leads we have [40:49.320 --> 40:52.180] provided to further advance this field. [40:53.820 --> 40:57.020] Thank you. Thank you so much for being [40:57.020 --> 40:59.840] here and hearing our talk. The source [40:59.840 --> 41:02.340] code of our tools is now public. If you [41:02.340 --> 41:04.220] have any questions, you are free to ask. [41:04.220 --> 41:06.640] You can also find us on Twitter and LinkedIn. [41:06.680 --> 41:07.680] Thanks again.