1 00:00:00,000 --> 00:00:15,020 Okay, hello. I'm Nikos. I'm a cryptography researcher at Fireblocks. This is Oren. He's a security researcher at Fireblocks. 2 00:00:15,550 --> 00:00:22,720 And we're here to talk about hacking crypto wallets. So what is a crypto wallet? 3 00:00:22,720 --> 00:00:28,880 So let's say you want to spend Bitcoin. You need a wallet. That wallet holds a key. 4 00:00:28,980 --> 00:00:38,840 That key allows you to sign transactions. Those transactions you can broadcast to the blockchain and send crypto to your favorite people. 5 00:00:39,460 --> 00:00:43,320 There is a problem with the setup because there is a single point of failure. 6 00:00:43,540 --> 00:00:46,820 The key is sitting in one place, ready to be stolen. 7 00:00:47,100 --> 00:00:51,480 How can you minimize that risk? You can use multi-party computation. 8 00:00:51,480 --> 00:00:55,700 Also known as MPC. So what is MPC? 9 00:00:55,920 --> 00:01:04,320 So at a very high level, the idea is that instead of having one key in one place, the key is split into shares. 10 00:01:04,880 --> 00:01:08,860 And those shares reside with different parties. 11 00:01:09,200 --> 00:01:13,800 Actually, MPC promises much more than what the picture suggests. 12 00:01:14,440 --> 00:01:18,280 Because the key is never assembled in one place. 13 00:01:18,660 --> 00:01:21,080 The parties calculate their shares. 14 00:01:21,080 --> 00:01:21,460 And the parties calculate their shares. 15 00:01:21,480 --> 00:01:23,860 And the public key via an interactive protocol. 16 00:01:24,360 --> 00:01:31,600 And then every time they want to sign a transaction, they run a different interactive protocol for calculating the signature. 17 00:01:32,000 --> 00:01:40,220 So small aside, MPC is much bigger than the use case I just described, which is threshold signatures. 18 00:01:41,020 --> 00:01:44,280 It is the crown jewel of modern cryptography. 19 00:01:45,200 --> 00:01:50,880 Basically, anything you can do with a trusted centralized party, you can do trustlessly. 20 00:01:50,880 --> 00:01:52,200 With MPC. 21 00:01:52,600 --> 00:01:54,280 There are numerous examples. 22 00:01:54,660 --> 00:01:56,560 I'm not going to go into them. 23 00:01:57,120 --> 00:02:01,020 But what I will say is that commercial adoption has been a bit slow. 24 00:02:01,260 --> 00:02:03,460 MPC has been around since the 80s. 25 00:02:03,820 --> 00:02:10,840 And the most significant use case before blockchain was the famous Danish sugar beet auction of 2008. 26 00:02:12,000 --> 00:02:18,880 And since the advent of blockchain, MPC is now protecting billions of dollars in cryptocurrency wallets. 27 00:02:19,440 --> 00:02:22,580 But we're not here to talk about MPC in itself. 28 00:02:22,800 --> 00:02:25,580 We're here to hack crypto wallets that are based on MPC. 29 00:02:25,760 --> 00:02:27,120 So what would that look like? 30 00:02:27,420 --> 00:02:29,820 One thing that could happen is a denial of service. 31 00:02:29,980 --> 00:02:33,040 Let's say I'm able to freeze your wallet so you can't spend your crypto. 32 00:02:33,200 --> 00:02:34,000 That's a problem. 33 00:02:34,720 --> 00:02:37,420 Something more severe would be signature forgery. 34 00:02:37,580 --> 00:02:40,080 Let's say Nikos and I, we have an MPC wallet. 35 00:02:40,220 --> 00:02:42,400 So every time we want to sign, we sign together. 36 00:02:42,780 --> 00:02:46,720 So I tell him, let's sign this $10 transaction to your favorite charity. 37 00:02:46,940 --> 00:02:47,940 He signs it. 38 00:02:47,940 --> 00:02:54,960 But because I took advantage of some flaw in the protocol, I actually made him sign a totally different transaction without him knowing. 39 00:02:55,160 --> 00:02:55,860 That's bad. 40 00:02:56,080 --> 00:02:59,060 But what's even worse would be private key exfiltration. 41 00:02:59,200 --> 00:03:03,320 Whereas by him signing that transaction, he leaked his key share to me. 42 00:03:03,400 --> 00:03:06,800 And now I can sign whatever I want, whenever I want, without his consent. 43 00:03:07,240 --> 00:03:09,140 Today's talk will be focused on this. 44 00:03:09,360 --> 00:03:15,200 We're actually going to show you three different attacks that all end with private key exfiltration. 45 00:03:15,800 --> 00:03:17,920 When will we be talking about attacking crypto? 46 00:03:17,940 --> 00:03:18,320 When will we be talking about attacking crypto wallets? 47 00:03:18,660 --> 00:03:19,860 MPC crypto wallets. 48 00:03:19,860 --> 00:03:21,780 I want you to have this threat model in mind. 49 00:03:21,980 --> 00:03:25,680 So these are a bunch of people participating with an MPC wallet together. 50 00:03:25,880 --> 00:03:27,920 So each time they want to sign, they need to collaborate. 51 00:03:28,960 --> 00:03:34,180 Now, one of those participants, namely Alice, will be acting maliciously. 52 00:03:34,180 --> 00:03:44,160 Now, either she woke up one day, decided to be evil, or maybe she was compromised by an attacker and now is using her identity to attack the other people. 53 00:03:44,520 --> 00:03:46,400 So whatever her motivation might be. 54 00:03:46,460 --> 00:03:47,800 She wakes up in the morning. 55 00:03:47,800 --> 00:03:51,120 Her only goal would be to exfiltrate the other counterparty's key shares. 56 00:03:51,340 --> 00:03:55,240 And she will do that by signing normal looking transactions with them. 57 00:03:55,500 --> 00:04:00,500 So the research findings that brought us here today were as follows. 58 00:04:00,760 --> 00:04:04,240 We have discovered four novel attacks, including three zero days. 59 00:04:06,540 --> 00:04:12,040 These findings have affected over 16 different vendors and our open source libraries. 60 00:04:12,440 --> 00:04:17,780 We'll be releasing at the last slide four fully working proof of concept exploits for these attacks. 61 00:04:17,780 --> 00:04:18,760 We'll be showing you. 62 00:04:19,520 --> 00:04:26,500 We actually used the very same proof of concept exploits against two vendor production environments and got the private keys. 63 00:04:26,960 --> 00:04:31,340 And the last thing I want to stress is most of our attacks are not implementation specific. 64 00:04:31,800 --> 00:04:34,620 We'll be attacking MPC at the protocol level. 65 00:04:35,020 --> 00:04:37,820 So the affected parties were numerous. 66 00:04:38,160 --> 00:04:40,200 Some of the biggest crypto wallets were affected. 67 00:04:40,440 --> 00:04:42,960 A number of crypto custodians were affected. 68 00:04:43,260 --> 00:04:46,280 The most popular consumer MPC wallet was affected. 69 00:04:46,280 --> 00:04:51,040 As well as some of the most popular open source MPC libraries. 70 00:04:52,060 --> 00:04:54,280 The attacks we'll be covering today. 71 00:04:54,560 --> 00:04:58,000 We'll start with attacking the most popular two party signing protocol. 72 00:04:58,340 --> 00:04:59,440 It's called Lindel 17. 73 00:04:59,980 --> 00:05:05,700 Carrying out the attack will be somewhat high interactivity required. 74 00:05:06,260 --> 00:05:08,680 Then we'll go to a second attack. 75 00:05:08,820 --> 00:05:11,620 We'll attack the most popular multi-party signing protocols. 76 00:05:11,800 --> 00:05:14,320 The GG 18, GG 20 family of protocols. 77 00:05:14,640 --> 00:05:16,040 And last but not least. 78 00:05:16,040 --> 00:05:17,800 We'll attack what we call a do it yourself protocol. 79 00:05:18,020 --> 00:05:22,160 Because it doesn't really closely adhere to any academic paper. 80 00:05:23,300 --> 00:05:23,800 Okay. 81 00:05:23,940 --> 00:05:26,620 So before we have a look at the exploits. 82 00:05:26,620 --> 00:05:29,060 We need a few items of background material. 83 00:05:29,740 --> 00:05:32,120 The first item in the background is the math. 84 00:05:33,440 --> 00:05:34,700 Thankfully no math. 85 00:05:34,920 --> 00:05:36,040 I mean no advanced math. 86 00:05:36,980 --> 00:05:38,140 The only thing. 87 00:05:38,180 --> 00:05:40,620 We're not going to be talking about elliptic curves. 88 00:05:40,900 --> 00:05:42,120 Or abstract groups. 89 00:05:42,420 --> 00:05:44,180 The only thing you need to know for today. 90 00:05:44,180 --> 00:05:45,800 Is the modulo operator. 91 00:05:46,120 --> 00:05:47,320 What is the modulo operator? 92 00:05:47,580 --> 00:05:48,480 Well very simply. 93 00:05:48,540 --> 00:05:51,040 X modulo N is the remainder of X. 94 00:05:51,360 --> 00:05:52,400 Divided by N. 95 00:05:52,720 --> 00:05:53,680 For example. 96 00:05:53,760 --> 00:05:55,640 5 modulo 5 is 0. 97 00:05:55,760 --> 00:05:57,240 Because 5 is divisible by itself. 98 00:05:57,640 --> 00:05:59,680 And 6 modulo 5 is 1. 99 00:05:59,840 --> 00:06:01,240 Because 6 is greater than 5. 100 00:06:01,420 --> 00:06:02,060 And there's overflow. 101 00:06:02,400 --> 00:06:03,440 And yada yada yada. 102 00:06:03,700 --> 00:06:04,220 Great. 103 00:06:04,320 --> 00:06:05,640 Second item in the background. 104 00:06:05,880 --> 00:06:07,200 Is homomorphic encryption. 105 00:06:07,520 --> 00:06:09,200 This is a cool thing. 106 00:06:09,420 --> 00:06:10,300 So what is it? 107 00:06:10,400 --> 00:06:12,220 It is a special kind of encryption. 108 00:06:12,540 --> 00:06:13,620 That allows computation. 109 00:06:13,620 --> 00:06:15,520 On encrypted data. 110 00:06:16,900 --> 00:06:18,660 Without decrypting the ciphertext. 111 00:06:18,800 --> 00:06:20,360 That's very important to note. 112 00:06:20,460 --> 00:06:21,300 So for example. 113 00:06:21,580 --> 00:06:23,880 Let's say Alice sends an encryption. 114 00:06:23,880 --> 00:06:25,620 Of the number 42 to Bob. 115 00:06:25,920 --> 00:06:27,580 So here and throughout the talk. 116 00:06:27,740 --> 00:06:29,180 We will be using color coding. 117 00:06:29,540 --> 00:06:31,600 Red for values that Alice knows. 118 00:06:31,880 --> 00:06:34,400 Blue for values that only Bob knows. 119 00:06:34,940 --> 00:06:36,560 So Bob receives this thing. 120 00:06:36,720 --> 00:06:37,840 And he can operate on it. 121 00:06:37,920 --> 00:06:38,400 For example. 122 00:06:38,480 --> 00:06:40,640 He can multiply by the number 2. 123 00:06:40,820 --> 00:06:42,520 And he can add the number 100. 124 00:06:42,520 --> 00:06:44,760 He does this obliviously. 125 00:06:44,820 --> 00:06:47,260 Without knowing what's happening inside the ciphertext. 126 00:06:47,560 --> 00:06:50,040 Alice after receiving this. 127 00:06:51,340 --> 00:06:52,740 The resulting ciphertext. 128 00:06:53,280 --> 00:06:54,340 Can decrypt it. 129 00:06:54,440 --> 00:06:55,380 And learn the result. 130 00:06:55,660 --> 00:06:58,220 Without ever knowing what Bob exactly did. 131 00:06:58,300 --> 00:06:59,500 To the ciphertext. 132 00:07:00,380 --> 00:07:02,600 So there are many kinds of homomorphic encryption. 133 00:07:03,000 --> 00:07:04,640 I'm not going to dive into them today. 134 00:07:04,920 --> 00:07:07,580 But we will be looking at the most vanilla kind. 135 00:07:07,840 --> 00:07:10,580 Which is parameterized by a public key. 136 00:07:10,780 --> 00:07:11,320 N. 137 00:07:11,320 --> 00:07:13,420 This is a number. 138 00:07:13,580 --> 00:07:16,200 And it's the product of two big primes. 139 00:07:16,260 --> 00:07:17,960 This detail will become relevant. 140 00:07:18,380 --> 00:07:19,780 Later in the talk. 141 00:07:19,980 --> 00:07:21,480 So the last item in the background. 142 00:07:22,080 --> 00:07:24,000 Is the ECDSA signature scheme. 143 00:07:24,160 --> 00:07:26,960 This is the most important signature scheme. 144 00:07:27,040 --> 00:07:28,020 In the blockchain space. 145 00:07:28,280 --> 00:07:29,140 It is used by Bitcoin. 146 00:07:29,380 --> 00:07:30,280 It is used by Ethereum. 147 00:07:30,500 --> 00:07:32,000 Among other blockchains. 148 00:07:32,200 --> 00:07:34,160 And the protocols we'll be looking at. 149 00:07:34,240 --> 00:07:36,400 Implement this scheme. 150 00:07:36,780 --> 00:07:39,840 So how do you generate an ECDSA signature? 151 00:07:40,040 --> 00:07:41,200 It goes something like this. 152 00:07:41,320 --> 00:07:43,840 First you sample a random number K. 153 00:07:44,060 --> 00:07:45,080 This is a secret. 154 00:07:45,280 --> 00:07:47,600 And it is chosen afresh with each signature. 155 00:07:47,900 --> 00:07:50,260 It is also called the ephemeral key. 156 00:07:51,060 --> 00:07:52,420 Then to calculate the signature. 157 00:07:52,560 --> 00:07:54,000 You simply compute a function. 158 00:07:54,080 --> 00:07:55,720 Of the message to be signed. 159 00:07:55,880 --> 00:07:56,980 The ephemeral key. 160 00:07:57,160 --> 00:07:58,160 The private key. 161 00:07:58,360 --> 00:08:00,680 As well as an ECDSA constant. 162 00:08:00,920 --> 00:08:01,880 That everybody knows. 163 00:08:02,020 --> 00:08:03,580 That we denote by L. 164 00:08:03,760 --> 00:08:05,480 So that's for one party. 165 00:08:05,780 --> 00:08:07,180 What about multi-party? 166 00:08:07,260 --> 00:08:08,080 What about two parties? 167 00:08:08,200 --> 00:08:10,480 Well the idea that we've already alluded to. 168 00:08:10,480 --> 00:08:11,580 At the beginning of the talk. 169 00:08:11,680 --> 00:08:15,240 Is that instead of having the secret material residing in one place. 170 00:08:15,440 --> 00:08:18,880 The secret material will be split between the parties. 171 00:08:19,400 --> 00:08:19,920 Okay. 172 00:08:20,020 --> 00:08:21,180 So having covered the background. 173 00:08:21,460 --> 00:08:24,160 Now we can move on to our first exploit. 174 00:08:24,460 --> 00:08:28,020 We will show you how to compromise the LIDL 17 protocol. 175 00:08:28,540 --> 00:08:30,300 Implementations of the LIDL 17 protocol. 176 00:08:32,240 --> 00:08:35,000 And in order to explain how to compromise it. 177 00:08:35,080 --> 00:08:36,440 I need to tell you what the protocol is. 178 00:08:36,620 --> 00:08:38,180 So it goes something like this. 179 00:08:38,660 --> 00:08:40,340 So first there's a key generation. 180 00:08:40,480 --> 00:08:44,200 Where the parties choose random key shares. 181 00:08:44,400 --> 00:08:47,320 So that would be X1 for Alice and X2 for Bob. 182 00:08:48,040 --> 00:08:49,760 The next step in the key generation. 183 00:08:50,040 --> 00:08:52,140 Is for Bob to encrypt his share. 184 00:08:52,640 --> 00:08:55,580 Under a homomorphic scheme that he controls. 185 00:08:56,080 --> 00:08:58,580 And he sends that encryption to Alice. 186 00:08:58,720 --> 00:09:01,400 So he sends an encryption of X2 to Alice. 187 00:09:01,540 --> 00:09:02,460 I will remind you. 188 00:09:02,560 --> 00:09:04,720 That only Bob can decrypt this thing. 189 00:09:04,880 --> 00:09:06,540 But Alice can operate on it. 190 00:09:06,740 --> 00:09:09,160 And this is going to be important for signing. 191 00:09:09,360 --> 00:09:10,460 So before we move on. 192 00:09:10,460 --> 00:09:10,880 To signing. 193 00:09:11,500 --> 00:09:13,820 We need to address the elephant in the room. 194 00:09:14,460 --> 00:09:16,220 This is a cryptography talk. 195 00:09:16,780 --> 00:09:18,820 So there's going to be formulas involved. 196 00:09:19,700 --> 00:09:21,420 But nothing bad is going to happen. 197 00:09:22,100 --> 00:09:23,440 Oren will take care of you. 198 00:09:23,580 --> 00:09:24,960 Okay so let's have a look at signing. 199 00:09:25,340 --> 00:09:27,020 Signing goes something like this. 200 00:09:27,180 --> 00:09:30,800 So Alice uses the ciphertext she receives from Bob. 201 00:09:30,920 --> 00:09:31,820 During the key generation. 202 00:09:32,300 --> 00:09:36,020 To send an encrypted partial signature to Bob. 203 00:09:36,180 --> 00:09:40,080 The encrypted partial signature looks something like this. 204 00:09:40,080 --> 00:09:42,480 And the only reason I am displaying this formula. 205 00:09:42,680 --> 00:09:45,820 Is to show you that we have almost all of the ingredients. 206 00:09:46,040 --> 00:09:48,500 For the ECDSA signature scheme. 207 00:09:48,680 --> 00:09:49,600 We have the X's. 208 00:09:49,800 --> 00:09:50,760 We have the message. 209 00:09:51,020 --> 00:09:52,000 We have K1. 210 00:09:52,160 --> 00:09:54,240 We have the ECDSA constant L. 211 00:09:54,400 --> 00:09:56,400 The only thing that's missing is K2. 212 00:09:56,520 --> 00:09:58,800 So how does Bob finalize this thing? 213 00:09:59,000 --> 00:10:01,860 So he simply decrypts this value. 214 00:10:02,840 --> 00:10:05,740 Multiplies by his contribution to the ephemeral key. 215 00:10:05,920 --> 00:10:08,640 And reduces everything modulo L. 216 00:10:08,640 --> 00:10:09,600 At this point. 217 00:10:09,640 --> 00:10:12,960 He checks whether this thing is a valid signature. 218 00:10:13,180 --> 00:10:14,360 Why does he need to do that? 219 00:10:14,480 --> 00:10:15,960 Well he does this because you know. 220 00:10:16,220 --> 00:10:20,100 Maybe Alice fell asleep while during the signing process. 221 00:10:20,420 --> 00:10:22,540 And she forgot to multiply by her K1. 222 00:10:22,760 --> 00:10:23,800 At this point. 223 00:10:23,860 --> 00:10:26,780 Bob will fail to verify that the signature is valid. 224 00:10:27,040 --> 00:10:28,900 And Alice will be notified of this. 225 00:10:29,080 --> 00:10:30,720 Either because Bob tells her. 226 00:10:30,960 --> 00:10:33,640 Or because the signature never made it to the blockchain. 227 00:10:34,040 --> 00:10:35,560 So what happens in this case? 228 00:10:35,740 --> 00:10:37,100 Well to answer this question. 229 00:10:37,100 --> 00:10:40,800 We consult with the paper the protocol is based on. 230 00:10:40,960 --> 00:10:44,080 And the paper has a very interesting instruction. 231 00:10:45,800 --> 00:10:53,180 It says any abort will imply no later execution. 232 00:10:53,680 --> 00:10:56,500 Which means that if Bob detects an invalid signature. 233 00:10:56,820 --> 00:10:58,400 The wallet must be locked. 234 00:10:59,040 --> 00:11:01,500 Putting our adversarial hats on. 235 00:11:01,620 --> 00:11:02,980 We see this and we think. 236 00:11:03,080 --> 00:11:06,080 Well maybe we can leverage this into a denial of service attack. 237 00:11:06,080 --> 00:11:07,700 Maybe we can act as Alice. 238 00:11:08,020 --> 00:11:11,180 And send some garbage nonsense partial signature to Bob. 239 00:11:11,360 --> 00:11:13,260 And now the wallet is supposed to be locked. 240 00:11:13,460 --> 00:11:13,520 Right? 241 00:11:13,640 --> 00:11:15,640 So we went on to code this. 242 00:11:15,720 --> 00:11:17,560 We found some open source implementation. 243 00:11:17,760 --> 00:11:18,780 Of the 17. 244 00:11:19,740 --> 00:11:22,120 And we tried to do this. 245 00:11:22,600 --> 00:11:23,820 To our surprise. 246 00:11:24,340 --> 00:11:25,200 Nothing happened. 247 00:11:25,500 --> 00:11:27,120 Basically we tried again. 248 00:11:27,300 --> 00:11:27,840 And again. 249 00:11:27,980 --> 00:11:29,380 And the wallet was never locked. 250 00:11:29,960 --> 00:11:32,760 So we were kind of devastated by our failure. 251 00:11:33,000 --> 00:11:34,900 To mount some denial of service attack. 252 00:11:36,080 --> 00:11:36,600 To the drawing board. 253 00:11:36,720 --> 00:11:37,400 We're trying to understand. 254 00:11:37,520 --> 00:11:37,900 Wait. 255 00:11:38,400 --> 00:11:40,160 If this assumption. 256 00:11:40,440 --> 00:11:42,680 This instruction is part of the paper. 257 00:11:42,780 --> 00:11:44,760 Why is it there in the first place? 258 00:11:44,860 --> 00:11:47,040 So the paper is actually very clear. 259 00:11:47,080 --> 00:11:48,280 About why it's important. 260 00:11:48,640 --> 00:11:50,420 It says the only problem is. 261 00:11:50,800 --> 00:11:54,400 That Alice may send an incorrect partial signature to Bob. 262 00:11:54,660 --> 00:11:55,740 In which case. 263 00:11:55,780 --> 00:11:58,620 The mere fact that Bob aborts or not. 264 00:11:58,660 --> 00:12:00,460 Can leak a single bit. 265 00:12:00,500 --> 00:12:02,840 About Bob's private share of the key. 266 00:12:03,020 --> 00:12:03,500 Now. 267 00:12:06,080 --> 00:12:07,240 Taking it to its logical. 268 00:12:08,200 --> 00:12:08,700 Conclusion. 269 00:12:08,720 --> 00:12:11,380 We might think of an hypothetical attack. 270 00:12:11,500 --> 00:12:12,500 That looks something like this. 271 00:12:12,920 --> 00:12:15,520 First Alice would craft. 272 00:12:15,740 --> 00:12:16,740 A malicious signature. 273 00:12:16,920 --> 00:12:18,080 That would fail to verify. 274 00:12:18,180 --> 00:12:21,120 Depending on a single bit of Bob's key share. 275 00:12:21,360 --> 00:12:23,480 And then she will see if it verifies or not. 276 00:12:23,680 --> 00:12:25,000 Then she can do this again. 277 00:12:25,340 --> 00:12:26,080 And again. 278 00:12:26,440 --> 00:12:27,140 And again. 279 00:12:27,260 --> 00:12:30,860 Every time by seeing if the signature verified successfully. 280 00:12:31,020 --> 00:12:31,320 Or not. 281 00:12:31,360 --> 00:12:34,120 Knowing if that specific bit is one or zero. 282 00:12:36,080 --> 00:12:36,960 Then she can take these signatures later. 283 00:12:37,280 --> 00:12:37,760 Bam. 284 00:12:37,880 --> 00:12:40,160 She has the entire key share of Bob. 285 00:12:40,460 --> 00:12:41,700 She can combine it with her own. 286 00:12:41,880 --> 00:12:43,760 And sign away without his consent. 287 00:12:44,240 --> 00:12:46,040 So this is very easy. 288 00:12:46,140 --> 00:12:48,180 To do in PowerPoint with pictures. 289 00:12:48,460 --> 00:12:50,340 But to actually get the math to do this. 290 00:12:50,380 --> 00:12:51,880 You need a cryptographer like Nikos. 291 00:12:52,160 --> 00:12:54,920 So that's where we stopped relying on the paper. 292 00:12:55,120 --> 00:12:56,480 And we had to think for ourselves. 293 00:12:57,120 --> 00:12:58,280 And what we did is. 294 00:12:58,360 --> 00:13:00,960 We had a long hard look at the partial signature. 295 00:13:01,180 --> 00:13:02,620 That Alice sends to Bob. 296 00:13:02,620 --> 00:13:04,520 And we tried to mess around with it. 297 00:13:04,580 --> 00:13:07,340 We tried to tinker with the X. 298 00:13:07,600 --> 00:13:09,120 We tried to tinker with the message. 299 00:13:09,380 --> 00:13:10,320 Nothing happened. 300 00:13:10,520 --> 00:13:11,620 We tried to tinker with the K. 301 00:13:11,840 --> 00:13:12,860 Again nothing happened. 302 00:13:13,220 --> 00:13:16,660 But then the crypto gods smiled on us. 303 00:13:16,780 --> 00:13:18,760 Because we had the following breakthrough. 304 00:13:19,620 --> 00:13:20,240 We realized. 305 00:13:20,440 --> 00:13:23,080 That if Alice switches the modulus. 306 00:13:23,340 --> 00:13:25,400 So instead of using the L parameter. 307 00:13:25,520 --> 00:13:26,220 Of ECDSA. 308 00:13:26,460 --> 00:13:28,520 She uses the N public key. 309 00:13:28,640 --> 00:13:30,660 Of the homomorphic encryption scheme. 310 00:13:31,180 --> 00:13:32,600 These two values are equal. 311 00:13:32,620 --> 00:13:34,400 After Bob decrypts. 312 00:13:34,780 --> 00:13:36,160 If and only if. 313 00:13:36,440 --> 00:13:39,020 X2 modulo K1 is equal to 0. 314 00:13:39,220 --> 00:13:40,300 So I will spare you. 315 00:13:40,720 --> 00:13:42,800 The mathematical mumbo jumbo. 316 00:13:42,860 --> 00:13:44,220 And I will give it to you in a picture. 317 00:13:45,300 --> 00:13:45,780 Basically. 318 00:13:45,880 --> 00:13:47,860 When Alice switches the modulus. 319 00:13:47,940 --> 00:13:49,180 The following thing happens. 320 00:13:49,880 --> 00:13:51,240 If the signature is valid. 321 00:13:51,460 --> 00:13:53,000 X2 is divisible by K1. 322 00:13:53,240 --> 00:13:54,180 And I will remind you. 323 00:13:54,220 --> 00:13:56,080 That K1 is the value that Alice controls. 324 00:13:56,320 --> 00:13:56,940 And she knows. 325 00:13:57,400 --> 00:13:58,920 If the signature is invalid. 326 00:14:02,740 --> 00:14:03,520 And this is. 327 00:14:03,640 --> 00:14:05,720 This is very good for the attacker. 328 00:14:05,860 --> 00:14:07,620 Because this already gives a way. 329 00:14:07,760 --> 00:14:09,220 To learn the least significant bit. 330 00:14:09,460 --> 00:14:09,900 Why? 331 00:14:10,040 --> 00:14:12,800 Because Alice can simply set K1 equals 2. 332 00:14:13,160 --> 00:14:15,000 In this case she mounts the attack. 333 00:14:15,120 --> 00:14:16,240 She switches the modulus. 334 00:14:16,600 --> 00:14:19,040 And she obtains leakage X2 modulo 2. 335 00:14:19,300 --> 00:14:20,380 Equals 0 or not. 336 00:14:20,580 --> 00:14:22,680 And this is exactly Bob's least significant bit. 337 00:14:23,820 --> 00:14:24,260 Okay. 338 00:14:24,300 --> 00:14:25,140 So that's one bit. 339 00:14:25,280 --> 00:14:26,380 But what about the rest of them? 340 00:14:26,380 --> 00:14:27,740 So for the next bit. 341 00:14:27,900 --> 00:14:29,580 You can use the next power of 2. 342 00:14:29,780 --> 00:14:30,460 Namely 4. 343 00:14:32,100 --> 00:14:33,380 When you mount the attack. 344 00:14:33,560 --> 00:14:35,200 You obtain leakage whether 4. 345 00:14:35,600 --> 00:14:38,000 Whether X2 is divisible by 4. 346 00:14:38,160 --> 00:14:39,420 So this is great leakage. 347 00:14:39,660 --> 00:14:41,920 If X2 is already divisible by 2. 348 00:14:42,260 --> 00:14:43,160 Because if not. 349 00:14:43,220 --> 00:14:44,960 Then the leakage that you actually want. 350 00:14:45,180 --> 00:14:48,520 Is X2 minus 1 is divisible by 4. 351 00:14:48,740 --> 00:14:50,200 And to obtain this leakage. 352 00:14:50,460 --> 00:14:51,360 Well what you need to do. 353 00:14:51,440 --> 00:14:52,320 Is you need to do some math. 354 00:14:52,320 --> 00:14:54,240 You need to massage the algebra. 355 00:14:54,440 --> 00:14:55,760 You need to add an offset. 356 00:14:55,860 --> 00:14:57,040 To the partial signature. 357 00:14:58,140 --> 00:15:00,240 An offset that depends on. 358 00:15:00,360 --> 00:15:02,520 Whatever you already know of Bob's key. 359 00:15:02,740 --> 00:15:04,280 And this will give you the leakage. 360 00:15:04,320 --> 00:15:05,440 That you actually want. 361 00:15:05,780 --> 00:15:06,900 So to summarize. 362 00:15:07,620 --> 00:15:10,160 In order to exfiltrate the ith bit. 363 00:15:10,420 --> 00:15:11,980 You set K to be. 364 00:15:12,060 --> 00:15:13,380 The ith power of 2. 365 00:15:13,840 --> 00:15:17,100 You offset Alice's partial signature. 366 00:15:17,500 --> 00:15:18,600 By a value. 367 00:15:18,660 --> 00:15:20,540 That depends on whatever you already know. 368 00:15:20,620 --> 00:15:21,560 About Bob's key. 369 00:15:22,320 --> 00:15:22,840 And in the end. 370 00:15:22,860 --> 00:15:24,780 Depending on whether the signature fails or not. 371 00:15:24,880 --> 00:15:26,000 You obtain leakage. 372 00:15:26,400 --> 00:15:28,780 The ith bit of Bob's key share. 373 00:15:29,500 --> 00:15:31,120 We didn't leave it at this. 374 00:15:31,280 --> 00:15:32,800 And we wanted to see if it would actually work. 375 00:15:32,980 --> 00:15:33,880 So we went out. 376 00:15:33,940 --> 00:15:36,300 We found the most popular open source implementation. 377 00:15:36,520 --> 00:15:38,500 Of the Lindel 17 protocol. 378 00:15:38,820 --> 00:15:39,980 It was published by Zango. 379 00:15:40,320 --> 00:15:42,300 And we tried to see if we could make it work. 380 00:15:42,600 --> 00:15:44,480 So this is how the POC looks when it's run. 381 00:15:44,840 --> 00:15:47,440 As you can see on the right hand side of the screen. 382 00:15:47,660 --> 00:15:49,860 Every signature leaks us a single bit. 383 00:15:50,080 --> 00:15:52,060 Of Bob's private key share. 384 00:15:52,320 --> 00:15:54,540 Depending on whether the signature failed or not. 385 00:15:54,600 --> 00:15:56,080 We know whether it's 1 or 0. 386 00:15:56,500 --> 00:15:59,540 We only need to do this 256 times. 387 00:15:59,780 --> 00:16:00,740 Now it may sound a lot. 388 00:16:00,840 --> 00:16:02,140 But it only takes a couple of minutes. 389 00:16:03,100 --> 00:16:04,400 And bit by bit. 390 00:16:04,480 --> 00:16:05,900 We leak his entire key. 391 00:16:06,000 --> 00:16:08,700 Now we can combine it with our share of the key. 392 00:16:08,800 --> 00:16:10,280 And we have the entire private share. 393 00:16:10,420 --> 00:16:12,220 We can print it in hexadecimal format. 394 00:16:12,360 --> 00:16:14,480 Load it to Metamask or your favorite crypto wallet. 395 00:16:14,900 --> 00:16:15,560 And you're done. 396 00:16:16,580 --> 00:16:18,040 So we've disclosed this. 397 00:16:18,160 --> 00:16:20,320 To all the affected vendors. 398 00:16:20,520 --> 00:16:22,240 And they've since mitigated it. 399 00:16:22,320 --> 00:16:23,780 How did they do that? 400 00:16:23,980 --> 00:16:24,160 Well. 401 00:16:24,580 --> 00:16:27,880 They simply followed the paper's specification. 402 00:16:28,420 --> 00:16:29,480 So like. 403 00:16:31,400 --> 00:16:34,060 After you see that there was a failed signature. 404 00:16:34,240 --> 00:16:35,540 Just don't sign again. 405 00:16:35,920 --> 00:16:37,900 Now this works. 406 00:16:38,100 --> 00:16:39,120 It mitigates the attack. 407 00:16:39,500 --> 00:16:41,060 But there are also other ways. 408 00:16:41,160 --> 00:16:43,660 That you might want to do it. 409 00:16:43,760 --> 00:16:47,720 Where you don't get a possibility of a denial of service attack. 410 00:16:47,980 --> 00:16:50,080 And to explain a possible way of doing that. 411 00:16:50,080 --> 00:16:52,500 We'll need to introduce a new cryptographic primitive. 412 00:16:52,960 --> 00:16:54,360 It's called a zero-knowledge proof. 413 00:16:54,660 --> 00:16:56,100 What is a zero-knowledge proof? 414 00:16:56,440 --> 00:16:59,440 Basically it's a proof that yields the validity of a statement. 415 00:16:59,560 --> 00:17:00,920 And nothing else. 416 00:17:01,240 --> 00:17:02,980 So to illustrate with an example. 417 00:17:03,320 --> 00:17:06,760 Let's say Alice encrypts some number X. 418 00:17:06,960 --> 00:17:08,940 Along with a zero-knowledge proof. 419 00:17:09,280 --> 00:17:11,820 That that number is within some range. 420 00:17:11,960 --> 00:17:13,000 For example 1 to 42. 421 00:17:13,360 --> 00:17:14,820 Now Bob can receive this. 422 00:17:14,900 --> 00:17:16,600 And verify the zero-knowledge proof. 423 00:17:16,860 --> 00:17:18,500 And be certain that what he has. 424 00:17:18,540 --> 00:17:20,060 Is indeed a knowledge proof. 425 00:17:20,080 --> 00:17:22,220 He has an encryption of a number between 1 and 42. 426 00:17:22,440 --> 00:17:23,940 But he knows nothing else. 427 00:17:24,100 --> 00:17:26,760 Only what the zero-knowledge proof wanted him to know. 428 00:17:27,080 --> 00:17:29,920 So taking the intuition of this thing. 429 00:17:30,180 --> 00:17:33,080 We could maybe add a zero-knowledge proof. 430 00:17:33,300 --> 00:17:34,200 To the protocol. 431 00:17:34,460 --> 00:17:36,920 In order to make sure that Alice cannot deviate. 432 00:17:37,180 --> 00:17:39,200 From calculating the partial signature. 433 00:17:39,380 --> 00:17:41,700 In the way the protocol says she needs to do. 434 00:17:42,660 --> 00:17:43,660 Well, congratulations. 435 00:17:43,960 --> 00:17:46,100 You've learned how to compromise implementations. 436 00:17:46,120 --> 00:17:48,140 Of the most popular two-party signing protocol. 437 00:17:48,420 --> 00:17:49,840 And also how to mitigate it. 438 00:17:49,920 --> 00:17:50,060 And also how to mitigate it. 439 00:17:50,080 --> 00:17:52,980 And we're on to our second attack of the day. 440 00:17:53,040 --> 00:17:53,440 And we're on to our second attack of the day. 441 00:17:53,440 --> 00:17:58,140 Which is attacking the most popular multi-party signing protocol. 442 00:17:58,320 --> 00:18:00,220 Meaning it can be two parties, three parties. 443 00:18:00,300 --> 00:18:01,380 Or a hundred even. 444 00:18:01,620 --> 00:18:05,820 So this has affected many vendors in open source projects. 445 00:18:06,220 --> 00:18:09,560 So when we talked about the Lindel 17 protocol. 446 00:18:09,560 --> 00:18:10,080 So when we talked about the Lindel 17 protocol. 447 00:18:10,280 --> 00:18:11,760 We actually explained how it works. 448 00:18:11,840 --> 00:18:12,700 Like start to finish. 449 00:18:12,940 --> 00:18:14,460 But the Digi protocols. 450 00:18:14,700 --> 00:18:16,660 The thing with them is they're very complicated. 451 00:18:16,940 --> 00:18:17,280 They actually. 452 00:18:20,080 --> 00:18:21,740 They have seven and nine rounds of communication. 453 00:18:22,120 --> 00:18:24,460 So we don't have time to explain all that. 454 00:18:24,620 --> 00:18:25,740 And actually we don't even need to. 455 00:18:25,820 --> 00:18:29,060 Because the entire thing happens during the very first round. 456 00:18:29,320 --> 00:18:29,740 Because the entire thing happens during the very first round. 457 00:18:29,740 --> 00:18:31,660 The very first round implements what's called. 458 00:18:31,720 --> 00:18:32,860 A multiplication to addition. 459 00:18:33,060 --> 00:18:34,420 So let's dive into that. 460 00:18:34,760 --> 00:18:35,660 What is it? 461 00:18:35,800 --> 00:18:39,320 It's a way to transform two multiplicative shares. 462 00:18:39,600 --> 00:18:40,880 K and X. 463 00:18:41,100 --> 00:18:42,620 Into two additive shares. 464 00:18:42,960 --> 00:18:44,360 Alpha and beta. 465 00:18:44,500 --> 00:18:45,860 Where this equation applies. 466 00:18:46,440 --> 00:18:49,260 So how does the paper say that you could do that? 467 00:18:50,080 --> 00:18:51,900 It says that Alice needs to encrypt. 468 00:18:51,920 --> 00:18:53,640 Her multiplicative share K. 469 00:18:53,920 --> 00:18:55,500 Along with a zero knowledge proof. 470 00:18:55,760 --> 00:18:56,780 For doing just that. 471 00:18:57,320 --> 00:18:58,600 And send it over to Bob. 472 00:18:59,060 --> 00:19:01,140 Bob now can operate on this. 473 00:19:01,900 --> 00:19:03,020 Homomorphically encrypted value. 474 00:19:03,340 --> 00:19:04,360 He doesn't know what it is. 475 00:19:04,440 --> 00:19:06,940 But he can multiply his multiplicative share. 476 00:19:07,080 --> 00:19:07,620 His X. 477 00:19:07,800 --> 00:19:11,920 And to make sure that Alice doesn't learn anything about his X. 478 00:19:12,020 --> 00:19:12,740 Because that would be terrible. 479 00:19:13,080 --> 00:19:14,740 He adds a mask to mask it. 480 00:19:15,180 --> 00:19:16,500 Now Alice decrypts this. 481 00:19:16,500 --> 00:19:17,360 She gets alpha. 482 00:19:17,580 --> 00:19:20,220 Bob gets beta by being equal to minus mask. 483 00:19:20,460 --> 00:19:21,100 And as you can see. 484 00:19:21,360 --> 00:19:24,600 It so happens that K times X. 485 00:19:24,640 --> 00:19:26,240 Is equal to alpha plus beta. 486 00:19:26,780 --> 00:19:28,380 There's one very important thing. 487 00:19:28,480 --> 00:19:29,420 That we need to know about this. 488 00:19:30,540 --> 00:19:32,060 In the case of ECDSA. 489 00:19:32,160 --> 00:19:34,320 Where X and K are 256 bits. 490 00:19:34,460 --> 00:19:36,360 The mask needs to be sufficiently large. 491 00:19:36,460 --> 00:19:38,000 It needs to be bigger than 512. 492 00:19:38,480 --> 00:19:39,600 Now why is that? 493 00:19:39,700 --> 00:19:41,880 To give an intuition of how this masking works. 494 00:19:42,000 --> 00:19:44,760 We're going to use some visualization of small numbers. 495 00:19:45,140 --> 00:19:45,720 Let's say. 496 00:19:46,500 --> 00:19:47,600 We didn't even use a mask. 497 00:19:47,700 --> 00:19:49,680 If Alice would decrypt and get this value. 498 00:19:49,800 --> 00:19:51,640 X times K. 499 00:19:51,860 --> 00:19:52,660 She knows K. 500 00:19:52,760 --> 00:19:55,140 She could just divide it by the K she knows. 501 00:19:55,180 --> 00:19:56,020 And get X in the clear. 502 00:19:56,240 --> 00:19:58,140 That's why we need that mask. 503 00:19:58,880 --> 00:20:00,980 Adding the mask actually works. 504 00:20:01,300 --> 00:20:01,860 It masks it. 505 00:20:02,020 --> 00:20:02,920 Although she knows K. 506 00:20:03,040 --> 00:20:03,780 She doesn't know the mask. 507 00:20:03,920 --> 00:20:06,500 So she can't learn anything about Bob's X. 508 00:20:07,800 --> 00:20:10,080 But what happens if that's not the case? 509 00:20:10,180 --> 00:20:11,320 What happens for example. 510 00:20:11,900 --> 00:20:14,720 If K is even larger than the mask itself. 511 00:20:16,500 --> 00:20:16,660 In this case. 512 00:20:16,660 --> 00:20:18,700 We can see that adding the mask. 513 00:20:19,940 --> 00:20:21,220 Actually hides nothing. 514 00:20:21,440 --> 00:20:23,120 Like the most significant bits. 515 00:20:23,480 --> 00:20:24,840 Leak X in the clear. 516 00:20:25,240 --> 00:20:28,640 Now this could be a really great attack. 517 00:20:28,820 --> 00:20:28,940 Right? 518 00:20:29,040 --> 00:20:29,840 Like we could be Alice. 519 00:20:30,040 --> 00:20:31,640 We could choose a really big K. 520 00:20:31,760 --> 00:20:32,760 That's larger than the mask. 521 00:20:33,040 --> 00:20:33,880 Send it over. 522 00:20:34,340 --> 00:20:35,000 Decrypt this. 523 00:20:35,160 --> 00:20:37,400 And get everyone's key share in one go. 524 00:20:38,860 --> 00:20:41,280 But remember that zero knowledge proof that I mentioned. 525 00:20:41,400 --> 00:20:42,240 That she's sending over. 526 00:20:46,500 --> 00:20:47,180 Is a zero knowledge proof. 527 00:20:47,320 --> 00:20:49,320 That ensures that the number K. 528 00:20:49,700 --> 00:20:52,240 Is no bigger than 256 bits. 529 00:20:52,380 --> 00:20:53,840 Which kind of foils our entire. 530 00:20:54,140 --> 00:20:55,200 Plan of attack here. 531 00:20:56,060 --> 00:20:58,280 So we're going to get deeper into. 532 00:20:58,400 --> 00:20:59,860 The math of the zero knowledge proof. 533 00:21:00,200 --> 00:21:00,960 Hold on tight. 534 00:21:01,620 --> 00:21:02,720 How does it look like? 535 00:21:03,120 --> 00:21:04,520 Basically it's a bunch of numbers. 536 00:21:04,760 --> 00:21:07,140 The number Z is the one that will be focused on. 537 00:21:07,260 --> 00:21:09,140 Because that's the one that relates to the range proof. 538 00:21:09,280 --> 00:21:09,940 Part of the proof. 539 00:21:10,320 --> 00:21:11,500 Now how is Z calculated? 540 00:21:12,560 --> 00:21:13,960 It's equal to W. 541 00:21:16,500 --> 00:21:16,660 K. 542 00:21:16,720 --> 00:21:18,680 Which is the number Alice is trying to prove. 543 00:21:18,720 --> 00:21:19,680 Is sufficiently small. 544 00:21:20,560 --> 00:21:22,120 Times the hash that depends on W. 545 00:21:22,360 --> 00:21:25,220 Now when Bob receives this. 546 00:21:25,360 --> 00:21:26,900 He does a bunch of verifications. 547 00:21:27,040 --> 00:21:28,980 Over the other parts of the proof. 548 00:21:29,080 --> 00:21:30,000 That we're not going to touch on. 549 00:21:30,300 --> 00:21:32,380 And he makes sure that Z is small. 550 00:21:32,880 --> 00:21:33,860 Now as you can see. 551 00:21:33,940 --> 00:21:35,340 If K will be too large. 552 00:21:35,520 --> 00:21:37,520 Then Z will not be small enough. 553 00:21:37,660 --> 00:21:39,300 It will fail the range proof part of the proof. 554 00:21:39,720 --> 00:21:40,860 Now I just want to stress. 555 00:21:40,860 --> 00:21:42,900 That Alice has to follow. 556 00:21:42,960 --> 00:21:44,380 This specific formula. 557 00:21:44,400 --> 00:21:45,520 For calculating Z. 558 00:21:45,700 --> 00:21:46,500 Because if she doesn't. 559 00:21:46,500 --> 00:21:48,840 Some of the other verifications will fail. 560 00:21:49,260 --> 00:21:52,040 So how can we go about cheating. 561 00:21:52,320 --> 00:21:54,420 In this zero knowledge range proof. 562 00:21:54,640 --> 00:21:56,660 While adhering to this formula. 563 00:21:56,700 --> 00:21:57,480 Of calculating Z. 564 00:21:58,300 --> 00:21:59,240 What we're going to do. 565 00:21:59,320 --> 00:22:01,380 Is we're going to focus on this part of the equation. 566 00:22:01,680 --> 00:22:03,900 And we're actually going to try and zero it out. 567 00:22:04,120 --> 00:22:06,380 If we somehow manage to zero it out. 568 00:22:06,500 --> 00:22:08,480 Then it doesn't matter how big K is. 569 00:22:08,700 --> 00:22:10,100 Z is only equal to W. 570 00:22:10,960 --> 00:22:13,420 And we can use whatever big K we want. 571 00:22:13,520 --> 00:22:14,320 And pass the verification. 572 00:22:15,100 --> 00:22:16,240 So how will we do that? 573 00:22:16,760 --> 00:22:18,200 We're going to use what's called. 574 00:22:18,280 --> 00:22:19,560 The Chinese remainder theorem. 575 00:22:19,780 --> 00:22:21,180 For this use case. 576 00:22:21,580 --> 00:22:23,960 Because as Nikos mentioned earlier. 577 00:22:24,240 --> 00:22:26,240 N is a product of two primes P and Q. 578 00:22:26,860 --> 00:22:29,080 If this value we're trying to zero out. 579 00:22:29,200 --> 00:22:30,960 Modulo P and modulo Q. 580 00:22:31,100 --> 00:22:32,040 They both zero out. 581 00:22:32,220 --> 00:22:33,620 Then it also implies. 582 00:22:33,840 --> 00:22:35,800 That the value we're trying to zero out. 583 00:22:36,400 --> 00:22:36,980 Zeroes out. 584 00:22:37,220 --> 00:22:38,760 So we're going to use this lens. 585 00:22:40,860 --> 00:22:42,360 To zero out the left hand equations. 586 00:22:42,400 --> 00:22:43,640 One by one. 587 00:22:43,820 --> 00:22:45,080 And by doing so. 588 00:22:45,280 --> 00:22:46,980 We'll achieve our goal. 589 00:22:47,080 --> 00:22:48,280 Of zeroing out the right hand equation. 590 00:22:48,960 --> 00:22:50,240 So one by one. 591 00:22:50,360 --> 00:22:51,420 We start with the first one. 592 00:22:51,560 --> 00:22:53,080 It's actually surprisingly simple. 593 00:22:53,440 --> 00:22:57,240 Because Alice is free to choose whatever K she wants. 594 00:22:57,700 --> 00:22:59,380 How about she chooses K to be equal to Q. 595 00:22:59,780 --> 00:23:01,140 Then by definition. 596 00:23:01,220 --> 00:23:02,660 Q mod Q zeroes out. 597 00:23:02,800 --> 00:23:04,180 And we're half way there. 598 00:23:04,340 --> 00:23:05,760 The easy half though. 599 00:23:05,760 --> 00:23:07,940 So how do we go about the second part. 600 00:23:08,120 --> 00:23:09,800 How do we zero out this value. 601 00:23:09,920 --> 00:23:10,660 Modulo P. 602 00:23:11,440 --> 00:23:13,980 What happens if this hash. 603 00:23:14,160 --> 00:23:14,920 That depends on W. 604 00:23:15,080 --> 00:23:17,680 Happens to organically land on. 605 00:23:17,800 --> 00:23:19,020 A multiple of P. 606 00:23:19,220 --> 00:23:21,060 Well that would be fantastic right. 607 00:23:21,200 --> 00:23:22,820 So is it likely to happen. 608 00:23:22,940 --> 00:23:23,100 No. 609 00:23:23,220 --> 00:23:26,600 But what if we brute force W. 610 00:23:26,800 --> 00:23:28,640 Such as the hash that depends on it. 611 00:23:28,700 --> 00:23:30,420 Happens to be a multiple of P. 612 00:23:30,900 --> 00:23:33,200 Is this feasible you might ask yourself. 613 00:23:33,580 --> 00:23:34,880 The question is no. 614 00:23:35,760 --> 00:23:36,140 Not at all feasible. 615 00:23:36,300 --> 00:23:37,580 Because the paper says that. 616 00:23:37,620 --> 00:23:39,860 N needs to be 2048 bits. 617 00:23:39,960 --> 00:23:42,100 Which makes P and Q both over 1000 bits. 618 00:23:42,380 --> 00:23:44,320 Now that's impossible to brute force. 619 00:23:44,580 --> 00:23:46,160 And if we could brute force that right. 620 00:23:46,240 --> 00:23:47,500 We might as well just brute force X. 621 00:23:47,600 --> 00:23:48,800 Which is 256 bits. 622 00:23:49,080 --> 00:23:50,420 So what can we do. 623 00:23:51,160 --> 00:23:51,900 How about. 624 00:23:52,460 --> 00:23:54,740 During the key generation phase. 625 00:23:54,900 --> 00:23:56,100 Which happens once per wallet. 626 00:23:57,000 --> 00:23:59,440 Alice instead of choosing N. 627 00:23:59,620 --> 00:24:02,800 To be comprised of two equally sized prime numbers. 628 00:24:03,000 --> 00:24:03,760 She would choose. 629 00:24:06,020 --> 00:24:07,580 Asymmetrically sized prime numbers. 630 00:24:07,700 --> 00:24:09,880 Whereas P can be as small as 16 bits. 631 00:24:10,020 --> 00:24:11,700 Which is brute forceable in an instant. 632 00:24:11,900 --> 00:24:13,780 And we can have Q to be sufficiently large. 633 00:24:13,820 --> 00:24:15,420 To make up for the desired size of N. 634 00:24:15,680 --> 00:24:17,600 Now some of you might be thinking. 635 00:24:17,780 --> 00:24:19,700 Well maybe the protocol says. 636 00:24:19,820 --> 00:24:20,880 That there is a zero knowledge proof. 637 00:24:21,000 --> 00:24:22,740 To prevent us from choosing such an N. 638 00:24:22,820 --> 00:24:25,800 It turns out that there is no zero knowledge proof. 639 00:24:26,000 --> 00:24:28,180 That prevents us from using such an N. 640 00:24:28,320 --> 00:24:29,800 There is no ZKP. 641 00:24:29,880 --> 00:24:31,160 For no small factors. 642 00:24:31,540 --> 00:24:33,100 The only thing that the parties check. 643 00:24:33,300 --> 00:24:34,840 Is whether N is square free. 644 00:24:35,760 --> 00:24:37,180 We are not going to get into the technical definition. 645 00:24:37,500 --> 00:24:38,760 Of square freeness. 646 00:24:38,900 --> 00:24:41,580 But it sounds like we have a way. 647 00:24:41,640 --> 00:24:42,240 We have a hook. 648 00:24:42,380 --> 00:24:43,820 We have a way to get the goods. 649 00:24:44,320 --> 00:24:47,200 We can inject this N with a very small P. 650 00:24:47,360 --> 00:24:49,240 Then we can choose K to be equal to Q. 651 00:24:49,460 --> 00:24:51,140 Then we can cheat in the range proof. 652 00:24:51,340 --> 00:24:52,900 And then when we receive the MTA response. 653 00:24:53,280 --> 00:24:55,180 We can get all the X's in the clear. 654 00:24:55,920 --> 00:24:56,880 So are we done? 655 00:24:57,260 --> 00:24:58,080 Not so fast. 656 00:24:58,300 --> 00:25:01,060 Because remember the MTA formula. 657 00:25:01,280 --> 00:25:03,280 So this is what Alice obtains. 658 00:25:03,520 --> 00:25:04,600 During the MTA. 659 00:25:05,760 --> 00:25:06,300 Well in reality. 660 00:25:06,500 --> 00:25:09,440 There is a pesky modulo N operation. 661 00:25:09,740 --> 00:25:11,440 Happening there implicitly. 662 00:25:11,840 --> 00:25:13,520 And it's unavoidable. 663 00:25:13,620 --> 00:25:15,300 I'm not going to get into why it's unavoidable. 664 00:25:15,420 --> 00:25:16,200 But it's unavoidable. 665 00:25:16,320 --> 00:25:18,720 And it's very annoying for the following reason. 666 00:25:19,180 --> 00:25:21,760 K is now almost as big as N. 667 00:25:21,860 --> 00:25:23,200 And what happens to the leakage. 668 00:25:23,280 --> 00:25:25,180 When K is almost as big as N. 669 00:25:25,300 --> 00:25:27,460 So let's have a look at K times X. 670 00:25:27,500 --> 00:25:28,100 Plus the mask. 671 00:25:28,380 --> 00:25:30,980 Here we see the beautiful X. 672 00:25:31,100 --> 00:25:32,720 And the most significant bits in the clear. 673 00:25:33,080 --> 00:25:33,520 However. 674 00:25:35,760 --> 00:25:35,900 In the MTA operator. 675 00:25:36,420 --> 00:25:38,520 The most significant bits of X. 676 00:25:38,640 --> 00:25:39,860 They disappear. 677 00:25:40,260 --> 00:25:41,380 They jump off a cliff. 678 00:25:41,520 --> 00:25:42,080 They go bye bye. 679 00:25:42,300 --> 00:25:43,820 And the only thing that remains. 680 00:25:44,380 --> 00:25:46,680 Is a small leakage of X. 681 00:25:46,820 --> 00:25:47,360 How small? 682 00:25:47,620 --> 00:25:50,120 What Alice obtains using this attack. 683 00:25:50,280 --> 00:25:51,360 Is X mod P. 684 00:25:51,580 --> 00:25:53,500 And P is a 16 bit prime. 685 00:25:54,600 --> 00:25:56,120 If only there were a way. 686 00:25:56,240 --> 00:25:58,720 To obtain X from such remainders. 687 00:25:59,400 --> 00:26:00,600 Worry not Nikos. 688 00:26:00,600 --> 00:26:01,620 Once again. 689 00:26:01,800 --> 00:26:04,460 The Chinese remainder theorem comes to our rescue. 690 00:26:04,640 --> 00:26:07,160 Now let's explain how it works a bit more in depth. 691 00:26:07,420 --> 00:26:08,920 Let's say we have this small number. 692 00:26:09,020 --> 00:26:10,040 X which is 23. 693 00:26:10,340 --> 00:26:12,420 We can encode it in a myriad of ways. 694 00:26:12,880 --> 00:26:14,140 Like we can also in the screen. 695 00:26:14,260 --> 00:26:15,360 We can encode it decimally. 696 00:26:15,540 --> 00:26:17,100 We can also encode it hexadecimally. 697 00:26:17,260 --> 00:26:19,420 We can actually also use CRT. 698 00:26:19,800 --> 00:26:20,900 To encode a number. 699 00:26:21,140 --> 00:26:23,040 Now how would one go about doing that? 700 00:26:23,520 --> 00:26:25,920 You need to divide this number. 701 00:26:26,100 --> 00:26:28,620 By a few small primes. 702 00:26:28,700 --> 00:26:29,640 And save the remainder. 703 00:26:30,600 --> 00:26:32,540 Now just using this information. 704 00:26:32,780 --> 00:26:33,800 The primes and the remainders. 705 00:26:33,840 --> 00:26:35,740 You can feed them into CRT. 706 00:26:35,920 --> 00:26:38,600 To reconstruct the original number fully. 707 00:26:39,020 --> 00:26:40,620 Now it looks a bit like magic. 708 00:26:40,840 --> 00:26:42,180 But it also has some limitations. 709 00:26:42,800 --> 00:26:43,240 Namely. 710 00:26:43,280 --> 00:26:45,220 It would only work to encode a number. 711 00:26:45,280 --> 00:26:47,440 That is smaller than the product of the primes. 712 00:26:47,600 --> 00:26:48,440 In this example. 713 00:26:48,520 --> 00:26:50,740 Using the primes 3, 5 and 7. 714 00:26:50,860 --> 00:26:52,740 You could only encode a number as big as 105. 715 00:26:53,880 --> 00:26:55,260 We're trying to encode a number. 716 00:26:55,280 --> 00:26:57,360 As big as 256 bits. 717 00:26:57,520 --> 00:26:58,340 So to do that. 718 00:27:00,600 --> 00:27:01,100 We need a number of primes. 719 00:27:01,200 --> 00:27:03,060 That are each 16 bits of size. 720 00:27:03,560 --> 00:27:06,080 So if we can get these 16 reminders. 721 00:27:06,240 --> 00:27:08,180 By the leakage that we explained earlier. 722 00:27:08,480 --> 00:27:10,060 And feed them all into CRT. 723 00:27:10,280 --> 00:27:13,380 We have Bob's key share. 724 00:27:13,460 --> 00:27:14,180 That could work. 725 00:27:14,700 --> 00:27:15,840 Anything stopping us? 726 00:27:16,600 --> 00:27:17,160 Yes. 727 00:27:17,680 --> 00:27:20,000 We only have one N. 728 00:27:20,500 --> 00:27:21,060 Remember? 729 00:27:21,300 --> 00:27:24,300 While K is chosen afresh during every signature generation. 730 00:27:24,700 --> 00:27:26,620 N is chosen once per wallet. 731 00:27:26,720 --> 00:27:28,300 During the key generation phase. 732 00:27:28,460 --> 00:27:29,860 So we only have one P value. 733 00:27:30,600 --> 00:27:31,680 We can only do this. 734 00:27:31,700 --> 00:27:33,200 To achieve the very first leakage. 735 00:27:34,520 --> 00:27:35,040 So. 736 00:27:35,720 --> 00:27:36,660 Bear with me. 737 00:27:37,500 --> 00:27:38,300 What if. 738 00:27:38,980 --> 00:27:41,380 During the key generation phase. 739 00:27:41,760 --> 00:27:42,260 Alice. 740 00:27:42,640 --> 00:27:46,160 Instead of choosing N to be this handsome looking value. 741 00:27:46,280 --> 00:27:47,880 That is a product of two primes. 742 00:27:48,120 --> 00:27:50,600 She would choose N to be this monstrosity. 743 00:27:51,420 --> 00:27:53,780 That is a product of 16 small primes. 744 00:27:53,880 --> 00:27:54,400 Plus. 745 00:27:54,720 --> 00:27:55,240 Times. 746 00:27:55,540 --> 00:27:58,660 A prime that is as big to make up for the desired size of N. 747 00:27:59,040 --> 00:27:59,560 Well. 748 00:28:00,600 --> 00:28:01,040 You might be wondering. 749 00:28:01,220 --> 00:28:01,600 Well. 750 00:28:01,700 --> 00:28:03,860 Isn't there some zero knowledge proof in the protocol. 751 00:28:04,000 --> 00:28:05,760 To make sure that you can choose this monstrosity. 752 00:28:05,920 --> 00:28:08,420 It turns out that there is no zero knowledge proof. 753 00:28:08,620 --> 00:28:10,100 Before checking the bi-primality. 754 00:28:10,360 --> 00:28:11,960 Because the only thing that the parties check. 755 00:28:12,200 --> 00:28:13,840 Is whether N is square free. 756 00:28:14,000 --> 00:28:16,460 And I'm still not telling you what square freeness is. 757 00:28:16,760 --> 00:28:17,060 So. 758 00:28:18,220 --> 00:28:19,340 We're at the finish line. 759 00:28:19,580 --> 00:28:21,500 We can extract all of these moduli. 760 00:28:21,740 --> 00:28:23,220 By injecting the N. 761 00:28:23,420 --> 00:28:24,600 And then choosing the K. 762 00:28:24,860 --> 00:28:26,300 And then cheating in the range proof. 763 00:28:30,600 --> 00:28:32,020 When we have the normal looking N. 764 00:28:32,160 --> 00:28:33,640 We set K equals Q. 765 00:28:33,860 --> 00:28:35,740 And we obtain leakage X mod P. 766 00:28:36,160 --> 00:28:38,040 Now that we have the bizarro N. 767 00:28:38,220 --> 00:28:40,340 We set K equals N over PI. 768 00:28:40,620 --> 00:28:42,520 And we obtain leakage X mod PI. 769 00:28:42,780 --> 00:28:44,040 And we need to do this. 770 00:28:44,080 --> 00:28:46,360 In 16 different signature generations. 771 00:28:47,140 --> 00:28:48,860 16 different signature sessions. 772 00:28:49,300 --> 00:28:50,300 In the first one. 773 00:28:50,400 --> 00:28:51,880 We're going to use the first K. 774 00:28:52,040 --> 00:28:53,360 It's going to give us X mod P1. 775 00:28:53,600 --> 00:28:54,460 In the second one. 776 00:28:54,500 --> 00:28:55,620 We're going to use the second K. 777 00:28:55,620 --> 00:28:56,920 It's going to give us X mod P2. 778 00:28:57,040 --> 00:28:58,320 And so on and so forth. 779 00:28:58,420 --> 00:29:00,840 Until we get the 16th leakage. 780 00:29:01,220 --> 00:29:04,040 We feed everything into the CRT algorithm. 781 00:29:04,300 --> 00:29:05,160 And we obtain. 782 00:29:05,300 --> 00:29:06,520 X in the clear. 783 00:29:07,260 --> 00:29:07,780 So. 784 00:29:08,020 --> 00:29:08,780 Once again. 785 00:29:08,900 --> 00:29:12,500 We went to see if this crazy idea would work. 786 00:29:12,660 --> 00:29:14,100 We found an open source implementation. 787 00:29:14,560 --> 00:29:16,520 Of the GG20 protocol. 788 00:29:16,960 --> 00:29:18,300 And we gave it a try. 789 00:29:18,580 --> 00:29:19,020 So. 790 00:29:19,120 --> 00:29:21,800 We start by choosing 16 small primes. 791 00:29:21,820 --> 00:29:23,560 To make our bizarro N. 792 00:29:25,620 --> 00:29:25,960 We choose K. 793 00:29:26,080 --> 00:29:27,720 We cheat in the range proof. 794 00:29:27,880 --> 00:29:29,100 And we get the desired leakage. 795 00:29:29,460 --> 00:29:30,860 Now we need to do this. 796 00:29:30,980 --> 00:29:32,520 We need to sign 16 times. 797 00:29:32,600 --> 00:29:34,560 Each time getting one of those leakages. 798 00:29:34,840 --> 00:29:38,040 And then we can feed all of this information into CRT. 799 00:29:38,180 --> 00:29:38,900 Once again. 800 00:29:40,100 --> 00:29:41,500 Combine it with our own key share. 801 00:29:41,720 --> 00:29:43,700 And we can print the full private key. 802 00:29:43,800 --> 00:29:45,220 In a beautiful hexadecimal format. 803 00:29:45,480 --> 00:29:46,120 Load it up. 804 00:29:46,400 --> 00:29:47,000 Spend away. 805 00:29:47,120 --> 00:29:50,000 No need for consent of any of the other parties. 806 00:29:51,300 --> 00:29:52,000 Once again. 807 00:29:55,620 --> 00:29:56,940 We have mitigated this attack. 808 00:29:57,240 --> 00:29:59,700 How would you go about mitigating such an attack? 809 00:30:00,100 --> 00:30:00,400 Well. 810 00:30:00,600 --> 00:30:03,360 You could add those zero-knowledge proofs. 811 00:30:03,360 --> 00:30:05,520 For making sure the well-formedness of N. 812 00:30:05,680 --> 00:30:08,240 So Alice can choose this bizarro N. 813 00:30:08,340 --> 00:30:10,180 That is needed to carry out the attack. 814 00:30:10,720 --> 00:30:11,200 Well. 815 00:30:11,580 --> 00:30:12,060 Congratulations. 816 00:30:12,320 --> 00:30:14,260 We're done with the second attack. 817 00:30:14,440 --> 00:30:16,340 We're on to the third and last. 818 00:30:16,840 --> 00:30:17,320 Great. 819 00:30:17,380 --> 00:30:18,540 So in the last few minutes. 820 00:30:18,620 --> 00:30:20,460 We will show you how to compromise. 821 00:30:21,060 --> 00:30:23,360 What we call a do-it-yourself protocol. 822 00:30:25,640 --> 00:30:26,700 For this protocol. 823 00:30:26,840 --> 00:30:29,500 We will be exfiltrating the key in a single signature. 824 00:30:29,800 --> 00:30:30,280 Actually. 825 00:30:31,000 --> 00:30:32,820 We're going to do that in less than a signature. 826 00:30:33,020 --> 00:30:35,640 We're going to do it in the first round of the first signature generation. 827 00:30:36,100 --> 00:30:37,880 So what does the protocol look like? 828 00:30:37,980 --> 00:30:40,280 So it is also an MTA based protocol. 829 00:30:40,680 --> 00:30:41,160 However. 830 00:30:41,340 --> 00:30:41,800 Here. 831 00:30:41,960 --> 00:30:43,700 There are no zero-knowledge proofs. 832 00:30:44,180 --> 00:30:46,560 Accompanying the ciphertext that the parties sent to each other. 833 00:30:47,100 --> 00:30:47,580 Furthermore. 834 00:30:47,760 --> 00:30:51,440 The mask now is chosen to be as big as N. 835 00:30:51,580 --> 00:30:52,640 And this is important. 836 00:30:52,640 --> 00:30:53,420 Because now. 837 00:30:53,560 --> 00:30:55,500 Our previous attack is no longer relevant. 838 00:30:55,700 --> 00:30:57,800 Because it doesn't matter how big K is. 839 00:30:59,640 --> 00:31:00,860 What's inside the encryption. 840 00:31:00,940 --> 00:31:02,820 Is always hiding the X. 841 00:31:04,200 --> 00:31:04,680 Okay. 842 00:31:04,760 --> 00:31:05,860 So what can we do about it? 843 00:31:05,960 --> 00:31:06,020 Well. 844 00:31:06,120 --> 00:31:07,080 We can do a lot about it. 845 00:31:07,160 --> 00:31:08,600 Because without the zero-knowledge proof. 846 00:31:09,200 --> 00:31:12,160 Alice can send something that's not even a ciphertext. 847 00:31:12,500 --> 00:31:14,700 She can send for example the value 4. 848 00:31:16,720 --> 00:31:17,880 In doing so. 849 00:31:18,140 --> 00:31:21,060 And by choosing a carefully crafted N. 850 00:31:21,060 --> 00:31:23,440 Specifically one that is not square free. 851 00:31:23,880 --> 00:31:27,000 Bob will inadvertently send back his X. 852 00:31:27,120 --> 00:31:27,940 In the clear. 853 00:31:28,500 --> 00:31:30,100 Actually it's not exactly in the clear. 854 00:31:30,260 --> 00:31:31,580 You need to do some data processing. 855 00:31:31,940 --> 00:31:33,160 And there's a bunch of primes involved. 856 00:31:33,540 --> 00:31:34,640 And you need to do CRT. 857 00:31:34,860 --> 00:31:36,360 And then you need to brute force a bit. 858 00:31:36,500 --> 00:31:38,160 But everything happens in seconds. 859 00:31:39,460 --> 00:31:39,900 Alright. 860 00:31:39,980 --> 00:31:42,200 So you could think about this attack. 861 00:31:42,360 --> 00:31:44,600 As a condensed version of the previous one. 862 00:31:44,780 --> 00:31:45,040 Whereas. 863 00:31:45,140 --> 00:31:47,620 Instead of getting the 16 leakages in 16 signatures. 864 00:31:47,840 --> 00:31:49,660 We get all of them in one signature. 865 00:31:51,060 --> 00:31:51,520 And then brute forcing offline. 866 00:31:52,080 --> 00:31:54,020 And then use CRT to reconstruct the key. 867 00:31:54,240 --> 00:31:56,020 Now this demo is going to go fast. 868 00:31:56,160 --> 00:31:57,080 So do not blink. 869 00:31:57,600 --> 00:31:58,820 We start the signing. 870 00:31:59,020 --> 00:31:59,920 We do the MTA phase. 871 00:32:00,100 --> 00:32:00,700 We get the leakage. 872 00:32:00,960 --> 00:32:01,980 We do the brute forcing. 873 00:32:02,180 --> 00:32:03,440 We fit it all into CRT. 874 00:32:03,520 --> 00:32:04,360 And voila. 875 00:32:04,500 --> 00:32:05,960 We have the private key. 876 00:32:17,160 --> 00:32:17,960 To conclude. 877 00:32:21,060 --> 00:32:22,420 We have all the attacks on MPC protocol. 878 00:32:22,660 --> 00:32:24,740 That all result in exfiltrating the private key. 879 00:32:24,880 --> 00:32:27,420 Which is bypassing the basic promise. 880 00:32:27,620 --> 00:32:28,420 Security promise. 881 00:32:28,520 --> 00:32:29,440 Of the MPC protocols. 882 00:32:31,620 --> 00:32:32,340 I don't know. 883 00:32:32,400 --> 00:32:35,160 I hope that you might find this as interesting. 884 00:32:35,280 --> 00:32:36,320 As exciting as we do. 885 00:32:36,460 --> 00:32:37,980 Because this is a new space. 886 00:32:38,220 --> 00:32:40,200 The cryptography is really interesting. 887 00:32:40,420 --> 00:32:42,360 And it could really use as many researchers. 888 00:32:42,660 --> 00:32:44,540 As many smart people's eyes looking over. 889 00:32:44,640 --> 00:32:46,620 Making sure everyone is implementing this stuff correctly. 890 00:32:47,360 --> 00:32:49,420 Here you can find all the proof of concept. 891 00:32:49,480 --> 00:32:50,100 Source codes. 892 00:32:51,060 --> 00:32:51,280 Today. 893 00:32:51,280 --> 00:32:53,300 As well as a technical white paper. 894 00:32:53,820 --> 00:32:56,400 Explaining the math in more depth. 895 00:32:56,480 --> 00:32:58,100 Than you could have ever dreamed of. 896 00:32:58,980 --> 00:33:00,460 And thank you very much for coming. 897 00:33:00,920 --> 00:33:01,500 Thank you.