1 00:00:00,000 --> 00:00:02,040 Good morning DEF CON. 2 00:00:02,800 --> 00:00:08,900 I'm Vanish and I hope you are awake and you didn't party too much yesterday. 3 00:00:09,620 --> 00:00:22,840 And I'm here just to ruin your fate in Linux, in a subsystem, in a Linux subsystem that usually you think it's secure. 4 00:00:24,560 --> 00:00:33,700 When most people think about ABPF, they think observability, they think networking. 5 00:00:34,360 --> 00:00:37,120 I think Ring Zero Playground. 6 00:00:37,680 --> 00:00:55,080 Today we are going to systematically fuzz and analyze ABPF subsystems and I'm going to show you exactly how to turn the world's most trusted sandbox into your personal kernel backdoor. 7 00:00:55,540 --> 00:00:57,120 That's the idea. 8 00:00:58,620 --> 00:01:04,480 It is what we are going to accomplish in the next 45 minutes almost. 9 00:01:04,500 --> 00:01:11,740 First I show you why ABPF's attack surface is absolutely massive. 10 00:01:12,380 --> 00:01:17,020 And it's getting worse for every kernel update. 11 00:01:18,260 --> 00:01:22,280 Second, we'll dive into state-of-the-art fuzzing. 12 00:01:22,280 --> 00:01:28,360 The technique that actually work against modern ABPF subsystems. 13 00:01:28,360 --> 00:01:37,860 Third, I work it through the Leviathan, the framework that I'm presenting today, that it's a systematic exploitation framework. 14 00:01:38,320 --> 00:01:47,100 Fourth, and this is the fun part, we do live fuzzing and exploitation of ABPF subsystems. 15 00:01:47,120 --> 00:01:50,080 And finally, we'll talk about defense. 16 00:01:50,680 --> 00:01:56,060 Because someone has to clean up the mess that we are doing. 17 00:01:57,240 --> 00:02:03,140 But before we jump into the actual technical meat, let me introduce myself. 18 00:02:04,040 --> 00:02:05,580 I'm Agostino. 19 00:02:05,580 --> 00:02:07,120 I'm from Italy. 20 00:02:07,640 --> 00:02:08,940 This means two things. 21 00:02:08,940 --> 00:02:11,680 Sorry for my English, first thing. 22 00:02:11,680 --> 00:02:15,000 Second thing, I don't like pineapple on pizza. 23 00:02:16,180 --> 00:02:24,220 So just to be clear, I'm a security researcher with over 15 years of experience. 24 00:02:24,220 --> 00:02:34,820 I've done red teaming, instant response, reverse engineering and I'm currently working mostly on Windows and Linux kernel exploitation. 25 00:02:35,680 --> 00:02:40,920 I'm the author and the maintainer of the framework that I'm presenting today that is Leviathan. 26 00:02:40,920 --> 00:02:43,000 It is going to be open source. 27 00:02:43,580 --> 00:02:50,200 The VM dragon's layer framework that is being presented yesterday for VM protect samples. 28 00:02:50,200 --> 00:02:57,880 And I'm also maintaining a fork, actively maintaining a fork for the spider foot project. 29 00:02:58,720 --> 00:03:03,140 My research focus is actually everything that is weaponizable. 30 00:03:03,860 --> 00:03:07,120 And together with my three cats, we review code. 31 00:03:07,400 --> 00:03:15,440 When I'm not doing that, I actually love scuba diving because I love the exploration part. 32 00:03:16,800 --> 00:03:25,540 But let's talk why ABPF should terrify every security professional in this room. 33 00:03:26,140 --> 00:03:36,160 We are diving deep into the attack surface that most people completely ignore or totally misunderstand. 34 00:03:37,740 --> 00:03:41,620 ABPF started as a simple packet filter. 35 00:03:42,040 --> 00:03:44,880 Basically a fancy way to drop packets. 36 00:03:45,480 --> 00:03:54,600 Today it's a complete virtual machine running with ring zero privileges in every Linux kernel. 37 00:03:54,720 --> 00:04:03,520 It can access arbitrary kernel memory, manipulate system calls and hook into any kernel subsystem. 38 00:04:04,260 --> 00:04:06,700 And here is the beautiful part. 39 00:04:07,020 --> 00:04:11,260 It's marked as safe and sandboxed. 40 00:04:11,500 --> 00:04:22,520 Every major cloud provider, every container platform, every observability tool is built on top of ABPF nowadays. 41 00:04:23,980 --> 00:04:27,120 The security implications of this are massive. 42 00:04:27,520 --> 00:04:34,740 We are talking about ring zero execution with direct kernel memory access. 43 00:04:35,480 --> 00:04:45,800 ABPF programs can establish persistence that survives reboots, system updates and most forensic analysis. 44 00:04:45,800 --> 00:04:47,760 That's the worst part. 45 00:04:47,800 --> 00:04:55,400 They operate below hypervisor, below security monitoring, below everything. 46 00:04:56,160 --> 00:05:03,900 And the best part, this technology is shipped by default everywhere. 47 00:05:04,040 --> 00:05:06,080 Ubuntu, Red Hat, AlmaLinux. 48 00:05:06,080 --> 00:05:10,900 Every major Linux distribution is shipping ABPF and is enabling by default. 49 00:05:12,700 --> 00:05:17,620 Understanding the exploitation pipeline in this case is critical. 50 00:05:18,480 --> 00:05:22,500 Every ABPF program follow this path usually. 51 00:05:22,760 --> 00:05:34,460 User program that goes to the ABPF bytecodes that goes to the verifier that goes just in time compiler and you have kernel execution. 52 00:05:34,980 --> 00:05:39,800 Each stage is a potential attack vector. 53 00:05:40,560 --> 00:05:49,860 At program construction we craft malicious bytecode designed to trigger the verifier edge case. 54 00:05:50,400 --> 00:05:59,380 During verification we can exploit bound checking errors, type confusion bugs and state tracking failure. 55 00:06:00,420 --> 00:06:12,680 JIT compilation gives us architecture specific vulnerabilities because we can run that on x86 R and RISC-V. 56 00:06:13,060 --> 00:06:20,760 Finally kernel execution provides arbitrary memory access and privilege escalation. 57 00:06:20,760 --> 00:06:23,440 That's the complete path that we can follow. 58 00:06:25,240 --> 00:06:27,280 Let's start with the verifier. 59 00:06:27,600 --> 00:06:29,920 The verifier is our primary target. 60 00:06:30,920 --> 00:06:37,040 And I have to be honest, it's one of the most beautiful piece of code that I have ever seen. 61 00:06:37,040 --> 00:06:42,860 It's almost 15,000 lines of C code that is really complex. 62 00:06:42,900 --> 00:06:47,240 And I think that they spend a lot of time going through that because it's really amazing. 63 00:06:47,240 --> 00:06:50,100 If you want to learn C that's the way to go. 64 00:06:53,480 --> 00:07:02,520 The verifier is actually trying to prove that arbitrary user programs are safe to run in the kernel. 65 00:07:02,880 --> 00:07:04,700 But there is the kicker. 66 00:07:05,800 --> 00:07:14,600 Analyzing it, what I've done, I cataloged over 200 interesting patterns in this code. 67 00:07:15,280 --> 00:07:31,440 We are talking about specific function that can lead to integer over four patterns, type confusion, state corruption vectors, loop bound verification bypass and stack base overflow. 68 00:07:33,700 --> 00:07:39,780 I started doing this analyzing the history of the vulnerability on a BPF. 69 00:07:39,880 --> 00:07:42,140 So I started from the past. 70 00:07:42,140 --> 00:07:48,660 I analyzed different CVs from 2020, 2021, 2022 and later on. 71 00:07:49,040 --> 00:07:53,840 Trying to find a way to have a pattern recognition. 72 00:07:54,540 --> 00:08:00,140 So to systematically find similar bugs inside the verifier. 73 00:08:00,460 --> 00:08:04,200 The pattern in this case is clear. 74 00:08:04,360 --> 00:08:11,220 Verifier complexity equals explorability. 75 00:08:12,220 --> 00:08:17,100 Every new BPF feature increased the attack surface. 76 00:08:19,020 --> 00:08:29,600 Based on this I started generating a framework detection signature that is part of the Leviathan framework . 77 00:08:29,800 --> 00:08:33,820 Let me show you some of the actual pattern that I'm using. 78 00:08:34,360 --> 00:08:44,860 I'm sharing pattern 47 for instance that show bound confusion in range tracking using specific BPF instruction that trigger integer overflow. 79 00:08:45,300 --> 00:08:57,700 The pattern 73 for instance demonstrate type confusion via other arguments where we can exploit the verifier failure to properly track the pointer type. 80 00:08:57,700 --> 00:08:59,040 And then we have also other patterns. 81 00:08:59,040 --> 00:09:01,300 There are more than 200 of them. 82 00:09:02,640 --> 00:09:04,660 These are just usable. 83 00:09:07,380 --> 00:09:15,880 JIT compilation vulnerabilities are particularly nasty because they are architecture specific. 84 00:09:16,500 --> 00:09:24,160 The same BPF byte code can trigger different vulnerabilities on different architecture. 85 00:09:24,820 --> 00:09:37,480 We are talking about specific functional level bugs, instruction encoding issue, optimization bugs, branch prediction problems, macro speculation bugs and so on. 86 00:09:37,480 --> 00:09:42,820 These give us multiple attack vectors in this vulnerability class. 87 00:09:45,780 --> 00:09:52,620 Our exploitation strategies leverage this architectural difference. 88 00:09:53,920 --> 00:10:01,460 Translation bugs occur when the same BPF byte code generate vulnerable machine code on specific architecture. 89 00:10:01,500 --> 00:10:07,660 Optimization error happens when performance improvement breaks security guarantee. 90 00:10:08,200 --> 00:10:13,740 Platform specific attacks target architecture dependent speculation. 91 00:10:14,620 --> 00:10:17,660 Branch prediction or instruction encoding. 92 00:10:17,660 --> 00:10:22,500 Those are some of the things that we are working on. 93 00:10:23,660 --> 00:10:30,160 The cross platform research help us find vulnerability pattern that works across multiple JIT. 94 00:10:30,160 --> 00:10:32,480 So multiple just-in-time compilers. 95 00:10:33,400 --> 00:10:34,860 It's not just one exploit. 96 00:10:34,860 --> 00:10:37,140 It's an exploit family completely. 97 00:10:37,380 --> 00:10:40,140 From one exploit, for instance, you can get four. 98 00:10:42,280 --> 00:10:45,240 And then we get the ABPF maps. 99 00:10:45,240 --> 00:10:51,300 The ABPF maps provide persistent storage and inter-program communication. 100 00:10:51,640 --> 00:10:57,000 But they are also a massive attack vector. 101 00:10:57,860 --> 00:11:03,200 Hash maps may suffer from collision attacks and time inside channels. 102 00:11:03,940 --> 00:11:08,740 Arrays have bound checking issue sometimes. 103 00:11:08,860 --> 00:11:11,540 And integer overflow vulnerabilities. 104 00:11:11,540 --> 00:11:19,880 LRU maps can enable cache timing attacks and memory pressure exploitation. 105 00:11:19,880 --> 00:11:25,140 And we have also other per CPU maps, stack trace maps and so on. 106 00:11:26,760 --> 00:11:30,760 But the real fun starts with the shared state management. 107 00:11:31,660 --> 00:11:36,740 ABPF maps enable race condition between programs. 108 00:11:36,760 --> 00:11:43,000 Synchronization bypass, memory management attacks via map operations. 109 00:11:43,120 --> 00:11:51,300 Information leakage through access patterns and performance versus security trade-off in which the performance always wins. 110 00:11:52,340 --> 00:11:57,740 Modern kernels have hundreds of map operations. 111 00:11:58,020 --> 00:12:02,560 And each one with a different security property. 112 00:12:03,360 --> 00:12:07,520 It's a race condition gold mine if you look at it. 113 00:12:08,960 --> 00:12:11,920 But let's now check the helpers. 114 00:12:11,920 --> 00:12:21,140 The ABPF helper function are the interface between the ABPF program and the kernel functionality. 115 00:12:21,280 --> 00:12:29,020 There are over 200 helper functions that have kernel privileges. 116 00:12:30,000 --> 00:12:34,760 Network helper enable manipulation for instance. 117 00:12:34,760 --> 00:12:42,800 File system helper provide the exploitation vector. 118 00:12:42,800 --> 00:12:50,840 The crypto helpers can help you understand and manage the crypto operations. 119 00:12:52,700 --> 00:12:59,460 Tracing helpers can give you some information that are leaked from the process itself. 120 00:12:59,880 --> 00:13:03,460 Each helper function is a potential privilege escalation vector. 121 00:13:04,260 --> 00:13:09,600 We are just setting up and understanding what's the attack surface of ABPF. 122 00:13:11,890 --> 00:13:16,330 Helper function exploitation focuses on validation bypass technique. 123 00:13:16,570 --> 00:13:22,330 Input sanitization failure allow malforming data to reach kernel APIs. 124 00:13:23,610 --> 00:13:26,750 We can have parameter confusion. 125 00:13:27,510 --> 00:13:31,210 We can have privilege boundary violation and so on. 126 00:13:31,290 --> 00:13:34,790 We can have also side channel exploitation in this case. 127 00:13:37,110 --> 00:13:41,850 The point is this is the attack surface. 128 00:13:42,590 --> 00:13:47,430 Traditional fuzzing doesn't work against ABPF. 129 00:13:47,930 --> 00:13:53,810 Because the verifier is smart and it's too smart for the traditional fuzzing. 130 00:13:54,750 --> 00:13:57,230 Random mutation gets blocked immediately. 131 00:13:57,230 --> 00:14:09,730 So I noticed that 99.99 percent of the request or the program generated with random mutation gets blocked. 132 00:14:12,290 --> 00:14:18,190 All the valid programs get rejected before reaching the verifier box. 133 00:14:18,870 --> 00:14:25,330 There is no coverage of complex state tracking vulnerabilities and we just waste the source. 134 00:14:27,050 --> 00:14:32,050 Static analysis in this case is equally useless. 135 00:14:32,890 --> 00:14:38,210 It cannot model the verifier complex state machine behavior. 136 00:14:38,770 --> 00:14:45,830 We get path explosion in interprocedural analysis with ABPF semantics. 137 00:14:46,490 --> 00:14:52,450 Just the existing tool lack the ABPF specific vulnerability patterns. 138 00:14:52,450 --> 00:14:54,250 That's one of the issues. 139 00:14:54,630 --> 00:14:59,870 The complexity is just why for the traditional approach. 140 00:15:01,670 --> 00:15:04,650 Manual analysis doesn't scale either. 141 00:15:04,850 --> 00:15:13,450 You need deep expertise across verifier, JIT, helper subsystems and it takes months per vulnerability. 142 00:15:13,910 --> 00:15:18,670 And you simply cannot keep pace with the rapid ABPF subsystem evolution. 143 00:15:18,670 --> 00:15:23,430 So we need something that is smarter and is faster. 144 00:15:25,350 --> 00:15:32,530 Because the kernel developers are adding new features faster than the manual researcher can analyze them. 145 00:15:35,220 --> 00:15:44,700 So the fundamental problem that I found during the analysis of ABPF is the missing state awareness. 146 00:15:45,380 --> 00:15:48,920 Traditional tools don't understand verified internal state tracking. 147 00:15:48,920 --> 00:15:55,660 They cannot target specific vulnerability class like bound calculation errors for instance. 148 00:15:55,760 --> 00:15:59,920 And there is no systematic approach to JIT compiler. 149 00:15:59,920 --> 00:16:01,580 I didn't find it. 150 00:16:02,780 --> 00:16:06,200 That's why we need something else. 151 00:16:06,860 --> 00:16:21,160 And this brings to the part two of the talk in which we describe a little bit the methodology and the framework that are developed to overcome this limitation. 152 00:16:24,780 --> 00:16:27,600 This is the key innovation of the framework. 153 00:16:27,600 --> 00:16:37,360 Instead of generating random programs, we generate programs that specifically target no vulnerability class in the verified state tracking. 154 00:16:38,060 --> 00:16:41,100 Bound calculation and type confusion logic. 155 00:16:41,100 --> 00:16:43,780 So we specifically generate those. 156 00:16:44,360 --> 00:16:49,880 This is a surgical precision against a complex state machine. 157 00:16:51,660 --> 00:16:54,380 And let me introduce you to the Leviathan. 158 00:16:55,060 --> 00:17:08,060 The Leviathan framework will be open source by the end of the month for some disclosure issues. 159 00:17:09,060 --> 00:17:18,860 But so far it's something that I'm trying to share open source with the entire community. 160 00:17:20,100 --> 00:17:25,500 We have a verified state tracking with advanced state machine analysis for bug discovery. 161 00:17:25,500 --> 00:17:27,200 This is one of the features. 162 00:17:27,200 --> 00:17:37,640 We have bound calculation and expectation covers verified errors into arbitrary primitives. 163 00:17:37,640 --> 00:17:44,820 We have bypass technique that can leverage information leakage. 164 00:17:44,920 --> 00:17:53,800 And we have chains completely built that go from memory corruption to full compromise. 165 00:17:54,620 --> 00:17:58,760 Multi architecture just in time compiler. 166 00:17:58,760 --> 00:18:05,320 Bugs checking across all the platform that are enabled in ABPF. 167 00:18:06,040 --> 00:18:12,460 And helper function validation bypass that can provide API level security convention. 168 00:18:14,400 --> 00:18:21,080 Let me give you some of the specific algorithm that has been implemented here. 169 00:18:21,580 --> 00:18:31,760 We have a coverage guided fuzzing that can achieve almost 90 percent of basic block coverage potentially. 170 00:18:32,740 --> 00:18:39,440 Differential fuzzing enables cross kernel version bug discovery. 171 00:18:40,040 --> 00:18:45,580 We have a neural guided fuzzing that provide machine learning driven program generation. 172 00:18:45,580 --> 00:18:50,020 So the entire program generator are machine learning generated. 173 00:18:50,020 --> 00:18:51,560 Not LLM. 174 00:18:53,560 --> 00:18:55,640 The old style machine learning. 175 00:18:56,200 --> 00:19:00,080 Semantic aware fuzzing using target verifier. 176 00:19:00,080 --> 00:19:01,820 Verified state model. 177 00:19:02,260 --> 00:19:06,520 And edge guided fuzzing optimize control flow exploration. 178 00:19:06,520 --> 00:19:07,860 That's the idea. 179 00:19:10,060 --> 00:19:15,520 We convert the verified bypass into arbitrary primitives. 180 00:19:16,260 --> 00:19:22,280 We use targeted information leaks for KSLR bypass and kernel based discovery. 181 00:19:23,060 --> 00:19:29,240 We employ heap grooming and kernel object manipulation for memory corruption chains. 182 00:19:29,460 --> 00:19:37,580 And we develop cross architecture reliability so our exploit techniques works across platform. 183 00:19:39,140 --> 00:19:41,800 That's why we focus on reliability. 184 00:19:41,800 --> 00:19:50,500 So the exploit can work consistently across kernel versions and are more stable. 185 00:19:51,580 --> 00:19:59,960 We do multistage validation because we test or you can test using the framework across all the kernel version directly. 186 00:20:02,200 --> 00:20:03,820 These are some metrics. 187 00:20:04,040 --> 00:20:06,980 Here the real performance number. 188 00:20:06,980 --> 00:20:16,960 In 24 hours we can generate roughly 2 million programs that are compilable. 189 00:20:20,040 --> 00:20:39,260 We achieve over almost 70 percent of basic block coverage and edge coverage during the four weeks of the first run of the framework. 190 00:20:41,160 --> 00:20:55,000 So we cover also the architecture but all the specific architecture from x86 to ARM to RISC-V and power PC with roughly a decent amount of percentage. 191 00:20:57,100 --> 00:21:02,840 Let's do a technical deep dive on some of the exploitation technique that we have. 192 00:21:03,440 --> 00:21:07,340 Let me show you the real bound calculation vulnerability pattern. 193 00:21:07,600 --> 00:21:12,680 The verifier bound calculation logic here is vulnerable to an integer overflow. 194 00:21:13,680 --> 00:21:18,720 That is vulnerable as an integer overflow can occur during the range validation. 195 00:21:19,580 --> 00:21:24,320 This simplified code shows how the verifier check conditions. 196 00:21:24,900 --> 00:21:29,300 But integer overflow can make this check pass when it shouldn't. 197 00:21:29,300 --> 00:21:33,300 This is one of the possible vulnerabilities you can have. 198 00:21:33,340 --> 00:21:35,000 But how we exploit it? 199 00:21:35,000 --> 00:21:38,360 It is how we can exploit this. 200 00:21:38,400 --> 00:21:42,520 We craft specific ABPF program to trigger overflow. 201 00:21:42,900 --> 00:21:48,740 We set the condition then in this case specific case we set the offset to 200. 202 00:21:48,740 --> 00:21:54,460 The result is an overflow that bypassed the bound check giving us arbitrary memory access. 203 00:21:55,200 --> 00:21:59,320 This specific instruction sequence triggered the vulnerability reliably. 204 00:21:59,420 --> 00:22:01,540 That's one of the key points. 205 00:22:02,180 --> 00:22:08,880 From this bound bypass we develop the exploitation primitives. 206 00:22:09,420 --> 00:22:13,920 We manipulate the verifier state to achieve control and memory offsets. 207 00:22:14,020 --> 00:22:19,580 We convert the bound bypass into reliable memory disclosure for arbitrary reads. 208 00:22:20,220 --> 00:22:26,860 And we extend the technique for control and memory corruption to get arbitrary memory writes. 209 00:22:28,660 --> 00:22:35,940 We use the information disclosure for the KSLR bypass and the kernel based discovery. 210 00:22:35,960 --> 00:22:39,780 This is the fundamental for a full privilege escalation. 211 00:22:42,730 --> 00:22:56,250 The second type of bugs that I'm showing you is the type of confusion attack that exploit the verifier type tracking across different code paths. 212 00:22:57,350 --> 00:23:03,870 Here is a simplified example of the verified code. 213 00:23:04,010 --> 00:23:14,670 And you can see here that the verified has two paths and it can be confused looking for one path or another based on the condition. 214 00:23:17,110 --> 00:23:23,990 In this particular bug class we have four main type confusion exploitation categories. 215 00:23:25,250 --> 00:23:31,050 Point and integer confusion treats pointer values as integer for arithmetic operation. 216 00:23:32,150 --> 00:23:34,190 Map type confusion access. 217 00:23:35,030 --> 00:23:41,530 And we have contest type error and cross path type issue in this case. 218 00:23:43,510 --> 00:23:51,550 Using these primitives we craft program that confuse the verifier type taking through the state manipulation. 219 00:23:52,090 --> 00:23:57,630 We exploit type inconsistencies during contest switching. 220 00:23:58,250 --> 00:24:03,310 And we use type confusion to access restricted helper function. 221 00:24:03,410 --> 00:24:05,810 That's one of the key point. 222 00:24:06,490 --> 00:24:10,810 And we leverage type confusion from memory layout attacks and corruption. 223 00:24:11,790 --> 00:24:15,510 This way we have multiple paths to kernel compromise. 224 00:24:17,010 --> 00:24:19,350 Let's talk a little bit about the JIT. 225 00:24:19,390 --> 00:24:26,050 Our JIT compiler exploitation engine targets multiple architectures systematically. 226 00:24:26,050 --> 00:24:34,710 We can target x86, JIT bugs, ARM, MIPS, RISC 5, power PC and so on. 227 00:24:35,090 --> 00:24:41,450 The framework automatically analyzes the compilation across different architecture type. 228 00:24:42,330 --> 00:24:45,610 To find platform specific vulnerabilities. 229 00:24:47,690 --> 00:24:50,610 But let's go to the fun part. 230 00:24:51,830 --> 00:24:55,570 Let's check how the framework works. 231 00:24:59,780 --> 00:25:03,720 First of all, wait, let me open it. 232 00:25:12,940 --> 00:25:17,040 Now this is the first run in which we do fuzzing. 233 00:25:17,040 --> 00:25:18,300 Just fuzzing. 234 00:25:19,680 --> 00:25:25,240 And these are against a vulnerable machine by design. 235 00:25:25,440 --> 00:25:28,440 Because we just make the point across for the demo. 236 00:25:29,080 --> 00:25:40,060 We load up old machine learning models and we integrate them inside the platform. 237 00:25:41,920 --> 00:25:46,880 We have a bunch of pattern categories and we start the fuzzing. 238 00:25:47,360 --> 00:25:54,380 In this case, we are just generating a few programs just then for the sake of the demo. 239 00:25:55,560 --> 00:26:08,300 Those programs are designed to exploit some of the patterns found in the database based on the machine that the system is analyzing. 240 00:26:13,510 --> 00:26:24,710 It generates ten samples in this case, but over those ten samples, for him, just six were actual vulnerability. 241 00:26:25,570 --> 00:26:28,190 So we have a 60% success rate. 242 00:26:28,330 --> 00:26:43,430 At this point he tried to compile it and see if they work on the system because the platform is monitoring the entire kernel to see if he gets a crash condition. 243 00:26:45,710 --> 00:26:49,710 And he starts to analyze the entire framework. 244 00:26:50,430 --> 00:27:09,310 He starts to analyze the machine behavior and we just find out that among those six just three were actual vulnerability. 245 00:27:09,950 --> 00:27:12,550 This is just by design. 246 00:27:12,550 --> 00:27:19,090 This is just something that was planned for the demo, but it works beautifully on every machine. 247 00:27:19,790 --> 00:27:27,110 So if you have a vulnerable machine, this just generates a C code that is a POC to get the vulnerability tested. 248 00:27:28,350 --> 00:27:37,250 But that's not the unique, you can have also other nice feature here. 249 00:27:38,010 --> 00:27:48,190 One of the feature you can have, actually the framework can analyze ABPF programs that interact, that should interact with ABPF. 250 00:27:48,390 --> 00:27:51,350 So let's make point across. 251 00:27:51,390 --> 00:27:58,270 For instance, you have Calico, you have Cilium, you have this kind of program that interact with ABPF. 252 00:27:58,270 --> 00:28:00,630 All those programs can be analyzed with the framework. 253 00:28:00,630 --> 00:28:04,050 So all ABPF systems can be analyzed directly. 254 00:28:05,050 --> 00:28:17,090 And you are analyzing them using dynamic train tracking and symbolic execution to help guide the analysis of the framework over those specific samples. 255 00:28:17,730 --> 00:28:21,430 In this case, we just have a bound checker. 256 00:28:21,430 --> 00:28:22,390 That's it. 257 00:28:25,760 --> 00:28:27,880 And the framework is analyzing it. 258 00:28:29,320 --> 00:28:32,920 And it found a bunch of path that it can follow. 259 00:28:35,140 --> 00:28:37,980 It starts solving constraint with Zeta 3. 260 00:28:39,520 --> 00:28:43,520 And you can actually check. 261 00:28:43,520 --> 00:28:46,840 And after the result with Zeta 3, it starts the taint. 262 00:28:47,940 --> 00:29:00,180 When you finish up with the taint, it mixes up all the results and analyze them using the machine learning models to see if the ABPF software is actually vulnerable. 263 00:29:01,920 --> 00:29:10,160 In this case, for this specific example, we just have three vulnerabilities found. 264 00:29:10,600 --> 00:29:18,120 Two high confidence and one is medium for the sake of the demo. 265 00:29:20,980 --> 00:29:22,740 But that's not it. 266 00:29:23,960 --> 00:29:28,880 The framework is able to do the complete exploitation chain. 267 00:29:29,200 --> 00:29:33,880 So it starts from the fuzzing that we have done in the first demo. 268 00:29:33,960 --> 00:29:41,760 It took the three vulnerability found and it generated the primitives from that. 269 00:29:44,240 --> 00:29:52,160 It starts analyzing it and using the machine learning models, it tried to weaponize it directly. 270 00:29:53,440 --> 00:30:01,940 So you can have C code after this stage that is actually pretty complete. 271 00:30:03,200 --> 00:30:11,220 And you can, interacting with the framework, you can actually test the exploits on different platforms. 272 00:30:11,220 --> 00:30:15,880 In this case, I just had a bunch of machines to test it on. 273 00:30:15,880 --> 00:30:21,620 It's connecting over those machines and testing if the exploit works. 274 00:30:21,620 --> 00:30:24,560 The entire chain works over those machines. 275 00:30:25,500 --> 00:30:29,160 And it come out with an average success rate. 276 00:30:29,160 --> 00:30:35,300 In this case, we have roughly 90 percent of success rate for the exploits. 277 00:30:53,890 --> 00:30:58,250 So what we have seen so far. 278 00:30:59,370 --> 00:31:04,110 What we have seen is a state of fuzzing targeting specific verifier. 279 00:31:04,630 --> 00:31:06,330 Vulnerability classes. 280 00:31:06,390 --> 00:31:14,450 For instance, what we have seen in the first three vulnerabilities that we found. 281 00:31:14,990 --> 00:31:23,030 We are doing live verified bypass discovering in bound calculation logic. 282 00:31:24,490 --> 00:31:34,610 We have seen the complete development of the exploit and also the fact that we can analyze an ABPF system directly with the framework. 283 00:31:34,610 --> 00:31:37,470 An ABPF program directly with the framework. 284 00:31:38,270 --> 00:31:49,390 That can give us some insight on pre-escalation and actually we can get some juicy CV if you would like to see that way. 285 00:31:51,290 --> 00:31:55,270 But let's talk about some defensive recommendation. 286 00:31:56,590 --> 00:32:02,550 I would like to highlight the run time protection that you can have. 287 00:32:02,550 --> 00:32:10,750 The run time protection requires an input validation and capability restriction. 288 00:32:11,890 --> 00:32:15,150 For all the function in the outputs. 289 00:32:15,150 --> 00:32:17,250 So that's something that you need to monitor. 290 00:32:18,270 --> 00:32:31,690 You need to have real time detection of the exploitation attempts on the ABPF subsystem and you need to monitor a little bit better with the auditing the system a little bit better. 291 00:32:31,690 --> 00:32:41,310 Because so far what I have seen is that with ABPF a lot of people trust it and they just don't check the logs of ABPF. 292 00:32:41,310 --> 00:32:43,970 They just don't audit ABPF. 293 00:32:43,970 --> 00:32:50,830 But ABPF can be easily exploited and abused. 294 00:32:53,560 --> 00:32:59,660 So what's the future of the framework? 295 00:33:00,300 --> 00:33:10,800 From a future research direction I'm going to develop more on state modeling using machine learning. 296 00:33:11,820 --> 00:33:15,180 Cross component analysis mostly. 297 00:33:16,180 --> 00:33:24,880 I try to provide formal verification for some parts in particular for the quantum in the post quantum crypto. 298 00:33:25,500 --> 00:33:29,420 And also hardware integration. 299 00:33:29,580 --> 00:33:32,560 But there is something that is really juicy here. 300 00:33:35,160 --> 00:33:37,280 Windows is accepting. 301 00:33:37,280 --> 00:33:42,660 It starts to work on ABPF integration. 302 00:33:43,840 --> 00:33:49,600 Means that we have another attack surface that we can use. 303 00:33:50,700 --> 00:33:57,560 And this is the actual scheme of the ABPF subsystem that Windows is implementing. 304 00:33:57,560 --> 00:34:01,820 It's a little bit different compared to Linux. 305 00:34:02,820 --> 00:34:16,780 But in this case, as you can see from the slides, we have an alternative way to interact with the kernel in a Windows environment using ABPF. 306 00:34:16,780 --> 00:34:22,080 That's something that should scare you from a certain perspective. 307 00:34:22,080 --> 00:34:24,680 But it's a new research opportunity. 308 00:34:26,820 --> 00:34:30,520 So let me conclude with some key takeaways. 309 00:34:32,540 --> 00:34:42,120 We develop state of the world methodologies that provide a good improvement in vulnerability discovery efficiency. 310 00:34:43,660 --> 00:34:47,400 The systematic exploitation framework is Leviathan. 311 00:34:47,400 --> 00:34:54,280 Enable reliable exploitation chain usually in a decent amount of cases. 312 00:34:56,500 --> 00:34:59,700 And we also have some ordering recommendation . 313 00:34:59,700 --> 00:35:04,680 You need to monitor it more and you need to check the usage of ABPF. 314 00:35:06,800 --> 00:35:13,800 That concludes our journey to ABPF exploitation chains. 315 00:35:14,620 --> 00:35:23,040 And the framework will be open source, will be shared at the end of the August. 316 00:35:23,900 --> 00:35:34,100 Because from the frameworks came out during the first run roughly half a dozen CVE on ABPF subsystem. 317 00:35:34,100 --> 00:35:39,560 So working with maintainer we are trying to fix it. 318 00:35:40,600 --> 00:35:45,820 And we are trying to provide some guidance on how to improve the ABPF security. 319 00:35:47,580 --> 00:35:49,440 Thank you for your time. 320 00:35:49,440 --> 00:35:51,060 I hope you are enjoying DEF CON. 321 00:35:51,360 --> 00:35:55,460 And I'm here if you want to ask some questions. 322 00:35:55,660 --> 00:35:56,400 Thank you.