1 00:00:00,000 --> 00:00:04,280 Our next speaker is Guy. 2 00:00:04,280 --> 00:00:07,280 I'm not gonna try to pronounce his last name. 3 00:00:07,760 --> 00:00:09,420 He told me not to do that. 4 00:00:09,420 --> 00:00:10,120 Okay. 5 00:00:11,000 --> 00:00:15,360 He's B-Sides Tel Aviv chairman and CTF lead. 6 00:00:15,360 --> 00:00:20,760 Also a public speaker and recipient of the Cisco Black Belt Security Ninja. 7 00:00:20,760 --> 00:00:21,900 That's nice. 8 00:00:22,060 --> 00:00:26,420 With nearly 20 years of experience in cyber security industry. 9 00:00:26,860 --> 00:00:29,800 Currently providing security services. 10 00:00:29,800 --> 00:00:35,800 Focusing on OS, hardening, crypto, AI and reverse engineering. 11 00:00:35,820 --> 00:00:40,680 And he's going to talk about crypto failures and how to avoid them. 12 00:00:40,680 --> 00:00:43,120 Give him a round of applause please. 13 00:00:47,370 --> 00:00:49,250 Thank you very much. 14 00:00:49,250 --> 00:00:51,110 Can you hear me in the back? 15 00:00:51,110 --> 00:00:53,830 Because I tend to walk about so I'll take the mic. 16 00:00:53,830 --> 00:00:55,790 But if not I'll just speak very loudly. 17 00:00:56,790 --> 00:00:57,270 Okay. 18 00:00:57,270 --> 00:01:00,250 So welcome to my talk about crypto failures. 19 00:01:00,250 --> 00:01:02,810 Before I begin I just want to say one thing. 20 00:01:02,810 --> 00:01:06,970 I'm not dissing anyone who's actually developing and using crypto libraries. 21 00:01:06,970 --> 00:01:12,350 But I do want to point out several failures that I have seen happen over and over again. 22 00:01:12,350 --> 00:01:19,730 And try to give you those patterns and some tools and some ideas of what to do when you encounter such issues or such things. 23 00:01:19,730 --> 00:01:28,370 But I also wanted to make this talk let's say entertaining and show you a couple of well at least for me and probably for others pretty funny failures. 24 00:01:28,370 --> 00:01:30,950 Some of them of very large extent. 25 00:01:31,250 --> 00:01:34,070 So said so. 26 00:01:34,070 --> 00:01:34,710 Okay. 27 00:01:40,500 --> 00:01:41,700 This should work. 28 00:01:41,800 --> 00:01:42,180 Okay. 29 00:01:42,180 --> 00:01:50,640 So as I was so kindly introduced I'm besides Tel Aviv chairman I also do the CTF. 30 00:01:50,720 --> 00:01:55,500 I invite you all to come to us to sunny Tel Aviv in June for a pretty nice conference. 31 00:01:57,820 --> 00:02:00,800 I'm here and I've been here for quite a while . 32 00:02:00,800 --> 00:02:03,560 I've seen a couple of different things in different areas. 33 00:02:03,560 --> 00:02:04,960 I've managed a cryptographer. 34 00:02:04,960 --> 00:02:06,280 I manage developers. 35 00:02:06,280 --> 00:02:07,640 I manage reverse engineers. 36 00:02:07,640 --> 00:02:11,280 And some patterns tend to emerge again and again. 37 00:02:11,520 --> 00:02:13,480 So I want to focus on that. 38 00:02:13,480 --> 00:02:18,980 The first thing and probably the most important thing is crypto is math and that kind of scares a lot of people. 39 00:02:19,100 --> 00:02:29,680 And I'll try to give you like a first introduction to what cryptography actually is without going into the math because obviously most people don't really care. 40 00:02:29,680 --> 00:02:40,280 But more than that I want you to give to get like a very at least fundamental understanding of what you should expect and when you don't see that it should light a red flag. 41 00:02:40,280 --> 00:02:42,100 So I'll give you a couple of examples. 42 00:02:42,540 --> 00:02:50,540 So you probably are already familiar with the CIA confidentiality integrity and availability concepts from other perspectives. 43 00:02:50,540 --> 00:02:52,580 This is also true for cryptography. 44 00:02:52,680 --> 00:02:57,200 So when we're saying confidentiality and talking about cryptography, it means we want to keep things secret. 45 00:02:57,200 --> 00:03:05,540 We want to have some sort of method, some sort of idea or function that if we know the secret, then we will know what this payload contains. 46 00:03:05,540 --> 00:03:09,980 And if no one else knows that secret, nobody else can know what this secret contains. 47 00:03:10,120 --> 00:03:11,420 Identity comes to the same thing. 48 00:03:11,420 --> 00:03:18,700 We want to make sure that if someone sends us the message, we can verify that we got the message from that person or that system and not from someone else. 49 00:03:18,860 --> 00:03:20,300 Phishing comes to mind. 50 00:03:20,720 --> 00:03:22,340 The third one is authenticity. 51 00:03:22,340 --> 00:03:25,800 Can we trust that nobody touched that message or modified that message? 52 00:03:25,800 --> 00:03:32,420 Did we actually get the same message that the sender sent us or was somebody messing around with it along the way? 53 00:03:33,560 --> 00:03:37,540 This is kind of a personal point for me, but I'm not ashamed to mention it. 54 00:03:37,540 --> 00:03:43,760 One of the teams I led when I was at Cisco was in charge of an area called supply chain security. 55 00:03:44,040 --> 00:03:51,260 So I was the very happy owner of that specific area of responsibility when Snowden releases documents. 56 00:03:51,620 --> 00:03:59,560 If you remember the nice image of NSA intercepting Cisco equipment and doing supply chain attacks, that was fun. 57 00:04:00,060 --> 00:04:03,420 And my point is, is that authenticity is important. 58 00:04:03,420 --> 00:04:14,980 When you're dealing with a product, with a vendor, with a library, you want to make sure that what you're getting is what actually the developer or the system actually intended you to receive. 59 00:04:14,980 --> 00:04:28,600 If you remember the NPM dependency issue, I don't remember, about a year ago more or less, somebody decided that he doesn't like the left line string to maintain that anymore, he kind of dropped that, everything broke. 60 00:04:29,220 --> 00:04:39,460 Somebody put some malicious code or stuff like that into the dependencies of NPM and now everybody got the same kind of libraries along the way. 61 00:04:39,460 --> 00:04:40,800 This is something you need to think about. 62 00:04:40,800 --> 00:04:42,380 It's something you need to be aware of. 63 00:04:42,380 --> 00:04:43,540 So it's an issue. 64 00:04:44,860 --> 00:04:49,340 Usually when people talk about cryptography, they kind of think that everything is the same. 65 00:04:49,340 --> 00:04:50,300 And it's not the same. 66 00:04:50,300 --> 00:04:58,540 When we're talking about hashes, for example, one of the common things that I hear is that I've encrypted with SHA-1 or encrypted with SHA-512. 67 00:04:59,240 --> 00:05:00,080 Well, not. 68 00:05:00,080 --> 00:05:01,840 You did not encrypt the SHA. 69 00:05:01,840 --> 00:05:05,540 A hash function has only one job. 70 00:05:05,540 --> 00:05:10,540 Taking lots and lots of information, boiling it down and getting a very short piece of information. 71 00:05:10,540 --> 00:05:12,500 But that's also true for checksums. 72 00:05:12,600 --> 00:05:17,740 So if you write CRC32 or something similar, you get the same concept. 73 00:05:17,740 --> 00:05:22,920 You process a lot of information, you get some validating code at the end. 74 00:05:22,940 --> 00:05:28,860 However, CRC32 and SHA and other constructs are not the same. 75 00:05:28,860 --> 00:05:33,960 Because cryptographic hashes, which is a specific type of hashes, try to give you a guarantee. 76 00:05:34,020 --> 00:05:40,280 They try to give you that if you change one bit in the input, you'll get a dramatically different output. 77 00:05:40,280 --> 00:05:42,360 More than 50% of it should be different. 78 00:05:42,380 --> 00:05:45,500 And if it's not the case, this is a very bad function to use. 79 00:05:45,500 --> 00:05:49,540 Because that means that an attacker can now use that to find collisions. 80 00:05:49,540 --> 00:05:53,240 Collisions meaning find a different message that will give him the same output. 81 00:05:53,400 --> 00:05:55,680 So short story. 82 00:05:55,900 --> 00:06:01,680 MD5, for those of you who are familiar with it, used to be a very common hashing algorithm way back when. 83 00:06:01,820 --> 00:06:15,040 And a couple of years ago in Black Hat, if I remember correctly, I don't remember her name, but a researcher from China, if I remember correctly, showed a way to find collisions in MD5. 84 00:06:15,040 --> 00:06:23,100 And what happened, immediately you can actually generate whatever you want to get the same kind of MD5 hash on it. 85 00:06:23,100 --> 00:06:31,920 Which means that now it's open for attackers to use MD5 to modify inputs or select their own inputs. 86 00:06:31,920 --> 00:06:34,080 And you will still think it's the same thing. 87 00:06:34,100 --> 00:06:50,040 It's paramount or analogous into some developer writing a library and giving you an affirmation that this is my library, I wrote it, here's my MD5 signature, and then someone else uses MD5 to give you some malicious piece of code and you will not be able to tell the difference. 88 00:06:50,500 --> 00:06:54,600 So just as an example, what does it look like in real life? 89 00:06:54,680 --> 00:07:03,300 So if we take a function, SHA1 in this example, the quick run forks, blah, blah, blah, will give an output, 2FD, blah, blah, ending in B12. 90 00:07:04,080 --> 00:07:05,720 Let's change one character. 91 00:07:05,720 --> 00:07:08,120 I change the D to a C. 92 00:07:08,120 --> 00:07:10,860 And you can see that the output is dramatically different. 93 00:07:10,860 --> 00:07:14,740 So that's the purpose of a cryptographic hash function. 94 00:07:14,740 --> 00:07:18,560 So if you change just one thing, it will be dramatically different. 95 00:07:18,560 --> 00:07:22,860 It will be very difficult to find two different sources that get the same output. 96 00:07:23,240 --> 00:07:24,420 Why is this important? 97 00:07:24,420 --> 00:07:29,020 It used to be very, very difficult to attack SHA1, two to the power of 80. 98 00:07:29,020 --> 00:07:31,260 That means it's a lot of compute. 99 00:07:31,400 --> 00:07:38,760 However, with recent advances, last year, or sorry, this year, early this year, this was reduced to the power of 68. 100 00:07:38,820 --> 00:07:41,140 Well, that sounds pretty tough yet, right? 101 00:07:41,140 --> 00:07:46,280 So if you go and spend like 100K in Amazon, you can crack SHA1. 102 00:07:46,920 --> 00:08:02,700 And that means that if you have, you're using Git and you're counting in Git to make sure that the commits have the right hashes and don't have like two people committing the same thing or a malicious person committing something and you get the same kind of commit, 103 00:08:02,700 --> 00:08:06,640 well, that's not true anymore for a SHA1 attacker with lots of money. 104 00:08:06,840 --> 00:08:10,420 But it might be even true in the future for other advances. 105 00:08:10,420 --> 00:08:15,740 So I'm not really worried about Git because that's like not a really viable attack surface. 106 00:08:15,740 --> 00:08:25,200 But Git had discussions to move away from SHA1 to SHA256 or SHA512 and that's probably the most common recommendation right now, don't use SHA1 anymore. 107 00:08:26,460 --> 00:08:36,520 Symmetric function, something you're probably more familiar with, which is a cryptographic function that given a key, you can use it on a piece of information and then it will be hidden. 108 00:08:36,520 --> 00:08:39,600 Use the same key again, you get the information right back. 109 00:08:39,740 --> 00:08:49,080 So example, take AS, AS is the currently known best practice to use for encrypting symmetric information. 110 00:08:49,180 --> 00:08:55,800 So I just like, it's pseudocode, but like Python notation, padded it with 21 zeros, get something. 111 00:08:55,800 --> 00:08:58,640 Change a bit, get something dramatically different. 112 00:08:58,820 --> 00:09:00,000 Why is this important? 113 00:09:00,000 --> 00:09:13,920 It's important because if the cryptographic function produces an output that has some sort of information in it, it doesn't look like random noise, it means that I can go ahead and break this algorithm. 114 00:09:13,920 --> 00:09:15,300 I'll give you an example. 115 00:09:15,520 --> 00:09:24,180 One of my friends, he's a master thesis, was to break an algorithm called WEP, might have heard of it for Wi-Fi. 116 00:09:24,180 --> 00:09:32,820 And the reason it was broken was because when you used the algorithmic function called RC4, RC4 wasn't stable. 117 00:09:32,820 --> 00:09:37,340 The first 1,000 or 2,000 bits coming out of RC4 had a bias. 118 00:09:37,340 --> 00:09:43,440 So you can guess with good certainty what was the key that produced that output if you recorded that output. 119 00:09:43,440 --> 00:09:49,720 So once you did that, you just record some information out of the air and now you know the key for that WEP encryption. 120 00:09:49,720 --> 00:09:50,880 But that's pretty bad. 121 00:09:50,880 --> 00:09:54,660 You want something to be very, very stable, very, very good. 122 00:09:55,000 --> 00:10:00,560 So AES is currently the standard and it's a good standard and you could be very happy using it. 123 00:10:00,560 --> 00:10:06,020 And there are other cryptographic algorithms out there to supplement it when the time comes. 124 00:10:07,320 --> 00:10:13,860 Asymmetric cryptography, I'm not going to go into a lot of length here, but that's what you probably all know from private public keys. 125 00:10:14,060 --> 00:10:30,960 Basically what they mean is that if you have a pair of public and private keys, you can give everybody your public key, they can encrypt the message with the public key that you gave away, but because you're the only one who has a private key, you're the only one who is able to decrypt that message. 126 00:10:31,080 --> 00:10:33,680 So hand wavingly, this is the way that works. 127 00:10:33,820 --> 00:10:39,000 And this is something that a lot of our internet, our data communication is based on. 128 00:10:40,980 --> 00:10:50,540 There was a presentation , I don't know if you've seen the Twitter storm about it, I think it was, I'm not sure if it was yesterday or two days ago, in Black Hat by a company called Time AI. 129 00:10:50,800 --> 00:11:01,840 They do 5D encryption with quasi prime numbers and lots of other, they enhance their cryptographic functions with music and emotions. 130 00:11:01,880 --> 00:11:05,040 And it was like, I could not believe that this was a Black Hat talk. 131 00:11:05,640 --> 00:11:11,780 So choosing like vetted, known, good algorithms is what you should do. 132 00:11:11,780 --> 00:11:13,560 You should not invent your own algorithms. 133 00:11:13,580 --> 00:11:17,720 And I'll come back to that message in a moment with some examples. 134 00:11:18,600 --> 00:11:20,400 So what is a signature ? 135 00:11:20,400 --> 00:11:30,660 A signature is having some private key and using that in order to provide a proof to everyone that a piece of code or a piece of message is something that you actually guarantee came from you. 136 00:11:30,660 --> 00:11:31,880 So how does that work? 137 00:11:31,880 --> 00:11:40,860 So I'll take my message, could be my library or something similar, and I'll calculate or compute the hash of that message using the SHA-1 or something similar from before. 138 00:11:41,340 --> 00:11:43,360 Then I'll provide a signature. 139 00:11:43,360 --> 00:11:49,880 A signature is just taking a public private key algorithm, using my private key, I'll encrypt the hash. 140 00:11:50,060 --> 00:11:53,300 Now I have an encrypted hash that was encrypted with my private key. 141 00:11:53,300 --> 00:11:58,480 So I'm not giving anyone my private key, but I know that it's, I can assure someone that it's mine. 142 00:11:58,480 --> 00:12:00,540 How can I ensure someone that it's mine? 143 00:12:00,700 --> 00:12:03,860 I give everybody my public key and I give them the message. 144 00:12:03,860 --> 00:12:08,420 They will compute their own version of the hash because they do it by themselves, they don't trust me anymore. 145 00:12:09,380 --> 00:12:12,320 And they decrypt the message using the public key. 146 00:12:12,460 --> 00:12:22,280 Now if they got the same key, the same hash, that means that I am the owner of the private key, of the public key, and therefore this message came from me. 147 00:12:23,260 --> 00:12:24,300 Sorry. 148 00:12:24,620 --> 00:12:33,000 So the whole concept of signature is based on the idea that I can share something publicly, I can keep something private, not tell that to anyone. 149 00:12:33,000 --> 00:12:40,500 But using that information, I can also convince you of my identity as a holder of that private key. 150 00:12:40,940 --> 00:12:41,560 Okay. 151 00:12:42,380 --> 00:12:48,020 One of the things and probably the last tenets for this very short introduction is the idea of randomness. 152 00:12:48,500 --> 00:12:53,300 Almost everything that we do in cryptography is somehow centered about randomness. 153 00:12:53,300 --> 00:12:57,740 So if we don't have a very strong randomness source, everything breaks. 154 00:12:57,740 --> 00:12:59,320 And I'll give some examples of that. 155 00:12:59,320 --> 00:13:02,480 So usually when we talk about randomness, we talk about two different things. 156 00:13:02,480 --> 00:13:06,520 The first one is called the TRNG or true random number generator. 157 00:13:06,520 --> 00:13:09,780 And the other is called PRNG, absurd random number generator. 158 00:13:09,780 --> 00:13:13,780 The big difference between the two is that the PRNG is a function. 159 00:13:13,780 --> 00:13:18,460 If I'll give it a known starting point, it will always get to the same result. 160 00:13:18,520 --> 00:13:22,760 Change the starting point, you'll get a different result, but it's derived in deterministic fashion. 161 00:13:23,440 --> 00:13:25,960 TRNG, I have no idea what's not going to happen. 162 00:13:25,960 --> 00:13:31,360 So it's just like measuring neutrons from the air or like measuring electromagnetic interference. 163 00:13:31,400 --> 00:13:34,940 It might be zero, it might be one, I have no idea what's going to happen. 164 00:13:34,940 --> 00:13:39,080 So a good TRNG will give me bits with a probability of 50%. 165 00:13:39,080 --> 00:13:41,080 I don't know what it would be. 166 00:13:41,080 --> 00:13:47,300 If it was something like, let's say 49%, I would be able to break that random number generator. 167 00:13:47,300 --> 00:13:49,600 So we need something that's very, very stable. 168 00:13:50,340 --> 00:13:52,200 So how do you use that? 169 00:13:52,200 --> 00:14:00,440 You take a PRNG and you provide it with an input that's come from a real world entropy source, something that's actually truly random. 170 00:14:01,320 --> 00:14:04,360 So what happens when it isn't random? 171 00:14:04,380 --> 00:14:07,240 Sometimes people misuse random numbers. 172 00:14:07,240 --> 00:14:10,660 For example, when they're writing code and they need to use nonces. 173 00:14:10,660 --> 00:14:13,200 Everybody are familiar with what's a nonce? 174 00:14:13,980 --> 00:14:17,500 Okay, so a nonce should be just a random number. 175 00:14:17,500 --> 00:14:22,440 It shouldn't be constant, it shouldn't be hardcoded into your code, until it is. 176 00:14:22,440 --> 00:14:24,900 And when it is, funny things happen. 177 00:14:24,900 --> 00:14:26,300 So I'll give you an example. 178 00:14:28,220 --> 00:14:31,240 Probably heard of Bitcoin, once or twice, maybe. 179 00:14:31,540 --> 00:14:36,100 So Bitcoins is actually a cryptographic operation. 180 00:14:36,400 --> 00:14:37,800 So what are coins? 181 00:14:37,800 --> 00:14:46,040 Coins are actually going and trying to find inputs that given a hash function will provide a pre-known output. 182 00:14:46,220 --> 00:14:54,000 So that's the difficult problem, not because it's mathematically hard, but because it's very difficult to find those inputs. 183 00:14:54,000 --> 00:14:54,780 So what do you do? 184 00:14:54,780 --> 00:14:59,060 You try a lot of different attempts, found one, you earn the coin. 185 00:14:59,060 --> 00:15:01,240 Now you are an owner of a single Bitcoin. 186 00:15:01,300 --> 00:15:10,500 This is exponentially harder as time goes by, which means you have to invest more time, more resources, more CPU power in order to actually mine those Bitcoins. 187 00:15:10,500 --> 00:15:12,920 But the basic principle still holds. 188 00:15:13,200 --> 00:15:16,720 Wallets, or your Bitcoin wallets, are just identities. 189 00:15:16,740 --> 00:15:19,860 They are something that represent your private and public keys. 190 00:15:20,340 --> 00:15:28,920 And transactions are actually just saying, I'll take this piece of money and I'll give it to that private key or that holder of that private key, and this is a transaction. 191 00:15:28,920 --> 00:15:34,060 Just shifting money or shifting coins or pieces of coins from one source to another. 192 00:15:34,740 --> 00:15:37,540 And I should have clicked like 20 minutes ago. 193 00:15:39,040 --> 00:15:44,240 An important thing to note, if you lose your private key, you lost your money. 194 00:15:44,240 --> 00:15:48,020 Because your coins are held by your private key. 195 00:15:48,020 --> 00:15:52,600 If you don't have access to your private key anymore, you don't have access to your coins. 196 00:15:52,600 --> 00:15:55,720 Something to keep in mind when you're playing around with Bitcoin. 197 00:15:56,280 --> 00:16:00,000 So the last thing I want to talk about is called elliptic curve cryptography. 198 00:16:00,000 --> 00:16:08,240 If you're familiar with RSA, basically the same thing, much cheaper to execute, much less compute power, same guarantees for security. 199 00:16:09,020 --> 00:16:15,040 Bitcoin is using these elliptic curve cryptography operations in order to move money about. 200 00:16:15,040 --> 00:16:18,100 So that's the basic algorithms behind Bitcoin. 201 00:16:18,360 --> 00:16:22,440 So this is a screenshot from a Bitcoin transfer. 202 00:16:22,440 --> 00:16:32,380 So what you can actually see is that this value here, this is the address of the source, which is actually the hash of my public key. 203 00:16:32,680 --> 00:16:43,740 And I'm moving money, 7.179 blah blah Bitcoins, into two different addresses, and the addresses are just the hashes of the public keys of the recipients. 204 00:16:44,040 --> 00:16:45,400 This is everything that there is to it. 205 00:16:45,400 --> 00:16:50,380 This is the entire Bitcoin idea in a slide. 206 00:16:51,460 --> 00:16:54,120 So how would you go about attacking this? 207 00:16:54,260 --> 00:17:01,560 So I will not going to bore you with the mathematical details behind this, but I'll try to direct your attention to a couple of things. 208 00:17:02,420 --> 00:17:15,460 The transaction actually happens when I, as an owner of a Bitcoin, will sign over a portion of that coin into a new address, to a new private key, or sorry, to a new hash of a public key. 209 00:17:15,640 --> 00:17:19,720 In order to do that, I have to work with a couple of components. 210 00:17:19,720 --> 00:17:28,160 The hash of the message, K, which is random, R, which is the multiplication operation under elliptic curves, and the signature. 211 00:17:28,220 --> 00:17:31,740 And the way to calculate the signature is outlined in the formula in the bottom. 212 00:17:31,980 --> 00:17:41,260 So there's something here which should stick out like a sore thumb to everyone who looks at it, which is, maybe I can show my hair. 213 00:17:42,460 --> 00:17:44,300 K should be random. 214 00:17:44,700 --> 00:17:51,580 And sometimes when implementers are reading the spec, they say, okay, K should be random, so I'll select a random number. 215 00:17:53,340 --> 00:17:55,880 So what happens when K isn't random? 216 00:17:56,060 --> 00:17:57,820 Assume that K isn't random. 217 00:17:58,040 --> 00:18:07,840 If I can go over on the block, look at all the blockchain, all the Bitcoin transactions, and find two different transactions that share the same random number. 218 00:18:07,840 --> 00:18:11,360 Suddenly, this is a problem in sixth grade algebra. 219 00:18:11,360 --> 00:18:18,920 Because if I know the value for K, I can just move about the equation, isolate K, and solve for everything else. 220 00:18:18,920 --> 00:18:21,560 And I solve and I solve, and finally I have D. 221 00:18:21,560 --> 00:18:23,300 Now I have the private key. 222 00:18:23,300 --> 00:18:30,200 Because in elliptic curve operations, when you're not using random numbers, everything breaks. 223 00:18:30,400 --> 00:18:33,000 So it's a tenet of using elliptic curves. 224 00:18:33,300 --> 00:18:36,100 So you say, okay, this is like nonsense. 225 00:18:36,100 --> 00:18:38,300 Who wouldn't use random numbers in the real world? 226 00:18:38,300 --> 00:18:40,000 This never happens. 227 00:18:40,420 --> 00:18:42,900 And the answer is, well, of course it does. 228 00:18:43,040 --> 00:18:50,220 So this is a screenshot from many, many years ago, 2013, when somebody noticed that people are stealing money from wallets. 229 00:18:50,540 --> 00:18:52,560 And how did this attack happen? 230 00:18:52,560 --> 00:19:07,260 Because someone else was probably a bit brighter noticed that people are using bad wallets or bad wallet software, where the developers for that piece of software for that wallet didn't realize that they need to generate a new K for every transaction. 231 00:19:07,540 --> 00:19:18,960 So what they've done is just searched the transaction logs for two different transactions using the same random number, extracted the private key, and stole all of their bitcoins. 232 00:19:18,960 --> 00:19:20,560 This was in the entire attack. 233 00:19:21,320 --> 00:19:26,520 So, you know, that's kind of if somebody wants to mess with bitcoins, like they had it coming. 234 00:19:26,520 --> 00:19:28,760 I have no problems with that. 235 00:19:28,760 --> 00:19:34,920 But you say, this shouldn't happen in, like, real world applications, like big sized interesting stuff. 236 00:19:35,520 --> 00:19:38,540 So how does that look like in the real world? 237 00:19:38,540 --> 00:19:51,480 When you generate a random number, what you should probably be doing is something like open slash dev slash random and pull a number of bytes out of it, maybe 30, I don't know, just throw in a number there. 238 00:19:51,840 --> 00:19:54,940 But you should do this for every time that you need a random number. 239 00:19:54,940 --> 00:19:57,720 Because when you don't, you get something like this. 240 00:19:58,680 --> 00:20:03,960 You choose the random number very securely, once, and hard code it. 241 00:20:04,160 --> 00:20:07,520 Which is like analogous to saying, what's my random number? 242 00:20:07,520 --> 00:20:08,300 Four. 243 00:20:08,700 --> 00:20:11,140 It was chosen by a fair dice roll. 244 00:20:14,060 --> 00:20:15,660 I'll skip this. 245 00:20:17,780 --> 00:20:18,440 Okay. 246 00:20:18,440 --> 00:20:21,320 We'll come back to the point of the randomness in a moment. 247 00:20:21,320 --> 00:20:26,500 I want to show you a piece of code and ask everyone, can everybody see the problem with this piece of code? 248 00:20:27,120 --> 00:20:28,180 Any hands? 249 00:20:28,940 --> 00:20:30,700 It was pretty famous for a while. 250 00:20:31,380 --> 00:20:31,620 Okay. 251 00:20:31,620 --> 00:20:32,780 We have one person. 252 00:20:33,160 --> 00:20:34,040 Two persons. 253 00:20:34,040 --> 00:20:34,680 Excellent. 254 00:20:34,680 --> 00:20:36,260 So I'll highlight it for everyone. 255 00:20:36,720 --> 00:20:44,520 So this piece of code is actually the verification code for X509 certificates on iOS. 256 00:20:44,660 --> 00:20:46,200 Or it used to be. 257 00:20:46,460 --> 00:20:52,660 And what this means is when you're doing a TLS transaction, somebody needs to check the certificate. 258 00:20:52,820 --> 00:20:54,280 How do you check the certificate? 259 00:20:54,280 --> 00:20:56,080 Just the same way that we talked previously. 260 00:20:56,080 --> 00:21:00,200 Just check the public keys, find out the hashes, compare them, check them. 261 00:21:00,200 --> 00:21:06,880 And the way that the code is written is that if there's an error, some check didn't pass, go to fail. 262 00:21:07,580 --> 00:21:10,740 But what happens here is you have a double line. 263 00:21:11,320 --> 00:21:13,980 So the first line is in the scope of that if. 264 00:21:13,980 --> 00:21:16,360 The second line isn't in the scope of anything. 265 00:21:16,400 --> 00:21:20,400 So anything written after that never executes. 266 00:21:20,740 --> 00:21:21,020 Okay? 267 00:21:21,020 --> 00:21:24,360 Whenever you go into that point, you immediately go to fail. 268 00:21:24,680 --> 00:21:26,720 So how is that interesting for an attacker? 269 00:21:26,780 --> 00:21:38,320 If you specially craft your certificate that you would pass each and every check up to that point, even though your certificate is invalid, you will still pass the test. 270 00:21:38,640 --> 00:21:42,280 Because nobody tests for like everything, you just test up to that point. 271 00:21:42,640 --> 00:21:55,060 And that meant that attackers could create certificates for, I don't know, for example, iOS apps that are invalid and malicious but have like certificates which are bad but pass the verification process. 272 00:21:55,840 --> 00:22:00,740 So special attention needs to be given to these kinds of cases. 273 00:22:02,700 --> 00:22:04,280 Am I missing a slide? 274 00:22:04,280 --> 00:22:05,380 Let me check. 275 00:22:08,040 --> 00:22:08,940 Yeah. 276 00:22:09,380 --> 00:22:21,120 I should have said something here and I skipped it, so let me circle back for a second. 277 00:22:21,120 --> 00:22:26,240 So Sony, you might have heard of them, have a device or had a device called the PlayStation 3. 278 00:22:26,420 --> 00:22:31,020 And the PlayStation 3 was pretty awesome, everybody liked playing with it, but they couldn't really copy the games. 279 00:22:31,080 --> 00:22:31,440 Why? 280 00:22:31,440 --> 00:22:35,560 Because of the digital rights management protection on the games. 281 00:22:35,960 --> 00:22:48,620 But what Sony didn't really take into account or their developers didn't think about very thoroughly is that when they signed the games, they signed them with elliptic curves but they chose a single random value and it was hard-coded. 282 00:22:48,720 --> 00:23:09,300 So when the guys at Overflow found this out, they understood, okay, I can just take two different games, compare the signatures, find the random values that they used, derive the private key and now I can sign whatever game that I want for Sony because I have the private keys because they didn't use random values. 283 00:23:09,300 --> 00:23:18,540 So this was a very big thing for a while because those hard-coded numbers were hard-coded into the PlayStation 3 hardware device itself, the firmware. 284 00:23:18,740 --> 00:23:28,060 And they couldn't really update this, they couldn't circumvent this, they just lost a lot of money because someone made a mistake about assuming something about random numbers. 285 00:23:28,280 --> 00:23:31,200 Sorry, I completely missed my point here . 286 00:23:34,040 --> 00:23:40,680 Circling back to Bitcoin, everybody remember this screen from two and a half years ago, something like that? 287 00:23:41,520 --> 00:23:57,940 So attackers behind WannaCry built, I don't know, let's call it a GUI or something that will give you some information, how can you get the keys in order to get back all your files that they encrypted, just send me some money to this Bitcoin address. 288 00:23:58,500 --> 00:24:02,440 And they were supposed to send you back the keys and everybody would be very happy. 289 00:24:02,860 --> 00:24:04,280 So a couple of things happened. 290 00:24:04,280 --> 00:24:06,920 The first one was that obviously they never sent the keys. 291 00:24:06,960 --> 00:24:13,260 The second one was that the WannaCry attack was stopped pretty much in the middle because of a different operation. 292 00:24:13,260 --> 00:24:27,520 They had like a failsafe so they could stop the propagation of the malware from going everywhere because, that's like a different story, but the malware would check if a specific domain name was registered. 293 00:24:27,520 --> 00:24:29,900 If it was registered, it would stop the work. 294 00:24:30,840 --> 00:24:36,460 So while that domain name was not registered, it would continue to propagate. 295 00:24:36,660 --> 00:24:49,820 So one of the security researchers would just finish, if you're following up on the news, just finish his trial, find that out from reverse engineering the software, he registered that domain, he paid like, I don't know, $5 for it and stopped WannaCry. 296 00:24:50,180 --> 00:24:53,700 So that was the first thing that was really not very smart about WannaCry. 297 00:24:53,700 --> 00:24:59,580 The second thing was that they kind of missed the point of using Bitcoin. 298 00:24:59,580 --> 00:25:03,960 Bitcoin is a confidential service, but it's not an anonymous service. 299 00:25:03,960 --> 00:25:09,040 It means that everybody can be the owner of Bitcoins and their identity is protected. 300 00:25:09,040 --> 00:25:15,060 You don't have to tell anyone your identity, but everything you do is always logged, is always recorded. 301 00:25:15,060 --> 00:25:19,620 It's part of the very mechanism of how transactions on the blockchains work. 302 00:25:19,620 --> 00:25:30,800 And that means that if I'm a malicious attacker, and I'm asking people to send money over to my wallet, everything is traceable, everything is accountable, and it's part of the design of the system. 303 00:25:30,800 --> 00:25:34,160 And if I want to cash out, now I have a problem . 304 00:25:34,320 --> 00:25:42,420 Because if I try to cash out, somebody can just okay, now you linked that identity with this real world credit card. 305 00:25:43,020 --> 00:25:59,740 So they had money stuck there, they had about $70,000 if I remember correctly, they had it stuck there for a couple of months until they thought about a solution , which was just doing cash exchanges in Macau or something like that, to go over there, pull out the money very fast and disappear. 306 00:25:59,980 --> 00:26:06,420 But while they were doing this, they really couldn't touch the funds, because whatever you do with the funds, it's always traceable. 307 00:26:08,060 --> 00:26:08,940 Okay. 308 00:26:09,240 --> 00:26:11,380 So how does this look in the real world? 309 00:26:11,380 --> 00:26:12,360 New example. 310 00:26:12,900 --> 00:26:17,140 Who uses BitLocker, or at least heard of it enough to understand the term? 311 00:26:17,860 --> 00:26:18,800 I don't believe you. 312 00:26:18,800 --> 00:26:20,360 Who has Windows laptops? 313 00:26:21,660 --> 00:26:23,480 Really, everybody runs Linux? 314 00:26:23,920 --> 00:26:25,960 Wow, cool. 315 00:26:25,960 --> 00:26:27,740 I'm really proud of you guys. 316 00:26:29,400 --> 00:26:38,300 So BitLocker is, I wouldn't call it a protocol, but it's like a feature where your hard drive will self encrypt everything. 317 00:26:38,300 --> 00:26:45,320 So if somebody steals the hard drive and connects it to a new computer, he can't read the data that's on that device. 318 00:26:45,380 --> 00:26:47,420 That's a description of that feature. 319 00:26:47,420 --> 00:26:55,140 What really happens is that when you connect it to the operating system, the operating system is something like this. 320 00:26:55,740 --> 00:27:01,620 Are you a hard drive or SSD or whatever that supports hardware encryption? 321 00:27:01,620 --> 00:27:05,660 And the BitLocker supported device says, yes, of course I know encryption. 322 00:27:05,660 --> 00:27:07,360 Let's use my encryption. 323 00:27:07,600 --> 00:27:13,920 So if you have a hardware supported encryption on your hard drive, it will use the hardware version. 324 00:27:13,920 --> 00:27:18,720 If you don't have support, then Windows will simulate that support in software. 325 00:27:19,240 --> 00:27:20,840 What's the problem with that? 326 00:27:20,840 --> 00:27:25,000 The problem with that is the very premise that hardware is actually better than software. 327 00:27:25,000 --> 00:27:28,380 Because the way that the hardware developers did that was mumble about. 328 00:27:29,080 --> 00:27:30,420 What they did. 329 00:27:32,260 --> 00:27:40,160 They had a password that's used by your BIOS in order to encrypt or decrypt information from your hard drive, and they had a key. 330 00:27:40,220 --> 00:27:43,000 But there is no relationship between the password and the key. 331 00:27:43,000 --> 00:27:46,740 So you can type any password that you want, the key will still be fixed. 332 00:27:46,740 --> 00:27:50,180 It will be orthogonal to the password that you used. 333 00:27:50,180 --> 00:27:52,780 So they didn't tie together in any way. 334 00:27:53,500 --> 00:27:57,280 Second thing is, they used the same key to encrypt the entire drive. 335 00:27:57,280 --> 00:28:00,240 All of the different partition, all of the different blocks and sections. 336 00:28:00,240 --> 00:28:07,360 Which means that I have lots and lots of different blocks of encrypted data that I can compare against that are all using the same key. 337 00:28:07,460 --> 00:28:13,040 Which means that if you had a bad implementation, you just made my life easier as an attacker. 338 00:28:14,020 --> 00:28:17,220 And the last thing is, they didn't really use random keys. 339 00:28:17,640 --> 00:28:23,180 I'm just dissing here, but think of it as an equivalent of a 12 character password where it's all ones. 340 00:28:23,680 --> 00:28:24,000 Okay? 341 00:28:24,000 --> 00:28:26,020 So they didn't randomize the password. 342 00:28:26,060 --> 00:28:34,120 So you had the same password for all blocks on your hard drive, which didn't have any correspondence with a password for your BIOS or anything else. 343 00:28:34,120 --> 00:28:37,840 So you couldn't customize it, it didn't tie into anything from the real world. 344 00:28:37,840 --> 00:28:47,320 And that meant that, I'll skip that, and that meant that all of those drives were very, very weak from a cryptographic perspective. 345 00:28:47,320 --> 00:28:50,100 It's almost trivial to break them. 346 00:28:50,160 --> 00:28:56,140 However, the operating system by default will choose the hardware encryption over the software encryption. 347 00:28:56,140 --> 00:29:12,700 And that means that any laptop that you probably have or had for the past year or older than that, didn't really have the security guarantees that you thought it had by using the BitLocker and similar properties, similar features. 348 00:29:13,620 --> 00:29:17,340 Here's just, I don't know, I just found it like an extremely funny example. 349 00:29:17,340 --> 00:29:21,720 Somebody on Stack Exchange asked for an algorithm to encrypt your password. 350 00:29:21,720 --> 00:29:23,760 I know you can't read it, so I'll enlarge it. 351 00:29:24,160 --> 00:29:35,500 So the method that he was suggesting to do was to take a Base64 encoding of your password and then reverse it, apply Base64, and now you have an encryption. 352 00:29:35,720 --> 00:29:42,060 So the amount of things that are wrong with that sentence are that... I don't know, he summarized this much better than me. 353 00:29:42,060 --> 00:29:50,920 The first thing is that Base64 is a bad choice because it enlarges the space requirement to store the same kind of information. 354 00:29:50,920 --> 00:29:56,380 The second thing is obviously this has nothing to do with cryptography, it's just encoding the same information in a different way. 355 00:29:56,940 --> 00:30:02,800 Reversing the encoding does nothing for security, just means that I have to reverse it again. 356 00:30:03,140 --> 00:30:19,820 And the basic thing is that this was an entire thread on Stack Exchange, should I use MD5 to encrypt my files and encrypt my passwords, where one, MD5 is not an encryption algorithm, and two, it has nothing to do with it, it's broken, use something else. 357 00:30:19,820 --> 00:30:26,140 And this guy came along and suggested to use this amazing piece of code that he wrote in order to protect everybody's password. 358 00:30:26,500 --> 00:30:29,200 So be careful of where you get your advice. 359 00:30:30,680 --> 00:30:34,920 I'm not dissing Stack Exchange, I'm just saying you should vet information that you receive. 360 00:30:35,820 --> 00:30:38,020 I think it's my last example. 361 00:30:38,160 --> 00:30:50,980 I do want to explain the concept and what I find problematic with it, but the basic idea is that it is actually a good piece of software, it just had its own limitation. 362 00:30:51,240 --> 00:31:04,340 So what this guy, he wrote a piece of software called Crypt Hook, and the problem he was trying to solve is that you have information on server A, and you want to communicate with server B, but you don't have the facilities to encrypt the information, 363 00:31:04,340 --> 00:31:06,880 you can't change the software that's running on the servers. 364 00:31:07,080 --> 00:31:15,240 So what he said, okay, I'll hook the system calls, and every network packet that transfers from server A to server B, I will encrypt it myself. 365 00:31:15,700 --> 00:31:24,160 So I will, like, create an out-of-bed encrypted channel between the two servers that has nothing to do with the software running on them. 366 00:31:24,160 --> 00:31:29,160 It will still transparently use the network stack, and I will encrypt the network stack. 367 00:31:29,640 --> 00:31:34,660 Out of the box, it's not like a bad idea, this really solves a real problem where you can't touch the software. 368 00:31:34,720 --> 00:31:38,320 On the other hand, the choices that he's made, made it very, very weak. 369 00:31:38,620 --> 00:31:47,880 So he chose to use GCM, which nobody should really care what it means, to do authentication, but he encrypted everything with a fixed key. 370 00:31:48,140 --> 00:31:51,440 So every packet was encrypted with the same key. 371 00:31:51,900 --> 00:31:59,060 Not only was that every packet was encrypted with the same key, there was no difference between the packets, so everything was encrypted exactly the same way. 372 00:31:59,440 --> 00:32:06,280 So it was absolutely easy for an attacker to capture a packet and replay it, send it again over the network. 373 00:32:06,280 --> 00:32:18,980 So if you had a packet that says, transfer $1,000 to my account, you can just capture that packet and replay it again and again and again, because no one would know, because there's no such information inside the packet to stop that. 374 00:32:19,020 --> 00:32:21,580 Also, you can change the order of the messages. 375 00:32:22,080 --> 00:32:31,100 You can do whatever you want with it, like dropping some of the messages, because his encryption scheme didn't think about those kinds of edge cases or use cases. 376 00:32:31,300 --> 00:32:46,080 But also, it meant that if I broke the key once, because it was fixed, it was hard-coded, that meant that I now had the key to every communication that would ever happen with this piece of software, which is tentative to just reading the source code because the key was there. 377 00:32:47,720 --> 00:32:50,480 So the question is, is everything on fire? 378 00:32:50,480 --> 00:32:51,780 Is everything bad? 379 00:32:52,280 --> 00:32:58,080 So obviously the answer to that is no, not everything is on fire, not everything is bad. 380 00:32:58,080 --> 00:33:05,460 But you should really pay special consideration whenever you're touching something related to crypto. 381 00:33:05,780 --> 00:33:07,460 Crypto is hard. 382 00:33:07,460 --> 00:33:19,980 There are experts, usually PhDs, that spend years and years of their lives researching crypto problems and crypto properties in order to make sure that whatever they're doing is very, very safe. 383 00:33:20,200 --> 00:33:25,720 You're not going to outperform them, you're not going to outsmart them, and you probably shouldn't be trying. 384 00:33:26,040 --> 00:33:27,640 Never roll your own crypto. 385 00:33:27,640 --> 00:33:30,780 Use best practices, use what's already out there. 386 00:33:30,780 --> 00:33:32,820 In my next slide, I'll give some recommendation. 387 00:33:32,820 --> 00:33:40,240 But also, you have a special use case, you have some problem that's unique and you don't know if the current tooling is able to solve that. 388 00:33:40,280 --> 00:33:42,960 Well, ask around, ask an expert. 389 00:33:43,060 --> 00:33:47,460 I can recommend two, let's say, expert advice channels that you can use. 390 00:33:47,460 --> 00:33:52,280 The first one is using Reddit, the crypto subreddit, but also the crypto stack exchange. 391 00:33:52,280 --> 00:34:04,920 Both are wonderful resources to consult with real world experts that can help you understand your problem and the right kind of tooling, the right kind of algorithms that you can use to solve that unique problem. 392 00:34:05,100 --> 00:34:08,060 More than that, you can always pay consultants. 393 00:34:08,140 --> 00:34:11,040 I'm a consultant, I'm getting paid to give advice, that's fine. 394 00:34:11,040 --> 00:34:14,920 There are experts that you can talk to on Twitter, anywhere else, you will get advice. 395 00:34:14,920 --> 00:34:18,680 People are nice, basically, most of the time. 396 00:34:18,680 --> 00:34:26,400 You can also pay a crypto review firm to go and look over your crypto code to make sure you haven't done something horrible like what happened to Sony. 397 00:34:26,420 --> 00:34:37,420 You don't want to be in that position where you wrote your own crypto or your team wrote some crypto because you thought you would be really solving something and you just horribly broke the entire security premise of your product. 398 00:34:39,320 --> 00:34:41,220 So what's my advice to you? 399 00:34:41,220 --> 00:34:45,520 That's probably the slide you should copy or photograph or just listen very carefully. 400 00:34:45,520 --> 00:34:50,940 The first one is that make sure that you're using the right libraries for you. 401 00:34:51,360 --> 00:34:54,420 Personally, I never recommend OpenSSL. 402 00:34:54,500 --> 00:35:04,060 Who has experience using OpenSSL APIs or implementing OpenSSL code in their own ID or in their own product? 403 00:35:04,060 --> 00:35:05,940 Anyone using OpenSSL? 404 00:35:06,020 --> 00:35:07,700 How sorry are you? 405 00:35:08,920 --> 00:35:11,580 Have you tried anything else? 406 00:35:12,080 --> 00:35:13,520 Not really. 407 00:35:13,520 --> 00:35:31,980 So at least my opinion of OpenSSL, it's a big, large, bloated piece of software that tries to do everything and most of the time doesn't do them the most efficient or the most proper way and it gives you... I used to have a boss that told me that C is a wonderful language. 408 00:35:31,980 --> 00:35:34,640 It gives you every tool possible to slit your own throat. 409 00:35:35,440 --> 00:35:37,680 So in a sense, OpenSSL is the same way. 410 00:35:37,680 --> 00:35:39,120 They support everything. 411 00:35:39,120 --> 00:35:50,000 Every legacy algorithm, every parameter ever conceived for anything and if you will misuse this or configure it wrongly or use the wrong parameters, you won't even know that you broke your crypto. 412 00:35:50,380 --> 00:35:54,100 So my first recommendation for you is just use something simpler. 413 00:35:54,500 --> 00:35:56,100 And you know, the world has advanced. 414 00:35:56,100 --> 00:35:58,420 There are lots of very good libraries out there. 415 00:35:58,540 --> 00:36:03,560 Archimedecommon, BoringSSL, the Golang crypto stack is excellent. 416 00:36:04,280 --> 00:36:06,200 NACL is also very, very good. 417 00:36:06,200 --> 00:36:07,720 NSS is very good. 418 00:36:08,980 --> 00:36:15,560 I do want to say that all of the libraries I mentioned here are good and I recommend them myself. 419 00:36:15,560 --> 00:36:17,260 Sometimes they have issues. 420 00:36:17,300 --> 00:36:18,400 They have bugs. 421 00:36:18,400 --> 00:36:20,460 They have patches that you need. 422 00:36:20,580 --> 00:36:22,060 And this is actually a good thing. 423 00:36:22,060 --> 00:36:24,300 Because that means that somebody is maintaining this. 424 00:36:24,300 --> 00:36:28,400 Somebody is actually looking if there are any issues and somebody is trying to fix them. 425 00:36:28,400 --> 00:36:35,820 So whenever such a thing exists, take that into your consideration, into your dependency stack and make sure that your own code is up to date. 426 00:36:36,620 --> 00:36:39,140 Never trust people that roll their own crypto. 427 00:36:39,400 --> 00:36:42,260 There are lots of like, oh, yeah, we have a student. 428 00:36:42,260 --> 00:36:43,440 He's really brilliant. 429 00:36:43,440 --> 00:36:45,660 We ask him to write our crypto stack. 430 00:36:45,820 --> 00:36:47,380 That's not a good idea. 431 00:36:47,380 --> 00:36:48,840 Even if he is brilliant. 432 00:36:48,900 --> 00:36:49,920 Use best practices. 433 00:36:49,920 --> 00:36:51,280 Use what's already out there. 434 00:36:51,280 --> 00:36:52,480 Just use it correctly. 435 00:36:52,480 --> 00:36:56,160 You have a much easier time, much better time overall. 436 00:36:56,720 --> 00:37:00,340 The last thing is that... sorry. 437 00:37:00,660 --> 00:37:08,160 The last thing that I want to mention about that is that not every feature that exists in crypto is actually something that you need. 438 00:37:08,240 --> 00:37:12,600 So cryptography has a lot of building blocks that are used in many, many different ways. 439 00:37:12,660 --> 00:37:14,940 Some of them are very esoteric. 440 00:37:14,960 --> 00:37:17,340 Some of them are like the mainline use cases. 441 00:37:17,820 --> 00:37:20,560 90% of the time, you need the mainline use case. 442 00:37:20,560 --> 00:37:21,600 It's already described. 443 00:37:21,600 --> 00:37:22,320 It's already known. 444 00:37:22,320 --> 00:37:23,360 Just use that. 445 00:37:23,360 --> 00:37:24,420 Don't invent anything. 446 00:37:24,420 --> 00:37:27,380 Don't try to like, oh, that's a nice looking piece of technology. 447 00:37:27,380 --> 00:37:29,520 Just like, let's use that instead. 448 00:37:29,540 --> 00:37:34,580 You need to think about it and you probably need some cryptographer to let you know if you did this correctly or not. 449 00:37:35,560 --> 00:37:37,100 So what you can do. 450 00:37:37,400 --> 00:37:38,900 Update your libraries. 451 00:37:39,120 --> 00:37:46,800 I've seen so many customers, so many people who use OpenSSL and like version 1.01 or something like that. 452 00:37:46,980 --> 00:37:49,020 And it's not updated at all. 453 00:37:49,020 --> 00:37:55,100 Because it's hard to update and they're afraid it will break something. 454 00:37:55,100 --> 00:37:58,040 And with OpenSSL, that's very cumbersome anyway. 455 00:37:58,480 --> 00:38:00,280 So make your life easier. 456 00:38:00,380 --> 00:38:04,500 Make sure that you have thought of how are you going to update this? 457 00:38:04,500 --> 00:38:06,800 How are you going to fix this when the time comes? 458 00:38:07,380 --> 00:38:11,560 If you want to become an expert, my recommendation to you is to start small. 459 00:38:11,580 --> 00:38:16,100 Go to trainings, to workshops, hear talks, go over YouTube, read a book. 460 00:38:16,160 --> 00:38:19,480 You can become an expert on cryptography without knowing math. 461 00:38:19,480 --> 00:38:22,580 You don't need a math degree in order to better understand crypto. 462 00:38:22,580 --> 00:38:26,200 You probably need a math degree or even a math PhD to invent crypto. 463 00:38:26,200 --> 00:38:27,280 But not to use it. 464 00:38:27,280 --> 00:38:29,400 To use it properly, study. 465 00:38:29,400 --> 00:38:30,920 Like everything else that we do. 466 00:38:30,920 --> 00:38:31,380 Study. 467 00:38:31,380 --> 00:38:34,480 This is a domain of knowledge that you can use, you can learn. 468 00:38:34,480 --> 00:38:35,360 It's not scary. 469 00:38:35,360 --> 00:38:37,620 It's not something that you should be afraid of. 470 00:38:37,940 --> 00:38:45,720 Down the line, you probably want to either outsource or hire the right people to look at cryptography very closely. 471 00:38:45,720 --> 00:38:50,920 But if you're not inventing cryptography, just use something that someone else already did. 472 00:38:50,920 --> 00:38:54,940 It will make your life easier and probably get better security out of it. 473 00:38:55,520 --> 00:38:58,460 With that, I would thank you very much. 474 00:39:05,970 --> 00:39:08,910 I'll be happy to take questions now in a moment. 475 00:39:08,910 --> 00:39:12,010 And if not, I'll be also outside later to take more questions. 476 00:39:12,010 --> 00:39:12,530 Yes, sir? 477 00:39:16,310 --> 00:39:18,910 That depends on what your desktop is. 478 00:39:18,910 --> 00:39:22,850 If you're on Linux or on your own Windows or you're on Chrome OS or differently. 479 00:39:22,850 --> 00:39:29,190 But I would trust with a mild degree of assault attached to it. 480 00:39:29,190 --> 00:39:32,010 But I would trust the operating system to hold secrets. 481 00:39:32,890 --> 00:39:34,790 They're usually pretty good. 482 00:39:34,830 --> 00:39:37,090 Depending on how much trust you need for that secret. 483 00:39:37,090 --> 00:39:44,210 If I have a desktop application, usually that means I have my own laptop or storing my own bank accounts or something like that, that's secure enough. 484 00:39:44,210 --> 00:39:50,730 If I have a production server hosting secrets for my 100,000 customers, that's a different question. 485 00:39:50,730 --> 00:39:53,270 There I would use an HSM or something similar. 486 00:39:54,130 --> 00:39:56,450 HSM is a hardware security module. 487 00:39:56,450 --> 00:40:01,690 That's actually a piece of hardware that holds secrets and lets you do cryptographic operations without revealing those secrets. 488 00:40:01,810 --> 00:40:03,610 So we can talk about that later. 489 00:40:03,610 --> 00:40:04,270 Yes? 490 00:40:07,920 --> 00:40:08,800 Yeah? 491 00:40:28,570 --> 00:40:30,410 I fully agree. 492 00:40:30,410 --> 00:40:31,190 I'll repeat that. 493 00:40:31,190 --> 00:40:38,050 The Capital One issue hand wavingly was not actually an encryption issue, it was a permission issue. 494 00:40:38,090 --> 00:40:48,950 So if you give someone permissions or you commit to GitHub your keys, then you actually give everybody permission to use your keys to do whatever they want to do. 495 00:40:49,030 --> 00:40:52,630 So the cryptography is still very strong but you haven't protected your keys. 496 00:40:52,630 --> 00:40:54,430 So in a sense that's what happened with Capital One. 497 00:40:54,430 --> 00:40:58,790 Both for roles and permissions for the access list they used for attacking. 498 00:41:13,540 --> 00:41:19,420 Well, here's where you actually need an expert to come and help you and look at your own specific use case. 499 00:41:19,420 --> 00:41:25,540 But if you encrypted your entire database but you kept the key in a script by that database, then you haven't really done anything. 500 00:41:25,540 --> 00:41:33,720 But if you encrypted your entire database and the key comes from a different component which checks your permissions and stuff like that, then you already have a different security model. 501 00:41:33,820 --> 00:41:41,580 So this is actually a more complex question to answer and not necessarily relevant for client side encryption depending on what you're trying to solve. 502 00:41:42,340 --> 00:41:44,000 Okay, more questions please. 503 00:41:45,400 --> 00:41:46,480 Be brave. 504 00:41:47,780 --> 00:41:48,520 Go on. 505 00:41:49,260 --> 00:41:49,700 Going to the next one. 506 00:41:49,720 --> 00:41:52,400 Thank you very much.