1 00:00:00,000 --> 00:00:03,660 It is absolutely my pleasure to introduce to you, from the 2 00:00:03,660 --> 00:00:14,460 Council of Nine, Sam Erb. Hello. So this is going to be a 3 00:00:14,460 --> 00:00:19,140 bit of a different talk. It's definitely more blue team than 4 00:00:19,140 --> 00:00:22,380 most of what's normally presented at DEF CON. So I 5 00:00:22,380 --> 00:00:25,100 apologize for that in advance. But it's something that I really 6 00:00:25,920 --> 00:00:28,460 wanted to give a presentation on. I think it's important to 7 00:00:28,460 --> 00:00:32,280 share with the wider community what we're doing at Akamai. So 8 00:00:32,280 --> 00:00:34,700 with that in mind, this is Defense In Depth, the path to 9 00:00:34,700 --> 00:00:40,400 SGX at Akamai. So who am I? I am a software engineer at Akamai. 10 00:00:40,900 --> 00:00:44,220 At DEF CON, I have won two black badges in the badge challenge 11 00:00:44,220 --> 00:00:49,400 with the Council of Nine. Yeah, if you want to reach me, probably 12 00:00:49,400 --> 00:00:53,080 the best way right now is to find me on Twitter. So 13 00:00:54,660 --> 00:00:57,680 disclaimer, generic disclaimer, don't poke and prod at Akamai 14 00:00:57,680 --> 00:00:57,940 please. 15 00:00:58,460 --> 00:01:00,840 And everything presented here is the work of many individuals, 16 00:01:01,020 --> 00:01:03,420 some of whom are actually in the room today, which is exciting. 17 00:01:04,920 --> 00:01:10,240 This wasn't just me. So to get started, Defense In Depth. I'm 18 00:01:10,240 --> 00:01:12,180 talking about Defense In Depth and what I'm really talking 19 00:01:12,180 --> 00:01:15,740 about is the classical computing term, Defense In Depth, where 20 00:01:16,380 --> 00:01:21,760 we're adding additional security controls or layers to mitigate or 21 00:01:22,400 --> 00:01:27,840 lower the impact of vulnerability on our product. What I'm talking 22 00:01:39,560 --> 00:01:42,760 about is the 23 00:01:42,760 --> 00:01:51,740 way that you can use this. So first off, let me just point out this is actually a 24 00:01:51,740 --> 00:01:53,820 It doesn't turn out very well on the slide there. 25 00:01:53,960 --> 00:01:58,880 But this is a Wireshark output that shows a bad payload length. 26 00:01:59,280 --> 00:02:05,440 And what really all Harplade was, was you would request a certain length, 27 00:02:05,560 --> 00:02:11,620 and you'd say, hey, give me five bytes, and it would return five bytes back to you. 28 00:02:12,300 --> 00:02:14,840 And it was supposed to be the same five bytes that you sent to it. 29 00:02:15,820 --> 00:02:19,520 That's the RFC 6520, which actually defines this, 30 00:02:20,340 --> 00:02:27,400 where the receiver must send the corresponding Harplade response back to the requester. 31 00:02:30,200 --> 00:02:37,100 The implementer is neglected to verify that the payload length matches the length in the field itself 32 00:02:37,100 --> 00:02:40,300 and would send you back arbitrary memory from the server itself. 33 00:02:40,860 --> 00:02:43,460 So this allowed you to read memory from the server 34 00:02:43,460 --> 00:02:49,500 and then subsequently or potentially get access to the TPC, 35 00:02:49,520 --> 00:02:53,060 TLS private keys, which we're seeing on that server, or other information for that matter. 36 00:02:54,840 --> 00:02:55,540 Just got louder. 37 00:02:58,720 --> 00:02:59,900 So what is TLS? 38 00:03:00,080 --> 00:03:01,600 So TLS is HTTPS. 39 00:03:03,360 --> 00:03:07,120 If you haven't had a chance to, I would really recommend just going and reading the RFC. 40 00:03:07,300 --> 00:03:09,480 It's super approachable as far as RFCs go. 41 00:03:10,860 --> 00:03:14,120 This is straight out of the TLS 1.2 RFC. 42 00:03:14,580 --> 00:03:17,480 And what I'm really going to be talking about today more than anything else is 43 00:03:19,040 --> 00:03:19,440 this. 44 00:03:19,520 --> 00:03:20,220 The server key exchange message. 45 00:03:20,500 --> 00:03:25,960 So the way TLS works in general is you have a hello exchange and then you have in blue there. 46 00:03:26,100 --> 00:03:27,860 And then in yellow, you have this key exchange period. 47 00:03:28,540 --> 00:03:31,020 And then in red is where you're actually sending your bulk crypto data. 48 00:03:31,680 --> 00:03:35,920 And I'm really going to be zeroing in on the key exchange and in particular the server key exchange. 49 00:03:36,240 --> 00:03:47,640 And what that does is proves that the server owns a copy of the certificate by signing certain parameters that get used with the certificate's private key. 50 00:03:47,760 --> 00:03:49,500 So the server itself has to be used. 51 00:03:49,520 --> 00:03:56,560 So the server itself has to have somehow have access to the private key, which traditionally has meant that it's just sitting in memory on the server, which is why Harpley was so dangerous. 52 00:03:58,960 --> 00:04:04,480 TLS 1.3 makes some slight modifications to this, but that's also something that's worth going and actually reading the RFC. 53 00:04:06,080 --> 00:04:08,560 So with that in mind, I'm getting all that out of the way. 54 00:04:09,900 --> 00:04:12,280 I'm going to be walking us through a TLS security journey. 55 00:04:12,560 --> 00:04:18,140 It's not the most exciting name, but our first stop is we're going to make secrets harder to find in memory. 56 00:04:19,020 --> 00:04:19,500 And TLS 1.3 makes it harder to find in memory. 57 00:04:19,520 --> 00:04:21,480 So to accomplish this, we're actually going to use OpenSSL itself. 58 00:04:23,540 --> 00:04:30,760 And in particular, we're going to use one of OpenSSL, one of Akamai's contributions to OpenSSL, which is the OpenSSL secure heap. 59 00:04:31,060 --> 00:04:37,820 And this is just standard Linux memory protection features to get the keys into a more protected area of memory. 60 00:04:38,440 --> 00:04:41,240 And to prevent them from appearing in core dumps, et cetera. 61 00:04:41,600 --> 00:04:45,960 And this also applies to other key material, which can be used to derive the private keys as well. 62 00:04:47,200 --> 00:04:47,960 I believe 63 00:04:47,960 --> 00:04:51,180 the function name that you're going to need to look for 64 00:04:51,180 --> 00:04:52,400 is OpenSSL Secure Malloc. 65 00:04:52,580 --> 00:04:56,100 It's also externally visible or externally exposed 66 00:04:56,100 --> 00:04:58,440 so that your application can actually make use of this as well. 67 00:05:03,260 --> 00:05:04,180 So, yeah. 68 00:05:04,300 --> 00:05:08,080 So our second stop is we're going to move the secrets 69 00:05:08,080 --> 00:05:08,980 entirely out of process. 70 00:05:11,680 --> 00:05:13,460 The reason we're doing this is that 71 00:05:13,460 --> 00:05:15,300 when you could dump the memory of the process, 72 00:05:15,540 --> 00:05:17,240 you could potentially dump the secrets. 73 00:05:17,240 --> 00:05:18,600 So if they're not in the process memory, 74 00:05:18,820 --> 00:05:20,220 you can't get access to the secrets. 75 00:05:21,600 --> 00:05:22,700 And to do that, 76 00:05:22,700 --> 00:05:25,180 we're actually going to use the OpenSSL engine interface. 77 00:05:25,740 --> 00:05:27,640 I posted some example code here. 78 00:05:29,660 --> 00:05:32,180 This is a OpenSSL RSA engine. 79 00:05:32,440 --> 00:05:36,020 And really the important thing here is that RSA underscore method. 80 00:05:36,420 --> 00:05:42,220 And what that will do is it will pass the RSA 81 00:05:42,220 --> 00:05:46,620 or what needs to be signed by the server into a function. 82 00:05:46,740 --> 00:05:47,220 And once that's done, 83 00:05:47,240 --> 00:05:48,700 this is when then that function is really up to you 84 00:05:48,700 --> 00:05:52,620 to make the signature happen and return it back to OpenSSL. 85 00:05:53,760 --> 00:05:56,300 And so this gives you a hook into OpenSSL to accomplish this. 86 00:05:56,500 --> 00:05:57,580 And so using this hook, 87 00:05:58,000 --> 00:05:59,920 we're able to go outside of the process 88 00:06:01,340 --> 00:06:03,840 using either shared memory 89 00:06:03,840 --> 00:06:05,780 or some other inter-process channel 90 00:06:06,400 --> 00:06:09,880 to get to the TLS private key that we need. 91 00:06:10,660 --> 00:06:12,660 So what this actually looks like in terms of the protocol, 92 00:06:14,800 --> 00:06:16,460 I'm defining a web server here. 93 00:06:16,580 --> 00:06:17,220 And that's a lot of work. 94 00:06:21,500 --> 00:06:26,620 I'm going to use that to send a client random server random 95 00:06:26,620 --> 00:06:31,140 and key parameters off as well as a certificate identifier 96 00:06:31,140 --> 00:06:33,300 off to some external key process. 97 00:06:33,620 --> 00:06:36,000 And this external key process is actually going to make the signature 98 00:06:36,000 --> 00:06:37,960 and then return it back to the process itself. 99 00:06:38,320 --> 00:06:41,140 So if we had had this in place when Harpley had rolled around, 100 00:06:41,380 --> 00:06:45,220 we wouldn't have been as vulnerable at least. 101 00:06:46,140 --> 00:06:47,100 The attacker, 102 00:06:47,240 --> 00:06:48,820 we still would have got access to private memory, 103 00:06:48,940 --> 00:06:50,060 which could have contained sensitive information, 104 00:06:50,460 --> 00:06:52,580 but at least we wouldn't have had to potentially rotate this key. 105 00:06:56,460 --> 00:06:59,840 So what we did here was nothing particularly special. 106 00:07:00,660 --> 00:07:02,340 So we decided to take this to the next step 107 00:07:02,340 --> 00:07:05,340 and we moved the secrets not only out of process, 108 00:07:05,460 --> 00:07:06,240 but also out of the machine. 109 00:07:06,480 --> 00:07:10,640 This means that if you have some sort of bad exploit, 110 00:07:10,760 --> 00:07:11,860 like a remote code execution, 111 00:07:12,680 --> 00:07:14,600 you have some confidence that this key wasn't leaked. 112 00:07:15,420 --> 00:07:17,060 And so what that looks like is, 113 00:07:17,240 --> 00:07:18,920 we just put the internet between our web server 114 00:07:18,920 --> 00:07:20,700 and the external key server. 115 00:07:21,980 --> 00:07:23,380 The protocol is identical, 116 00:07:24,080 --> 00:07:26,480 only you probably want to add some additional security to this channel. 117 00:07:28,820 --> 00:07:31,380 And so for some background here, 118 00:07:31,520 --> 00:07:35,260 Akamai has, I think we say over 200,000 servers at this point, 119 00:07:35,740 --> 00:07:36,560 distributed internationally. 120 00:07:38,940 --> 00:07:40,880 We have a lot of these web servers. 121 00:07:41,640 --> 00:07:42,980 So that also means, 122 00:07:43,200 --> 00:07:46,660 that implies that we're going to need a lot of these external key servers. 123 00:07:47,240 --> 00:07:49,280 And obviously we don't want slow handshakes. 124 00:07:50,060 --> 00:07:52,720 This only impacts the initial TLS handshake. 125 00:07:53,140 --> 00:07:55,280 Subsequent ones will use session keys, 126 00:07:56,160 --> 00:07:58,040 which allow for faster session resumption. 127 00:07:59,100 --> 00:08:02,600 And also means you don't have to have access to the server private key as well. 128 00:08:03,480 --> 00:08:07,040 But this puts this problem squarely into the engineering space 129 00:08:07,040 --> 00:08:08,180 and not into the security space. 130 00:08:08,700 --> 00:08:10,140 This is strictly an engineering problem 131 00:08:10,140 --> 00:08:13,860 and it's also a performance security trade-off here, 132 00:08:13,960 --> 00:08:15,300 at least on this initial TLS handshake. 133 00:08:17,600 --> 00:08:20,040 And so, yeah, it really creates a mini-tiny writing problem, 134 00:08:20,180 --> 00:08:23,000 which is something that Akamai is luckily good at solving. 135 00:08:23,720 --> 00:08:25,320 We solve that every day with our end users. 136 00:08:25,460 --> 00:08:27,460 So in this case, we're turning that problem on its head 137 00:08:27,460 --> 00:08:30,300 and we're having web servers connect to these external key servers. 138 00:08:33,220 --> 00:08:34,660 So this involved a lot of planning. 139 00:08:36,180 --> 00:08:39,080 So this, one of my colleagues put this together, 140 00:08:39,260 --> 00:08:40,840 I believe it was Richard Wiley. 141 00:08:41,280 --> 00:08:46,580 This is a map, a heat map that shows connectivity 142 00:08:46,580 --> 00:08:47,940 between different parts of the world. 143 00:08:48,500 --> 00:08:49,860 It was really fascinating to learn 144 00:08:49,860 --> 00:08:52,420 about how poorly connected parts of the world are while doing this. 145 00:08:52,960 --> 00:08:57,460 So in general, you don't want to be crossing between 146 00:08:58,560 --> 00:09:01,700 not just national, but in some cases, continent boundaries. 147 00:09:02,320 --> 00:09:04,640 And that will lead to slow connectivity, 148 00:09:04,920 --> 00:09:06,880 slow handshakes, and slow performance. 149 00:09:08,580 --> 00:09:10,240 And this is just a visualization of this. 150 00:09:10,360 --> 00:09:11,940 We actually used the raw data to figure out 151 00:09:11,940 --> 00:09:14,420 where to best put these key servers. 152 00:09:15,720 --> 00:09:16,560 And this was actually... 153 00:09:16,580 --> 00:09:19,160 included in our state of the internet report in 2017. 154 00:09:22,200 --> 00:09:26,760 So in practice, so this is actually an internal visualization of our network. 155 00:09:27,620 --> 00:09:29,320 It's a little bit hard to see from further back, 156 00:09:29,500 --> 00:09:31,500 but the blue dots on there represent locations. 157 00:09:31,640 --> 00:09:34,500 We have web servers and the red dots represent locations 158 00:09:34,500 --> 00:09:38,960 that we actually put key servers, I should say, 159 00:09:39,020 --> 00:09:40,400 because each one represents more than one, 160 00:09:40,420 --> 00:09:41,860 or each dot represents more than one machine. 161 00:09:42,320 --> 00:09:43,760 And then the yellow and green lines 162 00:09:43,760 --> 00:09:45,020 just represent different traffic levels. 163 00:09:45,260 --> 00:09:46,240 And this is actually a real time, 164 00:09:46,240 --> 00:09:47,560 a real time dashboard that I pulled this off of. 165 00:09:47,720 --> 00:09:51,000 So we're actually visualizing our web servers 166 00:09:51,000 --> 00:09:55,360 connecting to our key processors in real time at scale. 167 00:09:55,600 --> 00:09:57,880 And Europe is honestly the most exciting one. 168 00:09:58,680 --> 00:10:01,560 It has the most lines as closely bunched together, 169 00:10:02,180 --> 00:10:04,000 simply due to geographical constraints. 170 00:10:06,670 --> 00:10:08,520 Yeah, I've always found the visualization extremely cool. 171 00:10:11,560 --> 00:10:13,520 So that's great that we've moved our secrets 172 00:10:13,520 --> 00:10:14,220 down to another machine. 173 00:10:15,140 --> 00:10:16,060 Let's get a little paranoid, 174 00:10:16,480 --> 00:10:18,780 and we're going to put them into an HSM. 175 00:10:19,360 --> 00:10:20,900 For those of you not familiar with an HSM, 176 00:10:21,420 --> 00:10:23,580 this would be something like a YubiKey, for example, 177 00:10:23,720 --> 00:10:28,300 where it's a hardware device and hardware security module, 178 00:10:28,460 --> 00:10:29,320 I believe is what it stands for. 179 00:10:29,580 --> 00:10:31,200 It's a hardware device that holds your private key, 180 00:10:31,300 --> 00:10:35,100 and you're able to send it a request to use that private key, 181 00:10:35,200 --> 00:10:37,900 and it will give you back a signed response of some form. 182 00:10:38,080 --> 00:10:40,740 And so to accomplish this, I'm going to use Intel SGX. 183 00:10:41,060 --> 00:10:44,200 And I'm going to explain a lot more about what Intel SGX, actually, is. 184 00:10:44,200 --> 00:10:45,420 In subsequent slides. 185 00:10:47,040 --> 00:10:49,580 So this is a little bit paranoid, honestly. 186 00:10:50,940 --> 00:10:53,940 This is kind of taking this to the next level as an experiment, 187 00:10:54,600 --> 00:10:56,800 but we're actually able to make this work and deploy it, 188 00:10:56,920 --> 00:10:58,020 which is very exciting. 189 00:10:59,180 --> 00:11:01,720 So we put an SGX key store 190 00:11:01,720 --> 00:11:04,060 into each of these external key servers. 191 00:11:06,420 --> 00:11:07,880 So what is SGX? 192 00:11:07,980 --> 00:11:09,280 So this is an Intel technology. 193 00:11:09,980 --> 00:11:13,880 We have it in our certain chips 194 00:11:13,880 --> 00:11:14,900 that we deploy in our network. 195 00:11:15,040 --> 00:11:16,980 It's not available in all Intel chips yet. 196 00:11:17,160 --> 00:11:18,320 I think they're working on that still. 197 00:11:19,260 --> 00:11:21,520 And most importantly, it's a new set of CPU instructions 198 00:11:22,200 --> 00:11:23,580 for handling enclaves. 199 00:11:24,460 --> 00:11:29,140 So enclaves can be thought of as shared object library, 200 00:11:30,380 --> 00:11:32,880 where in the untrusted library, you make a function call 201 00:11:32,880 --> 00:11:35,540 and it drops you into this trusted state 202 00:11:35,540 --> 00:11:39,140 where you can't really do a whole lot, to be honest. 203 00:11:39,340 --> 00:11:43,100 You can do memory operations. 204 00:11:43,100 --> 00:11:45,680 You can, but you can't ever leave the chip. 205 00:11:45,800 --> 00:11:47,100 And anything that leaves the chip itself 206 00:11:47,660 --> 00:11:48,700 is either gonna be encrypted 207 00:11:48,700 --> 00:11:50,520 or you're not gonna have access to. 208 00:11:51,740 --> 00:11:53,760 And so what that means is that you can only drop 209 00:11:53,760 --> 00:11:55,180 into the state and come back out of the state, 210 00:11:55,280 --> 00:11:58,000 which on a first pass doesn't really seem very useful, 211 00:11:58,420 --> 00:12:00,420 but you can securely get data into this, 212 00:12:00,480 --> 00:12:03,020 which means it can function as an HSM 213 00:12:03,720 --> 00:12:04,900 if you code it correctly. 214 00:12:09,060 --> 00:12:11,060 So it can be best thought of as a reverse sandbox. 215 00:12:11,720 --> 00:12:12,840 Enclaves can read and write 216 00:12:12,840 --> 00:12:14,500 to external memory of a process, 217 00:12:14,600 --> 00:12:16,700 not to any external memory, just of a single process. 218 00:12:17,360 --> 00:12:19,140 And applications at any level 219 00:12:19,760 --> 00:12:22,220 cannot read or write memory within that enclave. 220 00:12:22,520 --> 00:12:25,900 So it's kind of, when you actually call the enclave, 221 00:12:25,920 --> 00:12:28,420 it really will then reach out back to you, 222 00:12:28,500 --> 00:12:31,260 fetch the information it needs, do something with it, 223 00:12:31,320 --> 00:12:32,620 and then return that data back to you. 224 00:12:33,900 --> 00:12:36,860 And one of the great things about this, about SGX, 225 00:12:36,920 --> 00:12:39,900 is it has roughly the same performance as the CPU itself. 226 00:12:40,000 --> 00:12:41,120 It's running on the same hardware. 227 00:12:41,880 --> 00:12:42,820 The hardware, it's running on the same hardware, 228 00:12:42,840 --> 00:12:44,520 just simply drops into this SGX state 229 00:12:44,520 --> 00:12:45,660 and comes back out of it. 230 00:12:46,060 --> 00:12:47,160 That's the best way to think about this. 231 00:12:47,800 --> 00:12:49,320 I'm not the first one to use that term. 232 00:12:49,620 --> 00:12:53,180 It was originally coined at a 2016 Black Hat talk. 233 00:12:56,940 --> 00:12:59,120 So enclaves, these are the shared object libraries 234 00:12:59,120 --> 00:13:00,060 that I had on a previous slide. 235 00:13:01,420 --> 00:13:05,860 Enclaves must be signed, and the root of trust 236 00:13:05,860 --> 00:13:07,240 is actually traced back to your BIOS. 237 00:13:07,560 --> 00:13:12,640 So if you control your BIOS, you control who can run code 238 00:13:12,640 --> 00:13:14,680 on, you can control who can run enclaves on your system. 239 00:13:16,620 --> 00:13:17,720 And it really roots the, 240 00:13:18,180 --> 00:13:19,700 chains the root of trust to a very low level. 241 00:13:20,900 --> 00:13:22,200 Enclaves have to be statically compiled. 242 00:13:22,840 --> 00:13:23,940 All of the code is signed. 243 00:13:25,040 --> 00:13:27,280 So that kind of implies that it has to be statically compiled. 244 00:13:27,940 --> 00:13:29,620 It requires BIOS and kernel support 245 00:13:29,620 --> 00:13:30,980 just to make sure everything works correctly. 246 00:13:33,180 --> 00:13:35,040 And remote and localization are possible. 247 00:13:35,240 --> 00:13:37,940 And this is one of the cooler features of SGX, 248 00:13:38,020 --> 00:13:41,660 and is what allows you to securely get your secrets 249 00:13:41,660 --> 00:13:42,620 into these enclaves. 250 00:13:42,640 --> 00:13:46,900 And trust that they're going to not only the right machine, 251 00:13:47,020 --> 00:13:48,140 but the right enclave itself. 252 00:13:51,660 --> 00:13:53,140 So there are a bunch of new instructions, 253 00:13:53,300 --> 00:13:54,660 and most of them aren't really that exciting. 254 00:13:54,720 --> 00:13:55,560 They're for memory operations, 255 00:13:55,640 --> 00:13:57,240 and launching and stopping enclaves. 256 00:13:57,980 --> 00:14:01,260 The important two are gonna be eReport and eGetKey. 257 00:14:01,360 --> 00:14:06,240 So eReport allows you to tell another enclave on the system 258 00:14:08,080 --> 00:14:09,660 that you're on the same system as it. 259 00:14:09,840 --> 00:14:12,220 And you generate a report, and you sign it in a special way. 260 00:14:12,640 --> 00:14:15,460 And then another enclave can take that data and verify it, 261 00:14:15,960 --> 00:14:17,700 even if it passed through an untrusted boundary. 262 00:14:19,840 --> 00:14:22,340 eGetKey, which is a little bit more interesting, 263 00:14:22,500 --> 00:14:24,900 allows you to actually generate a unique key 264 00:14:24,900 --> 00:14:28,160 within a given enclave. 265 00:14:28,400 --> 00:14:29,780 And this allows for sealing, 266 00:14:29,980 --> 00:14:31,340 which I'll talk about a little bit more later. 267 00:14:31,580 --> 00:14:35,780 But the important thing here is that you can generate 268 00:14:35,780 --> 00:14:41,760 a unique key on that machine, and then subsequently decrypt data 269 00:14:41,760 --> 00:14:42,400 based on that key. 270 00:14:44,100 --> 00:14:47,800 I should say that that is actually a symmetric key. 271 00:14:52,440 --> 00:14:56,700 So SGX sealing, so that eGetKey parameter allows you 272 00:14:56,700 --> 00:14:59,100 to generate a key that's shared between all enclaves 273 00:14:59,100 --> 00:15:00,720 that are on the same system and signed by the same key. 274 00:15:01,900 --> 00:15:03,260 And this key is persistent. 275 00:15:03,500 --> 00:15:05,320 So as long as you call this function the same way, 276 00:15:05,400 --> 00:15:07,100 you'll always get the same key back from it, 277 00:15:07,180 --> 00:15:08,900 which is awesome between OS installs. 278 00:15:08,900 --> 00:15:10,760 You don't have to maintain any state on that machine. 279 00:15:10,980 --> 00:15:12,620 You can wipe it completely, and the key 280 00:15:12,640 --> 00:15:14,080 will still come back the same way the next time. 281 00:15:14,680 --> 00:15:17,880 They also have counters in there to handle, 282 00:15:19,420 --> 00:15:20,960 if there are vulnerabilities found in the process, 283 00:15:21,080 --> 00:15:22,480 there are counters in there that will increment, 284 00:15:22,700 --> 00:15:29,140 auto-increment, that will allow you to create certain actions 285 00:15:29,140 --> 00:15:29,680 based on the key. 286 00:15:29,820 --> 00:15:31,680 It's kind of, that's a little bit too much detail, honestly. 287 00:15:33,760 --> 00:15:36,940 So we can actually use this SGX sealing system. 288 00:15:37,860 --> 00:15:42,620 And per machine, what we ended up doing was we created a, you know, 289 00:15:42,640 --> 00:15:45,740 public-private key pair and, within an enclave, 290 00:15:45,900 --> 00:15:51,040 and then we had the private key encrypted using the sealing key. 291 00:15:51,300 --> 00:15:53,860 And then once it's encrypted using the sealing key, 292 00:15:54,000 --> 00:15:57,140 we can then export this public key sealed private key, 293 00:15:57,280 --> 00:16:01,940 and that becomes a unique public-private key pair tied 294 00:16:01,940 --> 00:16:05,320 to that machine that will survive OS installs. 295 00:16:06,120 --> 00:16:08,500 And so we actually were able to use this 296 00:16:08,500 --> 00:16:09,680 to do key provisioning at scale. 297 00:16:09,900 --> 00:16:12,520 You know, this is across a large number of machines, 298 00:16:14,440 --> 00:16:18,000 where we had each one of these SGX key stores issue 299 00:16:18,000 --> 00:16:20,220 this sealed private key, public key combination. 300 00:16:20,720 --> 00:16:23,680 We would then, we have a massive advantage 301 00:16:23,680 --> 00:16:28,380 because we control our machine deployment and our pipeline 302 00:16:28,380 --> 00:16:29,240 to get machines deployed. 303 00:16:32,560 --> 00:16:35,940 And so we were able to export that key. 304 00:16:36,060 --> 00:16:40,860 We then were able to encrypt a key to that public key, 305 00:16:41,360 --> 00:16:42,240 and then send that. 306 00:16:42,240 --> 00:16:43,820 And a bunch of other data back down to the enclave. 307 00:16:43,980 --> 00:16:46,980 And assuming that this whole process works, 308 00:16:47,080 --> 00:16:50,340 only that enclave will actually be able to decrypt the secrets 309 00:16:51,220 --> 00:16:53,340 that are encrypted to that public key. 310 00:16:54,060 --> 00:16:56,360 I should say this key pair is an RSA key pair, 311 00:16:56,520 --> 00:16:59,080 which allows you to, you know, encrypt things to the public key, 312 00:16:59,120 --> 00:17:00,940 such that they can only be decrypted using the private key. 313 00:17:04,200 --> 00:17:06,560 Yeah, so at a high level, that's kind of how that all works. 314 00:17:08,760 --> 00:17:11,480 So there are a bunch of complexity with SGX 315 00:17:11,480 --> 00:17:12,100 that I didn't get into. 316 00:17:12,940 --> 00:17:15,100 You will spend all of your time worrying about 317 00:17:15,100 --> 00:17:16,700 how to rotate every single key you create. 318 00:17:17,760 --> 00:17:19,480 Initial trust establishment is a little complicated, 319 00:17:19,660 --> 00:17:21,040 which I described previously, 320 00:17:21,740 --> 00:17:24,620 especially if you don't control your machine build process 321 00:17:24,620 --> 00:17:25,040 or pipeline. 322 00:17:27,280 --> 00:17:29,680 Secure handling of multiple enclaves, keys, 323 00:17:29,840 --> 00:17:31,500 and most importantly, replay attack prevention 324 00:17:32,020 --> 00:17:34,280 are all things that I didn't talk about, 325 00:17:34,400 --> 00:17:36,400 but you should worry about if you're actually deploying this. 326 00:17:38,240 --> 00:17:39,620 You'll spend most of your time, 327 00:17:40,300 --> 00:17:41,840 you'll spend most of your time trying 328 00:17:41,840 --> 00:17:44,260 to figure out how this should work 329 00:17:44,260 --> 00:17:47,060 and handle key rotation and handle all these really complex cases 330 00:17:47,550 --> 00:17:48,820 and not a whole lot of time writing code, 331 00:17:49,720 --> 00:17:51,240 which to some extent is a good thing. 332 00:17:53,900 --> 00:17:58,480 So yeah, so I should add all of this was deployed within Akamai. 333 00:17:59,260 --> 00:18:02,520 If you connect to Akamai, there's a chance that, 334 00:18:02,520 --> 00:18:05,460 you know, your TLS handshake is actually at some point 335 00:18:05,460 --> 00:18:07,400 actually traversing a SGX enclave, 336 00:18:07,540 --> 00:18:08,700 which I think is pretty cool. 337 00:18:09,320 --> 00:18:10,120 So yeah, thank you. 338 00:18:11,920 --> 00:18:14,080 Thank you.