1 00:00:00,000 --> 00:00:02,620 Welcome Vegas! 2 00:00:03,260 --> 00:00:04,840 Woohoo! 3 00:00:04,920 --> 00:00:07,600 Let's go guys! 4 00:00:08,160 --> 00:00:10,780 Ladies and gentlemen, LVO. 5 00:00:13,020 --> 00:00:15,680 Thank you guys to be here. 6 00:00:15,680 --> 00:00:21,220 It is amazing experience to be here for my first time. 7 00:00:21,220 --> 00:00:26,640 And let's talk about EDR, XDR, bypassing. 8 00:00:26,640 --> 00:00:29,960 First of all, our agenda. 9 00:00:29,960 --> 00:00:32,540 Uh, a little bit who I am. 10 00:00:32,540 --> 00:00:39,660 Uh, a little bit what is hookchain and what is not hookchain is. 11 00:00:39,660 --> 00:00:44,320 And these research limitations. 12 00:00:44,320 --> 00:00:52,720 And after that, let's talk about the basics to understand how does hookchain works. 13 00:00:52,720 --> 00:00:56,620 And after, look through rootchains. 14 00:00:56,620 --> 00:00:58,460 And who I am. 15 00:00:58,460 --> 00:01:02,040 My name is Elvio Junior Aka Mabarik. 16 00:01:02,140 --> 00:01:07,620 Uh, my undergraduation school, uh, I did a airplane pilot. 17 00:01:07,620 --> 00:01:09,880 So yes, I am a pilot. 18 00:01:09,920 --> 00:01:16,660 And I was the first in America Latina to learn OSCE3. 19 00:01:16,760 --> 00:01:22,440 Uh, and I studied , or maybe studied too, OSCE. 20 00:01:22,440 --> 00:01:26,620 This research, uh, that I have here. 21 00:01:26,620 --> 00:01:26,620 Uh, I studied OSCE3. 22 00:01:26,620 --> 00:01:29,440 Uh, I have no much time to study OSCE. 23 00:01:29,440 --> 00:01:36,940 And what I like, I like low level exploitation, buffer overflow, shell coding, malware, and so on. 24 00:01:36,940 --> 00:01:50,520 And also, I am CEO of SecForUs, a company, a Brazilian company that, uh, provide training and research and consulting and so on. 25 00:01:51,540 --> 00:01:56,500 What is the motivation of this talk and this research? 26 00:01:56,500 --> 00:02:08,620 Many people believes that I, I have solution X, that I talk of the Gartner, and I am a hundred percent protected. 27 00:02:08,620 --> 00:02:12,440 No, there is no silver bullet. 28 00:02:12,760 --> 00:02:22,020 And when I doing, uh, pentesting or red team exercise, I just need to bypass the red team exercise. 29 00:02:22,040 --> 00:02:24,140 Your environment. 30 00:02:24,140 --> 00:02:29,520 I don't need to bypass everything, just your environment. 31 00:02:29,520 --> 00:02:33,040 So, and full undetectable. 32 00:02:33,040 --> 00:02:35,020 Sometimes it happens. 33 00:02:35,020 --> 00:02:36,560 And what is hookchain? 34 00:02:36,560 --> 00:02:38,820 Hookchain is a technique. 35 00:02:38,820 --> 00:02:40,780 It is not a tool . 36 00:02:40,780 --> 00:02:43,780 I'm not pretending to launch a tool. 37 00:02:43,780 --> 00:02:48,340 Yeah, obviously, I need to do some programming. 38 00:02:48,340 --> 00:02:54,800 I need to, to create a code to prove the concept, but it is a technique. 39 00:02:54,800 --> 00:02:55,660 Okay? 40 00:02:55,660 --> 00:03:00,240 And what is the focus of hookchain? 41 00:03:00,240 --> 00:03:11,240 Do hook, do bypassing of monitoring of EDRs and XDRs inside of NET DLL. 42 00:03:11,240 --> 00:03:15,880 In other words, a hundred percent user land. 43 00:03:15,880 --> 00:03:18,160 Nothing about kernel land. 44 00:03:18,160 --> 00:03:18,440 Okay? 45 00:03:18,440 --> 00:03:19,020 So, what is hookchain ? 46 00:03:19,020 --> 00:03:21,400 And limitation. 47 00:03:21,400 --> 00:03:31,840 As I said, it is, uh, 64 bits programming and limited just to NT DLL. 48 00:03:31,840 --> 00:03:34,420 User land hooks. 49 00:03:34,420 --> 00:03:46,640 And I'm not pretending here to classify the EDR vendors, XDR vendors as his effectivity. 50 00:03:46,640 --> 00:03:49,520 I'm just launching a new technique. 51 00:03:49,520 --> 00:03:49,900 Okay? 52 00:03:49,900 --> 00:03:59,180 I need to do some tests, but I'm focused just in one point, not entire ecosystem. 53 00:03:59,180 --> 00:04:02,740 So, I'm not pretending to classify EDRs. 54 00:04:02,740 --> 00:04:06,780 It must be clear for, for all guys. 55 00:04:07,100 --> 00:04:24,400 During this study, I, I did, uh, public call for vendors to work together with me to get early access to this code, to this technique, and no one answered. 56 00:04:24,460 --> 00:04:41,940 When I published it, some bypass in LinkedIn, I received some calls, not too happy calls sometimes, but I received just three years, three weeks ago, some calls in order to test this. 57 00:04:41,940 --> 00:04:42,420 Okay? 58 00:04:42,420 --> 00:04:46,920 And let's go to the technical things. 59 00:04:46,920 --> 00:04:58,940 First of all, we have almost two layers in order to protect and split the time during inside of our operational test. 60 00:04:58,940 --> 00:05:04,620 Ring zero, kernel land, and ring three, user land. 61 00:05:04,680 --> 00:05:15,600 To transition between user land to kernel land, in a few words, we have just one way to do this. 62 00:05:15,600 --> 00:05:28,600 Using a gate calling system call, or system dispatcher and so on, that I can transit from user mode to the kernel mode. 63 00:05:28,600 --> 00:05:36,400 In general, we have this picture where we have user process, system services, and so on. 64 00:05:36,400 --> 00:05:49,000 Doesn't matter what is the, his level is, it is a system level, a certain level, or a simple non-privileged user process. 65 00:05:49,000 --> 00:05:52,220 Every time I need to do this transition. 66 00:05:52,220 --> 00:06:00,580 In general, this, this is a responsibility to NTDLL to do this for me. 67 00:06:01,200 --> 00:06:15,940 So, this is a common stack call where I have one common application for, that must be, that need to be, for example, need to execute first a virtual lock to locate a, a memory. 68 00:06:15,940 --> 00:06:50,720 And the common stack call, the application will call this from kernel 32 DLL and the kernel 32 will call another uh, API inside of NTDLL and the NTDLL will prepare stack call parameters, register parameters, and will execute uh, assembly instruction called sys call that will transit from user mode to the kernel mode. 69 00:06:51,900 --> 00:06:55,820 This is just another image to explain that. 70 00:06:55,820 --> 00:07:03,000 So, I have the user mode application and the important here, system service number. 71 00:07:03,000 --> 00:07:28,040 There's a table called system service descriptor table where I have uh, indexes from zero to, I have no idea how much, more than 400, uh, numbers that match each ID from a pointer to a kernel function. 72 00:07:28,040 --> 00:07:39,020 So, when I need to uh, to transit from the user mode to kernel mode, I put the system service number inside of register RAL. 73 00:07:39,700 --> 00:07:41,380 Sorry about the noise. 74 00:07:41,380 --> 00:07:49,820 But uh, I put this number in this register and I execute the system call instruction. 75 00:07:49,820 --> 00:08:04,240 And system call will come to the kernel uh, address space and this function will match inside of this table and get the pointer to the real kernel function. 76 00:08:04,240 --> 00:08:14,360 And the real kernel function will be executed and return to the user mode space with the return of the executed function. 77 00:08:14,360 --> 00:08:16,940 Doesn't matter uh, what this means. 78 00:08:16,940 --> 00:08:22,240 This is another uh, uh, image to illustrate that. 79 00:08:22,240 --> 00:08:33,300 System service call, system service dispatcher, the table with the indexes and uh, the pointers to the function and the real code from, through the function. 80 00:08:33,300 --> 00:08:34,160 Okay? 81 00:08:34,160 --> 00:08:54,840 And when I execute some proxies uh, un-executed or uh, when I load uh, DLL inside of another proxies, when I initiate uh, a proxies, several actions are, have been done behind the scenes. 82 00:08:54,840 --> 00:09:01,940 One of the most important that uh, uh, to this talk is related to import address table. 83 00:09:01,940 --> 00:09:09,320 Import address table in a few words is a table that have uh, the name of the function that I want to execute. 84 00:09:09,320 --> 00:09:32,520 For example, uh, create proxies and the name of the function and the uh, ID representing, ID representing inside of this table and the function that when I run this, when I run the, the application, the operational system, the, the loading of the operational system will look through uh, 85 00:09:32,520 --> 00:09:41,940 all loaded DLLs and fill this table with the address, the real address of this function in the operational system. 86 00:09:41,940 --> 00:09:45,120 Virtual address, of course, but the virtual address. 87 00:09:45,120 --> 00:09:59,880 So when I try to execute these proxies, my application will comes uh, to the import address table and request, import address table, what is the real virtual address to this function? 88 00:09:59,880 --> 00:10:13,740 And put this, for example, in a history and after that call the address of this hazards, history in order to call the uh, real uh, function code. 89 00:10:13,740 --> 00:10:29,640 And another things that image loader do is uh, look through the, the loaded DLLs if this DLLs uh, uh, was already loaded, the recursive loading and so on and fill this, this function pointer. 90 00:10:29,640 --> 00:10:48,460 There is another image to, to illustrate this, this same thing that I have the name of DLLs and the functions that I imported in my application by default and the, the, the name and the code of the application inside the, the uh, the target DLL. 91 00:10:49,320 --> 00:10:53,580 Let's start talking about the techniques. 92 00:10:53,720 --> 00:11:13,320 Uh, when I, when I saw this, this kind of hooking, uh, we need to say, we must say that the techniques that we use to attack, it's the same techniques that the EDR vendors are using to protect. 93 00:11:13,320 --> 00:11:23,140 The first time that uh, someone published uh, uh, something related with this techniques in, in Windows 95. 94 00:11:23,140 --> 00:11:27,580 So uh, a few, few years ago. 95 00:11:27,580 --> 00:11:31,400 Uh, and what is hook? 96 00:11:31,400 --> 00:11:34,960 Like a interception of the stack call. 97 00:11:34,960 --> 00:11:43,240 When I try to execute some function, this function uh, I, I'm not executing the real function. 98 00:11:43,240 --> 00:11:49,700 I, I will be uh, intercepted and redirected to another function. 99 00:11:49,700 --> 00:11:51,420 Like a man in the middle. 100 00:11:51,440 --> 00:11:54,500 In this case it will be a function in the middle. 101 00:11:54,500 --> 00:11:56,680 But it's the same concept. 102 00:11:56,680 --> 00:11:57,540 Okay? 103 00:11:57,780 --> 00:12:03,980 The, the most common techniques to do that is using instruction jump or call. 104 00:12:04,100 --> 00:12:09,840 Or I can use uh, uh, uh, import address table hooking. 105 00:12:10,020 --> 00:12:11,680 How can I do that? 106 00:12:11,680 --> 00:12:12,760 Let's see. 107 00:12:13,780 --> 00:12:16,660 Uh, talking about jumping. 108 00:12:16,660 --> 00:12:20,200 This is a strategy that I, I'm uh, that we can see here. 109 00:12:20,200 --> 00:12:25,940 It's the most common strategy uh, used by EDR and XDR vendors. 110 00:12:25,940 --> 00:12:38,260 That is when I run a, an application uh, NTDLL is the first DLL uh, that is, is attached to my process. 111 00:12:38,260 --> 00:12:54,460 And after that the EDR DLL will be uh, attached and the DLL from EDR will patch or change in memory uh, the instructions of the NTDLL. 112 00:12:54,460 --> 00:13:06,560 So, when I try to execute for example this function, this function is uh, uh, changes to jump to address space of EDR uh, code. 113 00:13:06,560 --> 00:13:13,240 In order the, the, the EDR can uh, check our parameters and response and so on. 114 00:13:13,540 --> 00:13:26,140 This is uh, an example of original execution flow where when I get the address of the, the, the, the function, the target function, we will receive the real address. 115 00:13:26,140 --> 00:13:48,180 But if after the EDR changes or after our change in the target function, that, because we will change this table, uh, after that, instead of receive the address of the real function, the original function, we will receive an address to a hooked function or to a uh , 116 00:13:48,180 --> 00:13:50,640 function in the middle in this case. 117 00:13:50,640 --> 00:13:51,160 Okay? 118 00:13:51,160 --> 00:14:00,160 So we will receive a malicious function or uh , when I EDR doing that, the fu- the, the address of the EDR function. 119 00:14:00,160 --> 00:14:06,380 So, when I, when I call this address, we will call the, receive the function. 120 00:14:06,380 --> 00:14:19,700 In this case, uh, arbitrary code from EDR or from our perspective, and it is a decision if we will or not execute the real function. 121 00:14:19,700 --> 00:14:32,740 In uh, talking about EDR infrastructure, the EDR will uh, analyze the parameters and decide, yes, uh, LV is a good guy, I can allow this. 122 00:14:32,740 --> 00:14:36,680 Oh no, LV is a bad guy, let's drop this. 123 00:14:36,680 --> 00:14:43,740 And uh, uh, pop, pop up alert and uh, send this to, to SOC and so on. 124 00:14:44,720 --> 00:15:10,440 Uh, this is a, that I am talking, this is a, uh, when I EDR load, EDR puts an, another DLL and it will be redirected and decide, yes, no, execute or no, and do if, yeah, LV is a good guy, let's uh, permit this execution, so do system call in kernel land. 125 00:15:10,440 --> 00:15:17,940 It's everything as usual and after that, come back to the user land process. 126 00:15:18,060 --> 00:15:47,000 Okay, I can see here an unhooked API, okay, so I can see this typically uh, instructions where uh, there is a, a, a moving from R-C-X to R10 and after that there is a, an ID here in hexadecimal uh, where I put this ID in uh, E-A-X or R-A-X, doesn't matter. 127 00:15:47,000 --> 00:15:49,420 And after that there is a system call. 128 00:15:49,420 --> 00:15:59,740 This is a typical uh, uh, code from NTDLL's uh, uh, functions that will transmit from user land to kernel land. 129 00:15:59,740 --> 00:16:10,400 And here we can see a hooked API where he is unhooked and he is a hooked API. 130 00:16:10,400 --> 00:16:13,620 As you can see, there is no this typical code. 131 00:16:13,620 --> 00:16:25,520 There is a jump code where I'm doing a, a jumping or a interception to the API or to the EDR uh, code. 132 00:16:25,600 --> 00:16:43,060 Okay, said that the most common bypasses is remapping NTDLL but to do that we need to load the NTDLL from the disk or from the another uh, memory area. 133 00:16:43,080 --> 00:16:47,280 It seems to be malicious in most of case. 134 00:16:47,280 --> 00:16:50,640 Uh, another technique, it's direct syscall. 135 00:16:50,660 --> 00:17:04,600 When instead of goes through NTDLL, I get the system service number and do uh, and execute the system call inside of my, my process. 136 00:17:04,600 --> 00:17:14,780 This sounds malicious again because the system call was not coming back from NTDLL memory address space. 137 00:17:14,780 --> 00:17:18,780 It's coming from my application address space. 138 00:17:18,780 --> 00:17:22,060 Okay, and EDR catch this. 139 00:17:22,220 --> 00:17:42,320 I direct syscall, it's uh, similar to direct syscall but instead of uh, do uh, system call instruction inside of my application, I will jump it to address inside of NTDLL that exists just system call instruction. 140 00:17:42,320 --> 00:17:46,920 So, who will execute NTDLL? 141 00:17:46,920 --> 00:17:49,280 So, sounds less malicious. 142 00:17:49,280 --> 00:17:59,800 But in this case, the stack trace will be broken because I'm executing directly from my code inside of NTDLL. 143 00:17:59,800 --> 00:18:03,040 In general, the application doesn't do that. 144 00:18:03,040 --> 00:18:12,860 The application in general calls system 32 DLL, kernel base DLLs, GDI DLL and so on. 145 00:18:12,860 --> 00:18:16,980 And DLL will call NTDLL and, and et cetera. 146 00:18:16,980 --> 00:18:19,100 So, sounds malicious. 147 00:18:19,340 --> 00:18:28,200 Then, there are amazing guys uh, without this research, this talk today was not possible. 148 00:18:28,200 --> 00:18:36,840 So, this is amazing guys uh, created uh, uh, Heaven Gate technique, Hell's Gate technique and the Hell's Gate technique. 149 00:18:36,840 --> 00:18:51,980 So, uh, for this research, I used the part of Hell's Gate technique in order to uh, resolve dynamically uh, the system service numbers. 150 00:18:51,980 --> 00:18:52,560 Okay? 151 00:18:52,560 --> 00:18:58,500 So, let's understand a little bit better about Hell's Gate, this part of Hell's Gate. 152 00:18:58,500 --> 00:19:08,920 In general, in Hell's Gate, locate the current address of the uh, target function that, the function that I want to execute. 153 00:19:08,920 --> 00:19:29,380 For example, uh, create a virtual memory or um, create processor and look that uh, that code that we, we saw, the, the typically code and check if the typically code uh, match with these uh, uh, these instructions. 154 00:19:29,380 --> 00:19:33,780 If yes, okay, this function was not hooked. 155 00:19:33,780 --> 00:19:37,460 If no, the function is hooked. 156 00:19:37,460 --> 00:19:38,260 Okay? 157 00:19:38,260 --> 00:19:48,160 So, we can uh, see that and how can I uh, get the system service number? 158 00:19:48,160 --> 00:19:54,860 If, if the function is hooked, the real code uh, does not exist more there. 159 00:19:54,860 --> 00:19:56,580 How, how can I see this? 160 00:19:56,580 --> 00:20:00,500 Let's, let, let's see uh, uh, another screen here. 161 00:20:01,580 --> 00:20:06,460 We can see that the functions are linear. 162 00:20:06,460 --> 00:20:16,800 So, we can see here, for example, the system service number six, system service number seven, this function is hooked. 163 00:20:16,800 --> 00:20:23,020 So, in general, I have no idea what's the, the, the system service ID of this function. 164 00:20:23,020 --> 00:20:29,280 And the next function will be nine and we, the next function will be ten. 165 00:20:29,340 --> 00:20:39,560 In other words, we can see the neighborhood uh, functions before and after our uh, uh, uh, desired function in order to calculate. 166 00:20:39,560 --> 00:20:44,200 If this function is six, that function is seven. 167 00:20:44,200 --> 00:20:46,900 My function will be eight. 168 00:20:46,900 --> 00:20:50,860 So, we can dynamically check this. 169 00:20:50,860 --> 00:20:54,160 This is hollows gate technique, ok? 170 00:20:54,160 --> 00:21:10,940 And uh, before this, this research, this study, uh, in a sunny day, uh, playing with my two uh, boys, my two kids, I have an idea. 171 00:21:10,940 --> 00:21:11,940 Whoa! 172 00:21:11,940 --> 00:21:17,260 The major part of EDRs are hooking in an NTDLL. 173 00:21:17,260 --> 00:21:30,380 If the function is high, step above and try to catch or try to do a, a, a function in the middle, uh, changing the flow before NTDLL. 174 00:21:30,380 --> 00:21:38,560 Ok, because, because some uh, uh, several EDRs are checking if we are changing NTDLL. 175 00:21:38,560 --> 00:21:47,760 So, because they are changing there, the EDR are checking if we also change there and flag us as malicious. 176 00:21:47,760 --> 00:21:58,040 So, if EDR are checking there, and what if I did or I do this in a step above? 177 00:21:58,040 --> 00:22:08,080 So, to check the uh, viability of this technique, I, I create a code in order to check the EDRs hookings. 178 00:22:08,080 --> 00:22:15,820 So, nine percent of the EDRs are hooking just in NTDLL. 179 00:22:15,820 --> 00:22:20,820 So, the technique can be viable. 180 00:22:20,820 --> 00:22:28,260 Ok, and I created the new technique called hook chain. 181 00:22:28,260 --> 00:22:29,620 What is hook chain? 182 00:22:29,620 --> 00:22:35,620 Hook chain, the first step I will uh, resolve system service number. 183 00:22:35,620 --> 00:22:48,340 After that, create a table where I store the system service number and uh, another address of my custom stub function. 184 00:22:48,340 --> 00:22:55,280 In other words, the function that will be executed instead of original function. 185 00:22:55,280 --> 00:22:59,420 EDR do this, whoa, I can do this also. 186 00:22:59,420 --> 00:23:10,660 And implant or change the import address table from our proxies to our custom stub function. 187 00:23:10,660 --> 00:23:15,760 And after that, continue as usual. 188 00:23:15,760 --> 00:23:23,160 With this, I have in more details the hook chain implant flow. 189 00:23:23,160 --> 00:23:39,920 First one, uh, I resolve dynamically, map some critical functions because in this, in this phase, uh, I have no, uh, I had no bypass at EDR yet. 190 00:23:39,920 --> 00:23:53,180 So, I need to use some functions, not uh, monitor it by EDR in order to change some memory address and change some uh, memory areas and so on. 191 00:23:53,180 --> 00:23:54,940 Read and etc. 192 00:23:55,000 --> 00:24:03,280 Uh, so I map statically these main functions that I call it here critical functions. 193 00:24:03,300 --> 00:24:06,240 And after that, I create a table. 194 00:24:06,240 --> 00:24:09,480 We will see the structure of this table, uh, later on. 195 00:24:09,480 --> 00:24:15,840 Uh, we create a table that holds system service number that I already mapped. 196 00:24:15,840 --> 00:24:32,400 The function address, the real function address inside of NTDLL and uh, the, the closest uh, address that holds a system call instruction inside of NTDLL. 197 00:24:32,400 --> 00:24:37,180 And after that, I loaded, I preloaded some functions. 198 00:24:37,180 --> 00:24:46,600 For example, uh, if we will run uh, MetaExploit payload or Havoc payload, uh, payload and uh, I have no idea. 199 00:24:46,600 --> 00:24:53,700 Uh, there are another uh, DLLs that must be called before the execution of this payload. 200 00:24:53,700 --> 00:25:04,180 Because a simple uh, a simple executable for example, has no access to the uh, URL uh, APIs or uh, critical functions. 201 00:25:04,180 --> 00:25:12,100 So, we must preload this DLL in order to change the import address table of this DLL. 202 00:25:12,100 --> 00:25:18,140 So, here we preloaded these DLLs and after that do the magics. 203 00:25:18,380 --> 00:25:24,820 Change the import address table of all needed DLLs. 204 00:25:24,820 --> 00:25:33,800 In this time I, I, I need to say that that is not a good idea to change the import address table of all loaded DLLs. 205 00:25:33,800 --> 00:25:41,840 I tried that and I lose my hair trying that and that's not a good idea. 206 00:25:41,840 --> 00:25:43,460 Believe me, believe me. 207 00:25:43,460 --> 00:25:56,440 So, I, I, I created like a, a blacklist DLLs where I put inside of the application and uh, do this preloading and after that changing that. 208 00:25:57,100 --> 00:26:01,920 This is the typical flow after hookchain planting. 209 00:26:01,920 --> 00:26:04,420 The simplified version. 210 00:26:04,420 --> 00:26:15,160 So, my application must call virtual unlock for example to create uh, uh, malicious error in order to put there a meta exploit shellcode for example. 211 00:26:15,160 --> 00:26:17,180 And I need to create this. 212 00:26:17,180 --> 00:26:20,380 I will call kernel to 32 DLL. 213 00:26:20,380 --> 00:26:37,780 Instead of call direct NT DLL, this function as I hook it, as I did the uh, the, the function in the middle, I will, this, this flow will be redirected to my application stub code. 214 00:26:37,780 --> 00:26:55,580 This application stub code will, will check several things and create a stack frame, a stack call, create uh, uh, put the, the, the, the, uh, the information inside the registers and after that do an indirect syscall in order to execute. 215 00:26:55,580 --> 00:26:58,520 And kernel mode as usual. 216 00:26:59,620 --> 00:27:08,400 Here, this uh, I can present you the, the first struct that I, that I, uh, I will use. 217 00:27:08,520 --> 00:27:44,600 I will use here uh, a list, okay, with this system call information and each entry of this list uh, has a system service number, real address from the real function, okay, uh, the, the address of the function or the address that holds the system call instruction and the address of my stub function that will be redirected to. 218 00:27:44,600 --> 00:27:52,940 And uh, a hash use it to bypass uh, static analysis instead of the name of the functions and the, and so on, okay. 219 00:27:52,940 --> 00:28:15,020 And this is the entire flow where the same, my application want to execute some function will call kernel 32 DLL and that call kernel base DLL and after that I will check in a import address table. 220 00:28:15,020 --> 00:28:22,500 When I check in import address table instead of receive the original address I will receive my stub function. 221 00:28:22,500 --> 00:28:29,100 So, the application will be, will redirect to my stub function inside of this function. 222 00:28:29,400 --> 00:28:45,200 Uh, I can check the system call list, the list that I saw, and the list there are several items in order to check, get the parameters that were the real function, syscall uh, uh, address and so on. 223 00:28:45,460 --> 00:28:55,580 Create the stack call frame and put everything that we, we need in the registers and after that do indirect syscall. 224 00:28:55,660 --> 00:28:56,820 Okay? 225 00:28:57,240 --> 00:28:59,700 What are the advantages of that? 226 00:28:59,700 --> 00:29:02,360 How this works? 227 00:29:02,360 --> 00:29:03,440 Why? 228 00:29:03,440 --> 00:29:10,240 Uh, reduction of probability to identification for several reasons. 229 00:29:10,240 --> 00:29:13,240 The first one, total time of execution. 230 00:29:13,240 --> 00:29:28,580 As I have several times similar to the regular execution, the DDR cannot flag us because the total time of execution, the telemetry of total time of execution will be okay. 231 00:29:28,580 --> 00:29:32,640 Will be uh, seems to be uh, valid. 232 00:29:32,840 --> 00:29:36,320 And stack, stack framing. 233 00:29:36,600 --> 00:29:42,940 Talking about stack frame, I'm flowing, I'm uh, uh, uh, executing as usual. 234 00:29:42,940 --> 00:29:48,300 Came in for a kernel 32 for example, kernel base and so on. 235 00:29:48,300 --> 00:29:51,900 So, I, I'm not stepping steps. 236 00:29:51,900 --> 00:29:53,900 Yeah, I'm not skipping steps. 237 00:29:53,900 --> 00:29:54,380 Okay? 238 00:29:54,380 --> 00:30:11,880 And the most important, I did not or I uh, uh, I, I didn't need to change the code of the original application. 239 00:30:11,880 --> 00:30:23,920 For example, if I want to execute Mimikatz for example, I uh, uh, I don't need to touch the code. 240 00:30:23,920 --> 00:30:31,100 I just execute the hookchain in order to implant and execute Mimikatz. 241 00:30:31,100 --> 00:30:31,840 That's it. 242 00:30:31,840 --> 00:30:37,720 Because the hookchain implanted uh, uh, uh, everything that we need. 243 00:30:37,720 --> 00:30:40,280 The function in the middle. 244 00:30:41,140 --> 00:30:50,000 Let's see the first demo where we will execute and uh, command and control using Havoc. 245 00:30:50,000 --> 00:30:54,620 Okay, this is uh, flag as malicious as usual. 246 00:30:54,640 --> 00:30:59,540 And let's see this first one. 247 00:31:00,580 --> 00:31:11,480 Here we can see uh, Bit Defender updated with uh, advanced threat protection. 248 00:31:11,480 --> 00:31:26,160 Full enable and in the left side we can see our uh, console where uh, we will have, let me see, uh, let's stop here. 249 00:31:26,240 --> 00:31:34,820 Just uh, let me put here together in order to, okay. 250 00:31:35,120 --> 00:31:36,960 Okay, no problem. 251 00:31:37,580 --> 00:31:41,560 Uh, first time I will implant hookchain. 252 00:31:41,560 --> 00:31:53,880 After that, download remotely from HTTP the malicious payload and after that execute this malicious payload. 253 00:31:53,880 --> 00:31:57,840 So, we are using Havoc to do that. 254 00:31:58,840 --> 00:32:01,480 And uh, let's see and here we go. 255 00:32:01,700 --> 00:32:06,220 Executed our first, first command control. 256 00:32:06,340 --> 00:32:12,060 We can interact with that without any identification. 257 00:32:16,020 --> 00:32:17,560 Thank you guys. 258 00:32:17,560 --> 00:32:19,100 You are amazing. 259 00:32:19,900 --> 00:32:22,060 It's just a starting one. 260 00:32:22,060 --> 00:32:23,060 Let's go. 261 00:32:23,060 --> 00:32:26,840 Let's go back to the presentation. 262 00:32:26,840 --> 00:32:28,080 Whoa. 263 00:32:28,080 --> 00:32:30,140 Here it is. 264 00:32:32,750 --> 00:32:34,770 Looking in the browser, we can see details. 265 00:32:34,770 --> 00:32:42,290 We have the first step is mapping everything that we need. 266 00:32:42,290 --> 00:32:58,710 So, in this operational system we have four, four hundred seventy two NTDLL functions where we can map and these functions are hooked or I need this as a critical function. 267 00:32:58,710 --> 00:33:02,610 And after that, I create this table, okay. 268 00:33:02,610 --> 00:33:05,250 This is the, the, the showing of this table. 269 00:33:05,250 --> 00:33:09,770 And after that, I do the import address table hooking. 270 00:33:09,770 --> 00:33:19,650 So, I can see here the output of this, this hookings in kernel two thirty two, kernel base user thirty two and so on. 271 00:33:21,150 --> 00:33:25,170 Let's talk about the real environment. 272 00:33:25,170 --> 00:33:35,030 The first of all, thank you for all friends, all Brazilian community that there are most, most guys here. 273 00:33:35,030 --> 00:33:49,770 Uh, that share with me, uh, your environment license and help me and support me in order to make this research works. 274 00:33:49,770 --> 00:33:53,990 Uh, without you guys, nothing will be possible. 275 00:33:53,990 --> 00:33:55,130 Uh, thank you. 276 00:33:55,130 --> 00:33:56,830 Thank, thank you so much. 277 00:33:56,970 --> 00:34:11,070 Uh, because obviously some EDR vendors are not too happy and not sharing their license or their environment in order that I test. 278 00:34:11,070 --> 00:34:18,470 So, uh, there are a lot of friends, uh, sharing his environment with me in order to, to make this test, okay. 279 00:34:18,470 --> 00:34:24,570 So, we did this in a closed environment. 280 00:34:25,270 --> 00:34:37,530 As the focus, the focus of this research is talk about, uh, EDR protections, uh, and we will touch here else, else us. 281 00:34:37,530 --> 00:34:52,150 Uh, I disabled the run as prepare and coordination guard inside of the windows because the, the, the, the target the full focus, it is not the windows, it is not the EDR and the XDR products. 282 00:34:52,150 --> 00:35:01,330 So, let's execute the second DEM for you guys. 283 00:35:02,910 --> 00:35:21,490 The same as again, we have the antivirals, EDR working with advanced threat protection and we will execute, uh, as usual, Mimikatz. 284 00:35:21,490 --> 00:35:34,110 I downloaded from GitHub, put on my server, as you can see, and execute this guy in a protected environment. 285 00:35:34,110 --> 00:35:38,130 And let's see this working. 286 00:35:39,790 --> 00:35:40,510 Woo! 287 00:35:40,510 --> 00:35:41,150 So, uh, this is a, this is a, this is a demo . 288 00:35:43,290 --> 00:35:45,530 It's not all. 289 00:35:45,530 --> 00:35:50,710 Execute and show a coffee, it, it's a easy part. 290 00:35:50,710 --> 00:35:53,230 Let's dump the creds. 291 00:35:53,370 --> 00:35:57,530 Without creds, we have nothing. 292 00:35:57,530 --> 00:36:09,430 So, yeah, we can touch the else us without any identification with regular Mimikatz guys. 293 00:36:10,170 --> 00:36:12,410 Woo! 294 00:36:15,530 --> 00:36:35,010 Coming to the end, uh, we are able to test with 66, uh, percent of the products, uh, present in Gartner and in additional four other products. 295 00:36:35,010 --> 00:36:38,870 And this is the result table. 296 00:36:38,870 --> 00:36:39,510 Okay? 297 00:36:39,510 --> 00:37:08,390 We tested remote process injection, Meterpreter, and Havoc as non-privileged user, and Meterpreter loading QE model, Mimikatz, ProcDump, and a custom, a hundred percent developed by me, a hundred percent assembled by me, uh, assembly, else us dump. 298 00:37:08,750 --> 00:37:09,830 Okay? 299 00:37:09,830 --> 00:37:14,310 I created this in order to do this test. 300 00:37:14,310 --> 00:37:17,670 And this is the result table, okay? 301 00:37:17,670 --> 00:37:21,210 This is the products that I, I was able to test. 302 00:37:21,210 --> 00:37:33,030 And as you can see, uh, we, we have, uh, a lot of effectivity in order to, to doing this little things. 303 00:37:33,030 --> 00:37:44,250 Uh, as I told you guys, uh, three weeks ago, two vendors, uh, reached me in order to, to test, uh, again. 304 00:37:44,250 --> 00:37:50,390 The Sentinel one was the first and the second one was the trench. 305 00:37:50,390 --> 00:37:59,970 This results that I'm showing you, uh, the Sentinel one was able to, uh, stop hookchain. 306 00:38:00,290 --> 00:38:09,950 They did some patches in his product and, uh, uh, I was able to, to test this and stop it at all. 307 00:38:09,950 --> 00:38:10,990 Okay? 308 00:38:10,990 --> 00:38:12,890 Deadline, end line. 309 00:38:12,890 --> 00:38:19,370 Uh, and the trench, uh, is still working on this, this, uh, uh, identification. 310 00:38:19,370 --> 00:38:23,090 And they tried some behaviors but, but not at all. 311 00:38:23,090 --> 00:38:23,610 Okay? 312 00:38:23,610 --> 00:38:27,790 The other vendors, non-contact. 313 00:38:28,470 --> 00:38:29,610 Okay? 314 00:38:32,010 --> 00:38:39,010 I love it this, uh, this phrase of Sif Hawking. 315 00:38:39,010 --> 00:38:45,370 I'm just, uh, a child asking who, how and why. 316 00:38:45,370 --> 00:38:48,450 Occasionally I found the answer. 317 00:38:48,530 --> 00:38:49,830 Thank you guys. 318 00:38:49,830 --> 00:39:05,630 This is my contact, full white paper, source code, reference and feel free to contact me, feel free to reach me by, uh, LinkedIn. 319 00:39:05,630 --> 00:39:12,210 My LinkedIn, it's my name, just Elvio Junior and that's it. 320 00:39:12,210 --> 00:39:17,110 Now it's your time, time to ask questions. 321 00:39:17,110 --> 00:39:18,410 Thank you.