1 00:00:00,000 --> 00:00:03,240 So I'm here to introduce our speaker, Dr. 2 00:00:03,240 --> 00:00:09,900 Bramweill Brunzedean, with his talk, Can't Stop the ROP, Automating ASLR. 3 00:00:09,900 --> 00:00:14,000 I am extremely excited for this talk, so would you all please help me welcome him. 4 00:00:19,670 --> 00:00:20,770 All righty. 5 00:00:20,770 --> 00:00:21,930 Welcome, welcome. 6 00:00:21,930 --> 00:00:24,530 Thank you for coming to my talk. 7 00:00:24,530 --> 00:00:29,290 The first talk in a while that I've actually had full control of my voice. 8 00:00:29,290 --> 00:00:35,590 The last few I've had severely affected vocal quality from my voice being ravaged. 9 00:00:35,590 --> 00:00:38,930 So in any case, my name is Bramweill Brunzedean. 10 00:00:38,930 --> 00:00:52,730 I am the director of the Vrona Lab at UAH and also an assistant professor and creator of various different tools, including the Shell Wasp, which allows us to utilize Windows Syscalls and Shellcode. 11 00:00:52,850 --> 00:01:01,970 The JopRocket, allowing us to do jump-oriented programming, and RopRocket for return-oriented programming, and an NSA-funded Shellcode analysis framework. 12 00:01:02,230 --> 00:01:05,770 SHARM, funded with about $300,000. 13 00:01:06,090 --> 00:01:17,330 A speaker at various conferences, DEF CON, Black Hat, Hack in the Box, Virus Bulletin, PAI on different grants from the NSA, and more recently, DLD. 14 00:01:17,650 --> 00:01:25,410 I do have a PhD in cyber operations, which is a highly technical degree dealing with reverse engineering, malware analysis, and software exploitation. 15 00:01:26,270 --> 00:01:30,650 So now that we have all of that out of the way, why should you care? 16 00:01:30,650 --> 00:01:35,030 What is the big selling point of this talk? 17 00:01:35,030 --> 00:01:47,590 And really, the answer to that is, ASLR is the crown jewel in the arsenal for Microsoft in terms of defending against memory corruption bugs. 18 00:01:47,590 --> 00:01:55,530 So if you're using applications that are made in a non-memory-safe language, this is extremely, highly, highly relevant. 19 00:01:56,050 --> 00:02:04,710 So high entropy ASLR is hopefully supposed to defend and be very resilient against these attacks, but the reality is, it's not. 20 00:02:04,710 --> 00:02:14,770 It's a significant design flaw vulnerability that allows us to do some things that we probably shouldn't be able to do, but yet we can easily do so. 21 00:02:15,070 --> 00:02:23,070 In my testing, I've achieved 100% success on the different OS builds that we tested it on, and we expected nothing less. 22 00:02:23,250 --> 00:02:35,510 What this talk is going to give us, we're going to have a mini-tool that we'll release, and actually released about 3 a.m., part of the ROP Rocket tool, and also have a demo, so some things to look forward to. 23 00:02:35,510 --> 00:02:37,550 So why did I do this work in the first place? 24 00:02:37,550 --> 00:02:43,750 Well, I saw that there was a bug bounty listed on Microsoft's website, valued at $5,000 to $15,000. 25 00:02:43,750 --> 00:02:45,930 I thought, well, you know, I could do this. 26 00:02:45,930 --> 00:02:57,490 I looked at the scope, what was in scope, what was out of scope, and it seemed like something that I could easily do, and so that was the motivation for this work. 27 00:02:58,850 --> 00:03:04,950 So a one-page slide crash course into ROP. 28 00:03:04,950 --> 00:03:05,610 Well, what is it? 29 00:03:05,610 --> 00:03:17,110 It's really a way for us to have bits of executable code chained together, allowing us to then overcome a mitigation, such as data execution prevention, or address space layout randomization. 30 00:03:17,170 --> 00:03:22,890 If we can do that, then we can then execute our shellcode, or achieve our arbitrary computation. 31 00:03:23,270 --> 00:03:28,370 So these are highly, super, super relevant ASLR. 32 00:03:28,390 --> 00:03:30,710 It's been around for a minute or two. 33 00:03:30,710 --> 00:03:34,790 So first came about in 2001 with PAX. 34 00:03:35,870 --> 00:03:46,670 2004, we figured out, you know what, we need more entropy than 32-bit, because if we don't, then we can simply do brute-forcing attacks. 35 00:03:47,270 --> 00:03:54,350 It took a little while for Microsoft to make use of ASLR, but they eventually came around to it. 36 00:03:54,350 --> 00:04:02,730 More recently, what's been most fashionable in all the rage has been different side-channel micro-architectural attacks. 37 00:04:02,730 --> 00:04:09,930 So some really superb research on some of that right now. 38 00:04:09,930 --> 00:04:12,630 We're skipping through some of them, just in the interest of time. 39 00:04:13,630 --> 00:04:22,910 And then the last there is this universal ASLR bypass, which is really an enhancer, or a multiplier to a pre-existing vulnerability. 40 00:04:27,240 --> 00:04:35,140 So some classic approaches to an ASLR bypass, and this is not 100% all-inclusive, but one could be a memory disclosure bug. 41 00:04:35,140 --> 00:04:37,020 So we might have something like a use-after-free. 42 00:04:37,020 --> 00:04:40,940 We have some particular value that's being displayed, maybe printed to a screen. 43 00:04:41,040 --> 00:04:42,100 We free that. 44 00:04:42,100 --> 00:04:48,420 We then maybe cause that particular memory location to be overwritten with something of the same size. 45 00:04:48,420 --> 00:04:54,640 And then when you go to display it again, hence the use-after-free, then maybe you disclose something like a function pointer. 46 00:04:54,640 --> 00:04:58,680 And then from that, you can extrapolate and determine the base address. 47 00:04:59,120 --> 00:05:09,320 Other things, page spraying, heap spraying, brute force attacks, those used to be highly effective, and then to a lesser degree. 48 00:05:09,320 --> 00:05:15,100 But with high entropy, ASLR, the entropy is just too great for those to really be feasible. 49 00:05:15,440 --> 00:05:22,940 If you go back much further, it's simply just using hard-coded predictable addresses if you didn't have ASLR. 50 00:05:23,340 --> 00:05:25,620 So I guess that's not really a bypass. 51 00:05:26,220 --> 00:05:34,260 Our approach here is we need to have one existing vulnerability. 52 00:05:34,260 --> 00:05:40,520 So if you don't have something like, say, a memory corruption bug, then this is not going to work. 53 00:05:40,660 --> 00:05:43,820 And you need to have the ability to execute ROP gadgets. 54 00:05:43,820 --> 00:05:50,380 So if you don't have that, if you don't have the ability to use ROP, then this will not work. 55 00:05:50,380 --> 00:05:54,280 So we're targeting 64-bit windows, and in particular, high-entropy ASLR. 56 00:05:54,280 --> 00:05:57,120 And we can have force relocate enabled as well. 57 00:05:57,120 --> 00:06:01,560 And our goal is to get the base address of system DLLs. 58 00:06:01,720 --> 00:06:14,280 In this case, we then have effectively bypassed ASLR, and we now have access to those, and we can easily, readily use them to massively expand the attack surface. 59 00:06:14,440 --> 00:06:19,660 And we need to have a payload size of sufficient size. 60 00:06:20,120 --> 00:06:25,340 The benefits to the attacker, massively expanding the attack surface. 61 00:06:25,340 --> 00:06:30,100 So maybe you have a small application, and there's just really not enough to really do much. 62 00:06:30,100 --> 00:06:40,640 But with this, you now have the ability to potentially add thousands of additional gadgets, and that can enable you to do something more substantial. 63 00:06:40,640 --> 00:06:48,460 It is portable across binaries, meaning that this general approach, you can take it and apply it to, hopefully, any Windows binary. 64 00:06:48,460 --> 00:06:56,880 It's not tied to a specific application that happens to be vulnerable, hence the universal ASLR bypass, and the title of this talk. 65 00:06:56,880 --> 00:07:00,700 So this does make use of the process environment block, the PEB. 66 00:07:00,700 --> 00:07:02,980 I'm sure a lot of you are familiar with that. 67 00:07:02,980 --> 00:07:06,260 And it's something that's easily readable from user mode. 68 00:07:06,360 --> 00:07:19,500 There's some common ways to disclose that that we'll get into, but there's also some rather uncommon ways, as well, that I think will probably be surprising and interesting to most people, though not necessarily everybody. 69 00:07:19,500 --> 00:07:23,720 So we'll go through all of them, and this technique can make use of any of them. 70 00:07:24,260 --> 00:07:32,620 But we'll start with the most, so this page right here, we see the PEB being displayed, the threat of environment block. 71 00:07:32,680 --> 00:07:41,420 And so that can be pointed to by the GS segment register, and then at offset 60 is going to be located the process environment block. 72 00:07:41,420 --> 00:07:46,820 So if we have the ability to access the GS register, then we can easily access that. 73 00:07:46,820 --> 00:07:48,620 And then if we don't, that's fine. 74 00:07:48,620 --> 00:07:50,940 There are other ways we could obtain that, as well. 75 00:07:51,000 --> 00:07:54,020 So the PEB is defined as a structure . 76 00:07:54,140 --> 00:07:57,980 One place that it's defined, as you can see, the Windows internal header file. 77 00:07:58,240 --> 00:08:04,980 You could also view that in tools like WinDebug and see some more of those reserved. 78 00:08:05,440 --> 00:08:10,240 In this particular thing here, we see reserved 1, 2, reserved 2, 1. 79 00:08:10,980 --> 00:08:15,660 But if you view that in WinDebug, you can see the actual titles of all of those. 80 00:08:16,680 --> 00:08:23,080 But in any case, our goal, our general approach here to this is, firstly, somehow we need to obtain the PEB. 81 00:08:23,360 --> 00:08:25,480 There are many ways in which we can do that. 82 00:08:25,480 --> 00:08:31,220 So the most common easy way to do that would be the GS segment register at offset 60. 83 00:08:31,220 --> 00:08:33,920 We saw that that points to the process environment block. 84 00:08:34,000 --> 00:08:35,560 If we can do that, great. 85 00:08:35,560 --> 00:08:40,920 If we're doing it in a 32-bit, then that would be FS30 would hold the PEB. 86 00:08:41,060 --> 00:08:52,720 If we're doing WoW 64 and we want to access the PEB, you could do something called Heaven's Gate, where you transition from 32-bit to 64-bit mode, which is really very fun and interesting to observe. 87 00:08:53,520 --> 00:09:01,100 And in that case, the R12 would hold a pointer to the TEB, and then you could use that to then go and obtain the PEB. 88 00:09:01,480 --> 00:09:05,640 And some other more interesting ways, Windows syscalls, we can use them. 89 00:09:05,640 --> 00:09:06,980 We'll explore those. 90 00:09:06,980 --> 00:09:14,400 And then RDGS base is another less familiar way that we will explore. 91 00:09:14,540 --> 00:09:18,960 We need to have a way to reach the PEB LDR data. 92 00:09:18,960 --> 00:09:20,220 We'll check that out. 93 00:09:20,220 --> 00:09:24,280 And then we can choose one of three doubly-linked module lists. 94 00:09:24,620 --> 00:09:30,660 And then we'll follow the flinks a set number of times based on the general approach that we follow. 95 00:09:30,780 --> 00:09:37,060 And then finally, we will obtain the DLL base, which will be a field that will be available and accessible. 96 00:09:37,060 --> 00:09:39,340 So we'll go into great detail momentarily. 97 00:09:39,680 --> 00:09:44,160 But first, let's take a look here at an example of one way we could leak the PEB. 98 00:09:44,160 --> 00:09:50,100 In this case, it's a very ugly, kind of nasty-looking gadget. 99 00:09:50,560 --> 00:09:56,040 And we see sub-RCX, Q word pointer, GS, RSI plus some big numbers. 100 00:09:56,040 --> 00:09:59,700 So what we want to do is we want to have RSI be equal to 60. 101 00:09:59,920 --> 00:10:01,240 I already have a big number there. 102 00:10:01,240 --> 00:10:02,160 How can I do that? 103 00:10:02,160 --> 00:10:04,380 The answer is simple, integer overflow. 104 00:10:04,520 --> 00:10:09,560 So we just add another really big number so that once you add them together, they're equal to 60. 105 00:10:09,560 --> 00:10:12,040 RCX, we can set that to zero. 106 00:10:12,220 --> 00:10:15,720 And then the result will be a negative value in two's complement form. 107 00:10:15,720 --> 00:10:22,520 And then we can then do neg RCX, which will then restore it to its original form. 108 00:10:22,520 --> 00:10:24,120 And that will be the PEB. 109 00:10:24,240 --> 00:10:28,200 We also have to make sure that the EAX register is set to valid memory. 110 00:10:28,200 --> 00:10:32,500 And then the POP and the RET10, we can easily compensate for those with filler. 111 00:10:33,320 --> 00:10:39,360 So going back more to the specifics of our approach here, we have nine different variant approaches. 112 00:10:39,360 --> 00:10:41,840 We're targeting three different DOLs. 113 00:10:41,840 --> 00:10:53,740 So in any particular Windows application, or almost a vast majority of them except for really tiny minified applications, but any real world application, you will always have these three DOLs loaded. 114 00:10:53,960 --> 00:11:00,360 And depending on the particular module list that you make use of, they will be loaded in a preset order. 115 00:11:00,360 --> 00:11:03,040 So we can manipulate and use that. 116 00:11:03,040 --> 00:11:04,780 And this is a table that I created. 117 00:11:04,780 --> 00:11:13,200 So we can have the number of different flinks that are indicated showing the steps that we would take. 118 00:11:13,200 --> 00:11:15,660 So these are doubly linked module lists. 119 00:11:15,660 --> 00:11:21,220 So essentially we have a module list that will have a forward link pointer and then a backward link pointer. 120 00:11:21,220 --> 00:11:25,880 So if we take one flink, then that takes us to the next one, to the next one, et cetera. 121 00:11:26,220 --> 00:11:33,240 And then the offsets for the list and the DOL base, those can vary. 122 00:11:33,240 --> 00:11:36,740 You notice that all of them, you add them together, the sum is always going to be 40. 123 00:11:36,960 --> 00:11:39,660 Not that that's super relevant, but just kind of interesting. 124 00:11:40,860 --> 00:11:46,240 So what we're going to do is we're going to do a case study of one of these approaches and we're going to super great detail. 125 00:11:46,400 --> 00:11:52,860 And the others are similar, but just slight differences in terms of what you're pursuing. 126 00:11:55,560 --> 00:11:59,240 And then this is something that we'll also see that can be fully automated by the tool. 127 00:11:59,240 --> 00:12:03,180 So it'll generate all the gadgets and we'll see that momentarily. 128 00:12:03,480 --> 00:12:07,680 So here's a handwritten script to get kernel 32. 129 00:12:07,680 --> 00:12:10,220 And you notice these are all really basic, simple gadgets. 130 00:12:10,220 --> 00:12:17,000 We're not using anything unusual like move dereference, some offset. 131 00:12:17,000 --> 00:12:21,120 We can have one move dereference gadget and a lot of flexibility. 132 00:12:21,120 --> 00:12:30,460 And so it's really designed to be very simple and basic gadgets that are easily readily available on binaries. 133 00:12:31,980 --> 00:12:36,460 In terms of capturing the PEB, so in this case, we're doing it with a leak in the GS register. 134 00:12:36,460 --> 00:12:39,840 We can look in WinDebug and we see, okay, RDX, what is there? 135 00:12:39,840 --> 00:12:40,440 It's the PEB. 136 00:12:40,440 --> 00:12:42,520 We can verify that with the bang PEB. 137 00:12:43,180 --> 00:12:45,160 And then we need to add a distance of 18. 138 00:12:45,160 --> 00:12:48,560 That will then allow us to reach the PEB LDR. 139 00:12:48,560 --> 00:12:49,800 We can add that. 140 00:12:50,040 --> 00:12:55,760 In this case, we're adding, we're popping that into one register and then doing, adding the two registers together. 141 00:12:55,820 --> 00:12:59,380 If we don't have the ability to add registers, not a problem. 142 00:12:59,380 --> 00:13:01,400 We could also do something very simple. 143 00:13:01,400 --> 00:13:06,320 For instance, 18 increments, very easy, common gadgets to obtain. 144 00:13:06,760 --> 00:13:09,240 And then we can then dereference that. 145 00:13:09,240 --> 00:13:10,520 We get the LDR location. 146 00:13:10,560 --> 00:13:14,080 So we're basically traversing Windows structures here. 147 00:13:14,300 --> 00:13:17,600 And then we want to reach the init initialization modulus. 148 00:13:17,600 --> 00:13:20,240 And so in this case, we're going to add 30. 149 00:13:20,240 --> 00:13:24,040 We could consult that little table that I showed you earlier. 150 00:13:24,340 --> 00:13:32,960 And once we do that, we can then obtain the LDR and initialization order modulus location. 151 00:13:32,960 --> 00:13:35,280 And then we can follow that. 152 00:13:35,280 --> 00:13:38,040 That'll be returned to us in RBX. 153 00:13:38,040 --> 00:13:43,340 So we complete those ROP gadgets that you see on the slide there. 154 00:13:43,400 --> 00:13:45,680 And then now let's follow in the flanks. 155 00:13:45,680 --> 00:13:48,200 So we get to our first flank. 156 00:13:48,200 --> 00:13:51,480 And what that is pointing to is simply another flank. 157 00:13:51,480 --> 00:13:53,680 And that's pointing to another flank. 158 00:13:53,680 --> 00:13:55,860 And that's pointing to another flank. 159 00:13:55,860 --> 00:14:06,480 And so we can easily traverse that just by simply taking one, dereferencing it, getting that address, and then dereferencing it until we get to the location that we so desire. 160 00:14:07,460 --> 00:14:12,620 So we can, our initial one that was on the previous page can take us to NTDL flank. 161 00:14:12,620 --> 00:14:17,840 We take another move dereference, getting us to the kernel base flank. 162 00:14:17,920 --> 00:14:26,220 And then finally, a third dereference will get us to the kernel 32 modulus for an initialization. 163 00:14:26,540 --> 00:14:28,960 Or I'm sorry, the entry, not the modulus. 164 00:14:30,380 --> 00:14:36,400 And then within that structure, there's a field called the DLL base. 165 00:14:36,720 --> 00:14:40,700 And so that is really what we're focused on. 166 00:14:40,700 --> 00:14:43,900 If we can obtain the DLL base, that gives us the base address. 167 00:14:43,900 --> 00:14:49,400 That means we can take that base address and that's the ASLR bypass. 168 00:14:49,400 --> 00:14:54,320 So we can then from that utilize simply offsets. 169 00:14:54,480 --> 00:15:09,760 So we're going to proceed forward and we see that once we capture that, we get that into RBX, we dereference that, we can check, we can do the LMF command and window bug and we see clearly, okay, this is kernel 32. 170 00:15:09,760 --> 00:15:12,780 We have obtained our ASLR bypass. 171 00:15:15,380 --> 00:15:21,480 Another view from the window bug there, we check in RBX and it maps out. 172 00:15:22,700 --> 00:15:24,520 So the kinds of gadgets that we can use. 173 00:15:24,520 --> 00:15:32,800 Again, this whole approach is we're taking, trying to take something and make it simple and easy to do with ROP. 174 00:15:32,800 --> 00:15:34,060 We're not writing shell code. 175 00:15:34,060 --> 00:15:39,280 We're not writing malware with inline assembly where we can just use whatever we want. 176 00:15:39,280 --> 00:15:42,260 We need to use it with commonly available gadgets. 177 00:15:42,260 --> 00:15:46,520 So we need some way to leak the PEB, some way to add offsets. 178 00:15:46,520 --> 00:15:50,060 It could be a series of increments and then some way to dereference. 179 00:15:50,060 --> 00:15:54,040 Now the registers being used does not matter, not important. 180 00:15:54,280 --> 00:15:57,240 And we can have a single dereference gadget. 181 00:15:57,240 --> 00:16:03,120 We can use it multiple times and it could also be XOR dereference or add or sub dereference. 182 00:16:03,320 --> 00:16:05,440 We can work with any of them. 183 00:16:05,440 --> 00:16:10,580 Some way to load a value, whether it's popping or integer overflow or negation. 184 00:16:10,720 --> 00:16:12,520 Lots of opportunities. 185 00:16:13,740 --> 00:16:15,760 So what are some alternative routes? 186 00:16:15,760 --> 00:16:20,040 So a lot of you may know about the GS register but let's check out some of these less common ones. 187 00:16:20,040 --> 00:16:24,040 Because you know what, not every binary is going to have a way to leak the GS register. 188 00:16:24,040 --> 00:16:26,680 So can we proceed forward without that? 189 00:16:26,820 --> 00:16:27,660 Absolutely. 190 00:16:28,700 --> 00:16:33,900 So two different syscall roads or paths to get to the PEB. 191 00:16:33,900 --> 00:16:39,900 One is NT query information thread, which will give us GIF wrapped, the tab pointer. 192 00:16:39,900 --> 00:16:45,120 And NT query information process, which will then return to us the PEB. 193 00:16:45,220 --> 00:16:48,400 So we've got to set up those syscalls. 194 00:16:49,080 --> 00:16:51,760 So the first one, NT query information process. 195 00:16:51,760 --> 00:16:54,840 How specifically do we set that up? 196 00:16:54,840 --> 00:17:02,220 So we just simply follow the X64 system calling convention but with some minor twists that we'll get into. 197 00:17:02,220 --> 00:17:08,520 So into RDX we can provide zero, which will specify the process basic information. 198 00:17:09,140 --> 00:17:13,200 R8 can be any memory that is writable. 199 00:17:13,200 --> 00:17:18,120 Does not have to be... you can use multiple gadgets to do that. 200 00:17:18,120 --> 00:17:18,860 Could be the stack. 201 00:17:18,860 --> 00:17:20,240 Really doesn't matter. 202 00:17:20,480 --> 00:17:26,180 And then R9 we want to provide the size of the process basic information structure. 203 00:17:27,120 --> 00:17:29,040 R10 we want to do negative one. 204 00:17:29,040 --> 00:17:31,860 So that's going to be 16 Fs. 205 00:17:32,020 --> 00:17:37,240 And then the syscall system number, the SSN, we will provide 19. 206 00:17:37,240 --> 00:17:39,620 And I'll talk about that momentarily. 207 00:17:39,820 --> 00:17:43,940 And then in some way to invoke the syscall, a syscall gadget. 208 00:17:43,940 --> 00:17:51,840 And then after that, we'll get into EAX or RAX, NT status code zero, which stands for SLK. 209 00:17:52,020 --> 00:17:58,080 And then we can then go and retrieve the PEB base address, which will be located from that structure we created. 210 00:17:58,080 --> 00:18:00,280 But it will be an offset eight. 211 00:18:01,660 --> 00:18:03,960 So the SSN, it's a Windows syscall. 212 00:18:03,960 --> 00:18:05,560 How can we deal with this? 213 00:18:05,560 --> 00:18:09,100 Because some of you know that with Windows syscalls, there can be challenges. 214 00:18:09,100 --> 00:18:17,760 You need to dynamically resolve the SSN because it can change from one OS build to the next. 215 00:18:17,760 --> 00:18:19,100 And that is super true. 216 00:18:19,100 --> 00:18:33,460 So we may have techniques like, you know, syswhispers, hellsgate, but if we do our information gathering, we determine, hey, we're targeting Windows 10 or 11, then in that particular case, it's completely stable. 217 00:18:33,460 --> 00:18:35,520 It's the same SSN for all of them. 218 00:18:35,520 --> 00:18:38,100 So we could actually ignore that step. 219 00:18:38,280 --> 00:18:46,920 But if you wanted to also target Windows 7 or other earlier versions, then that could be something extra that you could add to do that. 220 00:18:47,220 --> 00:18:52,720 So the structure for the process basic information, you can see that provided there for you. 221 00:18:52,720 --> 00:18:58,600 And then the one we care about is the PEB address or PEB base address at offset 8. 222 00:18:59,880 --> 00:19:06,560 So here's some inline assembly just to kind of demonstrate what we could do in order to obtain this. 223 00:19:06,560 --> 00:19:10,380 So we can set RDX to zero by Zoring it together. 224 00:19:10,380 --> 00:19:14,460 We provide a memory address, RSP 50. 225 00:19:14,560 --> 00:19:17,720 And then in R9, we're providing our size. 226 00:19:17,900 --> 00:19:22,100 And then R10, we are providing negative one. 227 00:19:22,100 --> 00:19:26,100 And you might say, well, the calling convention is you should do that in RCX. 228 00:19:26,100 --> 00:19:40,640 But because we're doing syscalls, what's going to actually happen is you have a native API wrapper, and that will just simply take the RCX value, move that into R10, so we can skip loading our RCX. 229 00:19:40,640 --> 00:19:41,700 It's not necessary. 230 00:19:41,700 --> 00:19:44,360 We can instead just load the value directly into R10. 231 00:19:44,360 --> 00:19:46,440 And if we don't do that, it's not going to work. 232 00:19:46,540 --> 00:19:49,400 And there's also a fifth parameter, the return length. 233 00:19:49,400 --> 00:19:49,820 Guess what? 234 00:19:49,820 --> 00:19:51,040 It's optional. 235 00:19:51,180 --> 00:19:53,220 So we can just simply ignore that. 236 00:19:53,220 --> 00:19:55,220 And that's true for both of these syscalls. 237 00:19:55,360 --> 00:20:02,620 The SSN, we can provide that directly, and we have a syscall value or syscall instruction there. 238 00:20:02,640 --> 00:20:08,540 Once that's done, then we can simply retrieve that at offset eight from that structure that we provided. 239 00:20:09,440 --> 00:20:15,800 So this, again, we'll see this in a ROP form momentarily from the tool that will automate that process. 240 00:20:16,160 --> 00:20:18,060 We can check that out after we do it. 241 00:20:18,060 --> 00:20:18,920 We do the bang peb. 242 00:20:18,920 --> 00:20:20,600 We compare what we have in RAX. 243 00:20:20,600 --> 00:20:21,520 Does it match? 244 00:20:21,520 --> 00:20:22,600 Yes, it does. 245 00:20:22,600 --> 00:20:24,820 So totally works. 246 00:20:26,480 --> 00:20:31,020 In T query information thread, another syscall that can work. 247 00:20:31,020 --> 00:20:33,340 Very effective and also very similar. 248 00:20:33,340 --> 00:20:35,320 Some minor changes. 249 00:20:35,320 --> 00:20:39,040 So zero is going to specify the thread basic information structure. 250 00:20:39,240 --> 00:20:44,620 Again, any writable memory is adequate for our R8 register. 251 00:20:44,720 --> 00:20:48,440 R9, we can provide the size of that structure. 252 00:20:48,940 --> 00:20:54,640 And then within R10, again, that is going to be the handle. 253 00:20:54,640 --> 00:21:01,960 In this case, it's going to be negative two, which is going to be the current thread, and we'll provide that in two's complement form. 254 00:21:02,520 --> 00:21:05,440 The SSN, we can provide that directly. 255 00:21:05,440 --> 00:21:09,620 And then the syscall instruction, we can do that cleanly with a nice syscall gadget. 256 00:21:09,960 --> 00:21:14,420 And once we get the result where we get the tab, we'll have a couple extra steps. 257 00:21:14,420 --> 00:21:19,300 We'll need to also then add 60 to that and then dereference that. 258 00:21:20,280 --> 00:21:24,080 The SSN, same situation, same story. 259 00:21:24,080 --> 00:21:27,380 We don't need to resolve it if you're doing Windows 10 or 11. 260 00:21:27,380 --> 00:21:36,100 If you want to include other ones, then you would need to utilize a technique to dynamically resolve the SSN. 261 00:21:37,260 --> 00:21:41,200 So we could check out the inline assembly form of that. 262 00:21:41,200 --> 00:21:42,740 We could set RDX to zero. 263 00:21:42,740 --> 00:21:45,880 We provide a buffer for our structure. 264 00:21:45,880 --> 00:21:52,620 We provide the size of that into R9, and then the SSN of 25. 265 00:21:52,620 --> 00:21:55,980 That's how we specify this is the syscall that we're using. 266 00:21:55,980 --> 00:21:59,140 We don't have to worry about resolving any addresses for syscalls. 267 00:21:59,140 --> 00:22:01,120 We just need the SSN directly. 268 00:22:01,480 --> 00:22:05,340 We have the negative two and the two's complement form there. 269 00:22:05,340 --> 00:22:13,200 We call the syscall, and then whatever location we provided as the memory, we can then go and retrieve that at offset eight. 270 00:22:13,200 --> 00:22:15,420 So again, very similar to the previous one. 271 00:22:15,540 --> 00:22:20,240 We can execute it, check it out in a WinDebug, and we get a particular value. 272 00:22:20,240 --> 00:22:22,980 We do the bang tab, and it matches. 273 00:22:23,080 --> 00:22:29,220 And then there at the bottom, circled in silver, we can see the PEB address. 274 00:22:29,220 --> 00:22:31,580 That's where we want to get to eventually. 275 00:22:31,860 --> 00:22:38,960 So we can simply add 60 to that, because offset 60 of the tab points to the process environment block. 276 00:22:38,960 --> 00:22:43,020 So in this case, you can see there we're just doing RAX plus 60. 277 00:22:43,020 --> 00:22:47,840 Later on, you'll see that in ROP format generated by the tool. 278 00:22:48,740 --> 00:22:55,720 So another option, and this is one that probably most people are not familiar with, is RDGSBASE. 279 00:22:55,720 --> 00:22:57,600 It's an actual assembly instruction. 280 00:22:57,600 --> 00:23:04,180 So you could provide it RDGSBASE, it's going to return the address of the tab directly into RAX. 281 00:23:04,180 --> 00:23:13,240 So that would be very effective if you were writing, say, shellcode or malware, and you wanted to resolve the base address of a DLL. 282 00:23:13,240 --> 00:23:19,880 If you're doing it with return-oriented programming, we have to look at what are the gadgets that will be found. 283 00:23:19,880 --> 00:23:31,820 This may be too obscure to be commonly readily available as a use in 2024. 284 00:23:33,240 --> 00:23:35,540 We're going to check this out in WinDebug. 285 00:23:35,540 --> 00:23:36,440 We execute it. 286 00:23:36,440 --> 00:23:37,080 Very simple. 287 00:23:37,080 --> 00:23:41,580 It gives us the tab very easily. 288 00:23:41,920 --> 00:23:44,300 And then we can add 60 to that. 289 00:23:44,500 --> 00:23:49,300 And once we do that, then that gives us 2AC00. 290 00:23:51,140 --> 00:23:55,500 And that checks out as the peb there. 291 00:23:56,220 --> 00:23:59,360 So another option, what if those four things do not exist? 292 00:23:59,360 --> 00:24:01,500 Could we still do this via ROP? 293 00:24:01,660 --> 00:24:02,620 And the answer is yes. 294 00:24:02,620 --> 00:24:05,860 We can effectively synthesize our own ROP gadget. 295 00:24:05,860 --> 00:24:08,780 For instance, you could synthesize RDGSBASE. 296 00:24:08,780 --> 00:24:19,240 So if you have the ability to write bytes to memory, let's say, for instance, virtual alloc and t-allocate virtual memory, I mean, those could potentially be blocked. 297 00:24:19,240 --> 00:24:21,820 But let's say we have some way to do that. 298 00:24:21,820 --> 00:24:27,800 Then we could write that to memory, and then we can then call that gadget and then make use of it. 299 00:24:27,800 --> 00:24:35,440 It's a technique that we made use of in our DEF CON talk last year on process injection via return-oriented programming. 300 00:24:36,260 --> 00:24:38,740 So let's check out the exploit demo. 301 00:24:38,740 --> 00:24:40,080 We have a little video here. 302 00:24:40,080 --> 00:24:43,700 So let's hope I'm sophisticated enough to operate this. 303 00:24:55,740 --> 00:24:57,160 Wrong video. 304 00:25:02,600 --> 00:25:03,200 Okay. 305 00:25:03,200 --> 00:25:03,620 There we go. 306 00:25:03,620 --> 00:25:06,700 So we have a leaked PEB right there. 307 00:25:07,840 --> 00:25:10,560 And we're going to verify it with a bang PEB command. 308 00:25:12,240 --> 00:25:17,200 And we can load the LDR offset there. 309 00:25:18,320 --> 00:25:20,740 And now we have the LDR address there. 310 00:25:20,740 --> 00:25:21,640 We can continue on. 311 00:25:21,640 --> 00:25:26,120 Now we want to set up getting the LDR and load memory. 312 00:25:26,120 --> 00:25:26,720 We got that. 313 00:25:26,720 --> 00:25:28,520 Now we're following different flinks. 314 00:25:29,280 --> 00:25:32,060 And at this point, we want to add 30. 315 00:25:32,060 --> 00:25:35,040 And that will then allow us to reach the DLL base. 316 00:25:35,340 --> 00:25:36,540 And we add that. 317 00:25:36,540 --> 00:25:38,860 Now we have the DLL base. 318 00:25:38,860 --> 00:25:42,260 We're about to get it momentarily. 319 00:25:43,260 --> 00:25:49,920 And we see that that is... looks like it... now we have the ASLR bypass. 320 00:25:49,920 --> 00:25:51,140 We've achieved it. 321 00:25:51,140 --> 00:25:53,280 So that's simple. 322 00:25:53,280 --> 00:25:55,120 And we have the bypass. 323 00:26:03,060 --> 00:26:09,320 So the reality is probably 99% of the time or greater this is going to work. 324 00:26:09,320 --> 00:26:12,440 If you have these ROP gadgets, you set them up. 325 00:26:12,960 --> 00:26:15,380 I mean, this is a design flaw vulnerability. 326 00:26:16,380 --> 00:26:19,380 It's almost certain that it will work. 327 00:26:19,380 --> 00:26:22,380 I don't want to say 100%, but very likely. 328 00:26:23,900 --> 00:26:26,080 Do we need to leak the GS register? 329 00:26:26,080 --> 00:26:26,380 No. 330 00:26:26,380 --> 00:26:28,660 There are alternative ways as we explored. 331 00:26:28,940 --> 00:26:31,400 Do we always need or want to do this? 332 00:26:31,820 --> 00:26:38,300 The cases in which you want to do this is if you want to have it as a multiplier or as an enhancer. 333 00:26:38,300 --> 00:26:42,680 You have the ability to call ROP, but you need significantly more gadgets. 334 00:26:42,680 --> 00:26:45,040 You want access to some of these system DLLs. 335 00:26:45,040 --> 00:26:50,020 If you can obtain that, then that vastly expands your attack surface. 336 00:26:50,020 --> 00:26:55,320 You can do things that otherwise you may not have previously been able to do. 337 00:26:55,320 --> 00:26:57,080 So some possible mitigations. 338 00:26:57,080 --> 00:26:58,000 How can we fix this? 339 00:26:58,000 --> 00:26:59,720 How can we address this? 340 00:26:59,720 --> 00:27:01,820 How can Microsoft address it? 341 00:27:01,820 --> 00:27:13,200 Well, one is to randomize the LDR data table entry different, insert unpredictable offsets into that to break some of these fixed offset traversals. 342 00:27:13,200 --> 00:27:16,860 So you can't just use these hard coded offsets. 343 00:27:17,200 --> 00:27:19,420 So it's unpredictable gaps. 344 00:27:19,800 --> 00:27:27,340 This could be done on a per process basis or just set up once each time you load the operating system. 345 00:27:27,340 --> 00:27:29,100 Either way would be effective. 346 00:27:29,420 --> 00:27:39,900 And so in that case, if you were to try to use one of these fixed offsets, then it simply would not give you the desired result and it would break this approach. 347 00:27:40,040 --> 00:27:44,300 We could also have privileged PEB access to that. 348 00:27:44,300 --> 00:27:47,960 So block direct segment loading and user mode. 349 00:27:47,960 --> 00:27:49,200 That could be an option. 350 00:27:49,300 --> 00:27:56,820 Maybe we have a new syscall that is a little bit more responsible in terms of how it provides access to the PEB or the TEB. 351 00:27:56,820 --> 00:28:01,520 And we could check things like what is the control flow graph that led to that? 352 00:28:01,520 --> 00:28:05,580 Did we follow a valid path or are we doing things that are kind of unusual? 353 00:28:06,480 --> 00:28:13,780 So that would be a major architectural lift, but it would eradicate this set of bypasses. 354 00:28:13,920 --> 00:28:17,580 Some other possibilities is pointer obfuscation or encryption. 355 00:28:17,580 --> 00:28:25,620 So maybe we have encrypted values and so if you go and obtain it, it's not enough because it's encoded. 356 00:28:25,620 --> 00:28:27,800 So you could use the Windows API. 357 00:28:27,800 --> 00:28:35,460 It already has some pre-existing things that could be used or just simply even something as simple as an XOR key. 358 00:28:35,720 --> 00:28:48,900 So an additional step that could be relatively simple to implement, in my opinion, but could be highly effective so that you can't just simply decode these PEB values on the fly. 359 00:28:48,900 --> 00:28:53,120 We could also have approaches like fine-grained ASLR, dynamic ASLR. 360 00:28:53,340 --> 00:29:04,300 With fine-grained, we're going to shuffle functions and even basic blocks so that if you do obtain a bypass, it doesn't matter because the other things have been randomized as well. 361 00:29:04,300 --> 00:29:07,280 Dynamic ASLR where we have periodic rebasing. 362 00:29:07,280 --> 00:29:14,260 So it may briefly be effective, but then it's going to change and so it no longer is useful or relevant. 363 00:29:14,280 --> 00:29:17,620 So these would serve to complement not to replace ASLR. 364 00:29:17,840 --> 00:29:19,580 And we could also have execute-only. 365 00:29:19,580 --> 00:29:27,800 So you could have that implemented via hardware support, making PEB and loader pages non-readable. 366 00:29:28,840 --> 00:29:30,940 How would the access be granted? 367 00:29:30,940 --> 00:29:34,920 That would be something that would need to be carefully determined, but it could be viable. 368 00:29:35,840 --> 00:29:39,660 We could also simply enhance the existing exploit detection. 369 00:29:39,660 --> 00:29:43,700 So things like EAF and EAF plus have been around for a very long time. 370 00:29:43,700 --> 00:29:47,620 So we may add some additional heuristics to that or Microsoft could. 371 00:29:47,720 --> 00:29:56,420 And so flag some of these abnormal list entry walks and it wouldn't prevent it, but it could stop it from being effective. 372 00:29:56,940 --> 00:30:00,500 All right, so let's dive into the ASLR mini bypass tool. 373 00:30:00,500 --> 00:30:03,140 So this is built off of ROP rocket. 374 00:30:03,400 --> 00:30:09,300 And what it will do is everything that we talked about, it can generate those complete ROP chains. 375 00:30:09,300 --> 00:30:15,060 So if you wanted to do this and not have to spend the time to write the code, you simply use the tool. 376 00:30:15,340 --> 00:30:20,360 So it does it in 64 bit and it will do all nine variants and it will output it as Python. 377 00:30:20,460 --> 00:30:23,540 Here we can see a complete Python exploit script. 378 00:30:23,540 --> 00:30:25,960 So it takes care of a lot of the mechanics there. 379 00:30:25,980 --> 00:30:29,220 And we will zoom in on that here. 380 00:30:29,220 --> 00:30:34,560 So one way is the PEB disclosure via the GS register. 381 00:30:34,560 --> 00:30:36,560 So we can set that up and obtain that. 382 00:30:36,560 --> 00:30:39,280 And it follows the various steps. 383 00:30:39,380 --> 00:30:43,780 And it does it by kind of a hybrid approach of semantic searching. 384 00:30:43,780 --> 00:30:47,680 So we may say, okay, I want to load a particular value into this register. 385 00:30:47,680 --> 00:30:50,000 What are the different ways in which we could do that? 386 00:30:50,000 --> 00:30:58,640 So it's not something that's just a simple hard coded recipe, but there's a lot of very rich flexibility that's possible. 387 00:30:59,140 --> 00:31:07,400 We can also do it via the RDGS base, the NT query information process and the NT query information thread. 388 00:31:07,400 --> 00:31:17,960 In this case, to obtain our writable and readable memory, we have it set to a particular location relative to the stack. 389 00:31:17,960 --> 00:31:22,280 We use emulation to then calculate the distance to that. 390 00:31:22,280 --> 00:31:24,260 And so we use that to provide the parameter. 391 00:31:24,260 --> 00:31:35,900 And then later on when we go and get that as our result and add offset 8, it automatically takes care of that and does emulation to precisely calculate what that's going to be. 392 00:31:35,900 --> 00:31:40,000 So this is actually a little bit more complicated than what I showed you. 393 00:31:40,220 --> 00:31:42,340 And again, it's fully automated. 394 00:31:42,820 --> 00:31:50,100 So it does it through those four methods, the GS register, RDGS base and then the two sys calls. 395 00:31:50,960 --> 00:31:54,180 And if you get the ROP gadgets from it, then it should work. 396 00:31:54,180 --> 00:31:57,820 It should be totally reliable if it provides those gadgets. 397 00:31:59,140 --> 00:32:02,580 So nine bypass techniques are supported by the tool. 398 00:32:02,580 --> 00:32:09,220 We have kernel 32, kernel base, NTDLL, and for all three of the different module lists. 399 00:32:09,240 --> 00:32:11,260 And moreover, we implement them. 400 00:32:11,260 --> 00:32:17,900 So actually it'll generate not nine, but actually nine times four, which is 36. 401 00:32:18,060 --> 00:32:20,520 So we can do it for the GS register. 402 00:32:20,520 --> 00:32:21,860 We'll get nine variants. 403 00:32:21,860 --> 00:32:31,280 We can do it for the RDGS base, for the NT query information process, as well as the NT query information thread. 404 00:32:31,320 --> 00:32:33,420 All of them will work. 405 00:32:33,720 --> 00:32:35,900 And we'll see a demo momentarily. 406 00:32:35,900 --> 00:32:38,320 But if you're interested, go ahead and take a picture. 407 00:32:38,320 --> 00:32:40,280 It's going to be part of the ROP rocket. 408 00:32:40,280 --> 00:32:41,860 I updated it about 3 a.m. 409 00:32:42,100 --> 00:32:46,540 this morning, providing this additional functionality. 410 00:32:48,280 --> 00:32:50,500 So tool demo time. 411 00:33:06,030 --> 00:33:07,150 Okay, there we go. 412 00:33:07,150 --> 00:33:08,030 So here's the tool. 413 00:33:08,030 --> 00:33:09,290 We're running it. 414 00:33:09,470 --> 00:33:11,350 And right now it's generating all of those. 415 00:33:11,350 --> 00:33:14,310 It's going, you know, it's 36 of them and it's very fast. 416 00:33:14,570 --> 00:33:20,010 Of course, this can vary from application to application and whatever the attack surface supports. 417 00:33:20,250 --> 00:33:24,410 And also at the same time, it's going to write it all to file. 418 00:33:24,410 --> 00:33:27,830 So obviously you don't want to copy and paste from a command console. 419 00:33:27,830 --> 00:33:30,390 So you can take one of them and make use of it. 420 00:33:30,390 --> 00:33:33,250 So a very effective tool. 421 00:33:34,590 --> 00:33:39,850 So the disclosure timeline for Microsoft discloses April 15th. 422 00:33:39,850 --> 00:33:41,690 I reported it to them. 423 00:33:41,690 --> 00:33:43,170 May 2024. 424 00:33:45,290 --> 00:33:49,590 Microsoft acknowledges the validity, decides to do nothing. 425 00:33:49,590 --> 00:33:50,930 That's kind of unfortunate. 426 00:33:51,690 --> 00:33:57,150 Microsoft in July, they asked to meet during Black Hat and then later I do meet with them. 427 00:33:57,150 --> 00:33:59,130 Today I'm releasing the tool. 428 00:34:01,270 --> 00:34:08,170 So I got an email from Microsoft, May 1st, 2024. 429 00:34:08,170 --> 00:34:19,370 They claim the report is valid, but that they prioritize vulnerabilities that are assessed as important, critical severities for immediate servicing. 430 00:34:19,470 --> 00:34:26,770 They don't consider an ASL bypass to be relevant if it doesn't cross a security boundary. 431 00:34:26,770 --> 00:34:33,550 What that means is the fact that it relies on a preexisting vulnerability. 432 00:34:36,050 --> 00:34:37,690 You know, but that is true. 433 00:34:37,690 --> 00:34:43,050 But the goal of this is to be a multiplier or an enhancer. 434 00:34:43,530 --> 00:34:57,290 And in terms of the patch history for Microsoft, we see that in 2013 there was another ASL bypass that was making use of some readily available address. 435 00:34:57,290 --> 00:35:04,250 And it was disclosed publicly, not to them, but Microsoft did actually fix that. 436 00:35:04,250 --> 00:35:07,250 This has been reported in April 2024. 437 00:35:07,250 --> 00:35:08,390 They have not fixed it. 438 00:35:08,390 --> 00:35:11,710 They have not shown any interest in fixing it, unfortunately. 439 00:35:12,190 --> 00:35:16,610 It's sad that they don't care, but I guess that's the reality. 440 00:35:17,150 --> 00:35:18,970 So some context for them. 441 00:35:19,910 --> 00:35:22,810 Invited me to meet with them on July 11th. 442 00:35:23,390 --> 00:35:30,190 I didn't acknowledge them for a couple weeks, but eventually I did agree to meet with them on the 22nd of July. 443 00:35:30,530 --> 00:35:36,250 I got another detailed email on the 30th of July asking for detailed information. 444 00:35:36,250 --> 00:35:45,110 My response was, can you provide me more information on why you decided to pay $0 for the bypass? 445 00:35:45,110 --> 00:35:50,590 And my whole purpose of doing this was to hopefully obtain a bug bounty. 446 00:35:51,010 --> 00:35:56,110 I didn't get a response, but I did get a response in person when I did meet with them. 447 00:35:56,110 --> 00:36:00,870 So they did ask to meet and I met them on August 7th. 448 00:36:00,870 --> 00:36:05,090 We spoke about 50 minutes in detail regarding the case. 449 00:36:08,370 --> 00:36:19,870 One of their issues was they wondered how they could change the scope so that if somebody like me wanted to do an ASR bypass, then they would have legitimate grounds to not pay it. 450 00:36:19,870 --> 00:36:27,690 My thinking was you have your scope clearly defined on the website and I followed that. 451 00:36:27,690 --> 00:36:38,990 I looked very closely at what was in scope, what was out of scope, and I think it would be better to honor their pre-existing scope, but I think that they had other ideas, which is fine. 452 00:36:39,010 --> 00:36:40,510 It's their choice. 453 00:36:42,690 --> 00:37:02,170 They mentioned in 2013 there was a post they made where they said, you know what, we had this vulnerability, which is the same vulnerability we talked about a moment ago, and we already knew about it, but if that person had reported that to us, that would have been really cool. 454 00:37:02,170 --> 00:37:05,590 We could have then given them a bug bounty, but they didn't. 455 00:37:05,590 --> 00:37:09,330 By the way, you should go and submit your vulnerabilities to us. 456 00:37:09,570 --> 00:37:21,930 So it's disappointing that they make statements like that and then they publicly contradict their kind of general stance on that. 457 00:37:22,910 --> 00:37:29,850 But in any case, they decided not to do that. 458 00:37:30,660 --> 00:37:35,630 Why does this matter for Windows malware? 459 00:37:35,930 --> 00:37:40,490 So we could go much further beyond simply what we have been talking about. 460 00:37:40,670 --> 00:37:52,310 So if you were to go and fix this for ASLR, that would be great, that would be cool, but it would be much more hugely impactful for the malware ecosystem in general. 461 00:37:52,310 --> 00:38:04,190 What that would mean is a lot of malware will utilize some of these pebwalking techniques in order to then go much further and dynamically resolve runtime addresses. 462 00:38:04,330 --> 00:38:09,530 And by doing that, you can kind of hide and conceal what you are doing. 463 00:38:09,590 --> 00:38:20,530 So if we were to fix that, then that would break it so that much of the current existing malware simply would not work. 464 00:38:20,710 --> 00:38:22,290 It could work. 465 00:38:23,570 --> 00:38:27,590 In that case, you would have to use normal imports. 466 00:38:27,810 --> 00:38:31,930 That's something that could be easily detected from a static analysis standpoint. 467 00:38:31,930 --> 00:38:34,590 A tool like PA Studio could easily enumerate that. 468 00:38:34,590 --> 00:38:37,750 You could also do things like getprocaddress , a little library. 469 00:38:37,950 --> 00:38:43,050 And those are also very easily detectable things from a static analysis standpoint. 470 00:38:43,050 --> 00:38:56,950 So fixing this for ASLR would be much more hugely impactful in terms of securing the enterprise or securing just any Microsoft computer from the threat of malware. 471 00:38:58,910 --> 00:39:17,350 Forcing attackers to make their malicious functionality very obvious because if they were to resolve it by using techniques like pebwalking and then traversing later on the PE file format, those are things that are not easy to be detected from a static analysis standpoint. 472 00:39:17,350 --> 00:39:23,870 You would have to drop it in a sandbox or do some type of dynamic execution. 473 00:39:24,310 --> 00:39:30,750 So a massive, hugely impactful gain for defenders. 474 00:39:30,750 --> 00:39:33,430 But I guess that's not important to them. 475 00:39:33,430 --> 00:39:46,030 Another alternative for them going in an opposite direction is it could force them to use Windows syscalls to then more, to obscure their activities. 476 00:39:46,030 --> 00:39:49,630 Now, syscalls can be much more challenging to utilize. 477 00:39:49,630 --> 00:39:51,170 They're a lot more complicated. 478 00:39:51,790 --> 00:39:58,130 It's not something that every malware author would be able to do just because of the complexity of that. 479 00:39:59,370 --> 00:40:04,730 And some functionality that could be easily implemented via Windows APIs. 480 00:40:04,850 --> 00:40:09,030 The same thing may not be true necessarily for Windows syscalls. 481 00:40:09,590 --> 00:40:12,990 So either way, it would be a huge win. 482 00:40:12,990 --> 00:40:23,370 So some takeaways here is we have these existing structures, the peb, the modulus. 483 00:40:23,690 --> 00:40:26,790 These have been a single point of failure. 484 00:40:26,790 --> 00:40:30,870 They've been existing in this form for decades. 485 00:40:31,370 --> 00:40:36,350 And, you know, it's an inherent design flaw and it should have been corrected a long time ago. 486 00:40:36,350 --> 00:40:39,130 But unfortunately it has not. 487 00:40:39,130 --> 00:41:02,530 And so we've seen how we could take this general approach to peb walking and then apply that to ROP to make it much more simple, basic, where we can use a few easy to find gadgets, even the same ones over and over again, to achieve it in a relatively simple way. 488 00:41:02,530 --> 00:41:09,170 And how we can even take that and then automate that with a tool so you can accomplish that in seconds. 489 00:41:09,170 --> 00:41:17,290 You could maybe have 30 seconds and then you have 36 different approaches of bypassing ASLR. 490 00:41:17,330 --> 00:41:19,730 So it would be great if Microsoft would patch it. 491 00:41:19,730 --> 00:41:22,210 They've really shown no interest in doing so. 492 00:41:22,210 --> 00:41:25,130 And it's not really something that could be achieved with a patch. 493 00:41:25,130 --> 00:41:29,550 It would need to be more of an architectural lift. 494 00:41:29,550 --> 00:41:47,830 But if they were to do that, it would defend against ASLR and also a lot of malware that's currently existing that's native CC++ compiled would no longer work and force the attackers to implement that malicious functionality in a different way. 495 00:41:47,830 --> 00:41:52,490 Unfortunately, you know, Microsoft does not care. 496 00:41:52,490 --> 00:41:53,670 They've made that clear. 497 00:41:54,970 --> 00:42:04,270 But maybe someday in the distant future, we may see a more responsible approach that can preclude some of these attacks. 498 00:42:04,270 --> 00:42:08,290 But I don't see that on the horizon for the immediate future. 499 00:42:08,990 --> 00:42:10,790 So with that, I'd like to thank you. 500 00:42:10,950 --> 00:42:13,250 DEF CON is an incredible place. 501 00:42:13,850 --> 00:42:15,750 Very, very special place. 502 00:42:15,750 --> 00:42:17,810 And thank you for coming to my talk. 503 00:42:17,810 --> 00:42:21,410 But more importantly, thank you to all of you for coming to DEF CON. 504 00:42:21,710 --> 00:42:23,190 Feel free to contact me. 505 00:42:23,190 --> 00:42:24,070 You can email me. 506 00:42:24,070 --> 00:42:25,950 You can check me out on GitHub. 507 00:42:26,030 --> 00:42:28,010 The address of the tool is there. 508 00:42:28,070 --> 00:42:32,690 Feel free to add me on LinkedIn or make contact, however you like. 509 00:42:32,890 --> 00:42:34,630 I won't take any questions now. 510 00:42:34,630 --> 00:42:39,010 But I'll step to the front there and then possibly outside. 511 00:42:39,010 --> 00:42:41,350 So feel free to come and chat with me. 512 00:42:41,390 --> 00:42:42,830 And thank you very much.