All right. Welcome back, everybody. Next up, please welcome Steve, who will be speaking about EasyPake Oven. I'm Steve. You may know me as Scoobs. Thank you for coming to my talk. So, a quick overview of my talk. It's going to be, you know, what, why, which, password, KDFs, APIs, and HSMs, secret salt, and recovery. So, what is a Pake? A Pake is a password key... This always happens in, like, the first five minutes. I always get super nervous. I know. Anyways. Woo! Anyway. So, a password authenticated key exchange is just that. It's a key exchange that has a password involved such that anyone trying to do any, like, malicious attacks or anything like that gains nothing from it. It's a zero knowledge proof, and the only thing that leaks is yes or no for whether your password was correct or wrong. It also has... there's two different types of Pakes. Balanced and unbalanced. Sometimes it's called symmetric and asymmetric or augmented. So, a balanced Pake is where it's peer-to-peer. So, sorry. So, a balanced Pake is where you're peer-to-peer. So, this is, like, two people that have a shared low entropy key, such as, like, a short password or something that you prearranged or whatever. You can do a key exchange, and it can be secure. The other way, the augmented asymmetric unbalanced way, is server client. So, the server has a password, and the client has a password, and the server has a verifier that... so, the verifier, it can't be used as a way to authenticate to the server. So, if the database ever leaks, that verifier data can't be used to authenticate to the server. But basically, it's a password hash equivalent, but not a password equivalent. So, why should you use Pake? Well, it may seem overly complex or scary or something, but there are some use cases where it helps with security. So, one of these cases is recently, over the last... over a span of about a year, these tech companies accidentally were logging passwords. And if the password is never sent to the server, then you can't log the password. You might think, oh, I could hash the password first and send it over, but... so, you secure the database really well, but you still log, like, a simple hash of the password, and that's in the log. Those can be cracked easily. But even if you logged all the Pake data that's being going... that's going back and forth, you would gain nothing from that as an attacker. There... since this isn't, like, implemented in the browser, you'd have to be... you'd have to implement it in JavaScript. And sometimes people have JavaScript disabled, so you'd have to still have a fallback. But that's, you know, like, 1%. So, some other uses, as I was saying, peer-to-peer. What you can do is secure peer-to-peer file transfer with magic wormhole. You can also... so, that's the GitHub page for it. You can also... it's in package managers for Linux. I actually don't know which ones, but... so, anyway, so, basically what it does is you have this small shared secret that you send... that you tell someone, they type it in, and then you can get a secure connection between the two of you, assuming that someone didn't man the middle and guess what it was with one try. Another good thing Pakes are for are for encrypted cloud services, like password managers and encrypted backups. Because they have to do authentication and encryption with your password. And there's a lot of things that you can do incorrectly with passwords. Such as... so, there's downgrade attacks that Pakes prevent. So, a bug that last pass had was you would log in, it would say error... well, if the server was compromised, the server could reply with error iterations one. You would be like, oh, oops, I had the iterations wrong. So, then you would do one iteration, which would be a really fast hash, and then send that. And then it would say error iterations, the correct amount of iterations for your account. And all the user would see is that it took twice as long to log in. And they'd just be like... Then there was keeper. This was on full disclosure. And so, the bug here was... so, the way authentication and encryption worked on this is there was a salt and iteration count for the authentication key. And then there was a salt and iteration count for the encryption key. And both of those were run through PBKDF2. And then you would get the authentication key or encryption key. But if you sent the... if an evil server sent the encryption salt and iteration count for the authentication stage, the client would just send the encryption key. So, that would be really bad. I forgot which way I decided on doing this. So, the fix... well... so, they don't like people not praising them. So, I'm not gonna say this one. But it was very obvious from the previous slide what they're doing wrong. Because they're doing exactly the same thing except for the authentication key is now hashed. So, you can probably figure out what's wrong. But if any... well, I guess I'm still... if they were using pigs for authentication, then none of these attacks would work. So, there's a bunch of pigs. And which one do you use? So, you may have heard recently about dragon fly and the pony award for dragon blood. So, basically, it was a timing attack on their hash to point algorithm. Because it was like an iterated loop which would then leak information. This is actually known to be bad a while ago. I don't know why anyone uses dragon fly. I guess their marketing team is good or something. But no one's actually done a real life test on such as with dragon blood, which is the cool part. Anyway, so, there's SRP 6A. So, the client's on the left. Server's on the right. And those are just... the arrows are just packets going back and forth. When you see a key, that means at that stage, the... that side can encrypt or send... well, and send the authentication key. Or, yeah. Verifier thing. So, only need to authenticate the user. Such as, like, logging into an account. Then you wouldn't need to do the last step. There's... so, on the server side, the key is actually available after the first packet. But if you send encrypted data or you... or send the authentication token from the server to the client, the client actually has all the information necessary to do offline brute force. So, if you were to do that, your implementation would be really, really bad. So, when I was doing my slides, I remembered seeing something weird on Wikipedia like a year ago. And being like, wait a minute. This is wrong. So, I haven't actually had time to fix this. But according to this, you can skip M1, which is the authentication method... verification from the client to the server. And M2 is verification from the server to the client. If you skip M1 or... well, if you skip M1 and M2 and then you encrypt data to the client before verifying the encrypted data from the client, then the client has everything it needs to do a offline password cracking. So, opaque, that's the new hotness. So, this pig was presented at real world crypto a few years ago. So, what they introduced was blind salt. It has this interesting property. So, with other pigs, the salt is given to the client or, you know, assumed or whatever. And, you know, like, when I say assumed, I mean, like, the user name combined with the domain name. That's the salt. So, what happens with these other pigs is you can run the password KDF, which is expensive, on a bunch of password guesses. So, you store all those keys. And then when you want to, what you do is, well, once you're done with enough, you go and break into the server, grab the verification data, and run through all those passwords extremely fast. So, if you are in a limited time scale from when you get in to when they're going to change passwords or something, you would want to do this. It's like a theoretical attack. But with opaque, with the blind salt, there's basically it prevents that by, well, actually, so, you don't really have to read this. It's just sort of there. So, this is how blind salt works. Basically, after it runs through, if you had the wrong password at the beginning, so, H, that's a fast hash. That's not like a password KDF or anything. There's no information linkage on this. There's no way to, you know, from the client's message to know, oh, hey, the password could have been like that or something. But, so, if the password is wrong at the beginning, then when you get back your blind salt, it will be the wrong salt. And then when you're doing the password KDF, it will be also wrong. So, basically, you have to do this all. There's one small thing with, so, the S column. Okay. You can't really see that. So, server, the part where that's doing its work, if you're doing that with elliptic curves, basically, what's happening is the server is receiving a point and then applying a private value to that. The same private value every single time. And what you can do with that is if there's a implementation error, such as this one implementation had a rare carry bug. And Sean and Filippo, they did a black hat talk about breaking that. They were able to, so, every now and then, given a point, it would cause an error. And when the value was incorrect, they could then determine some information about the private key. They were able to recover the entire private key. So, if the secret, the server is ever leaked in a case like that, then it would completely break opaque because that would give you all the data as an attacker to do line password cracking. So, SPake 2 plus EE with blind salt. That's a mouthful. So, basically, what I did was I added blind salt to SPake 2 plus EE. And I ended up making the name smaller to BSpake or BSpake. So, basically, it's similar to the round trips. Well, it is the same as the round trips for SRP. Except for this has an extra property that not many Pakes have. Well, it also has the property that opaque has where it prevents precomputations. So, this also has a property that is fairly interesting. So, it's sort of quantum resistant. I call it quantum annoying. It's not really a quantum easy problem. It's not a quantum hard problem. Basically, most Pakes, you have to solve one DLP and then you can do offline classical computer password guessing. But with BSpake, you have to solve one DLP for every password guess. So, it's fairly expensive because even if we did have quantum computers, I forgot to look this up. There's this paper that tells you, like, how many quantum operations you have to do to solve a DLP for a 256-bit elliptic curve, which is on the order of a few billion. So, even if you could do, if your theoretical quantum computer could do a billion quantum operations per second, you're looking at, you know, .1 passwords per second with a very expensive computer. There is a PQPake. I haven't actually looked into it that much. But, basically, with post-quantum algorithms, we don't really trust them that well yet. So, we usually run them in parallel with classical cryptography, like elliptic curves and whatnot. And so, with a Pake, you can't really run a PQPake next to a BSPake. Because you wouldn't get the combination. It would be whichever is the weakest one. So, basically, I think the best Pake to use is BSPake. So, this brings us to password KDFs. So, there's many different ones. One that you probably have heard of, or most common, probably, is just computationally hard. It's called PBKDF2. There's just one small problem with it. It has a foot gun. So, it runs in iterations times output length. So, if you ask for so, if you're doing PBKDF2 HMAC SHA-256, each block of output of SHA-256 is 256 bits. So, if you ask for 256 bits of key, then you only do iterations amount of work. But if you ask for 257 bits, then it has to do two blocks, and thus, it needs to do twice as much work. So, one password, they generated an IV and a key from PBKDF2, and an attacker only needed to generate one of those blocks and decrypt some stuff. And it was Adam from Hashcat that found that. And then, technically, Google Sync isn't on this list, but I like bringing them up because they did fairly bad. Basically, for Google Sync, they use Nigori, which the first thing that they do is they use PBKDF2 on constant data to generate assault. Then they do three more runs of PBKDF2 to generate three different keys. Technically, they could have done PBKDF2 with just like a long output, which is kind of like what the foot gun would have done. And then Microsoft, they were using was SHA1 base, so 160 bits, and they were asking for, or they were storing 256 bits. So, their servers had to do twice as much calculations as an attacker would have to. But, good thing, each block of output is independently generated. So, is the foot gun to actually make PBKDF2 better? Because what they're doing, each block is independently generated. So, you can use SIMD, which is single instruction multiple data. So, with x86, you have SC2, AVX, AVX2, AVX512. AVX512, that can run 16 iterations of PBKDF2 SHA256 at the same time. So, it would be 16 times more work being done in the same amount of time, and then you have multiple cores. So, you can make PBKDF a little bit better, but still, other algorithms are better. You really shouldn't be using a script at this point, because of the time memory tradeoff. Basically, an attacker is the only one that actually uses this, to their advantage, because they use less memory, and they do a little bit more work. And it ends up being faster overall. So, instead, you should be using Argon2, but the problem with Argon2 is for short runs, for like authentication, you can't use enough memory. It's just too slow. So, technically, a better algorithm would be a cache hard algorithm. Bcrypt isn't actually a KDF, but there are some weird ones like PBKDF, Bcrypt, or whatever. And then there's also Pufferfish. There are issues, but whatever. Really, I would say, currently, Argon2 would probably be the ideal way to go. So, with, so, the problem with pick APIs is, so, this is what you usually see when you see an implementation of SRP. So, calculate B, calculate M2, what's V? And, you know, so, basically, the developer has to figure out what all these are. And then they're like, okay, and some implementations leave it up to the developer to figure out whether, how they're supposed to check M1, M2, which one they send first, and whatnot. And as I said before, with SRP, this can lead to very bad bugs. So, a good API would be one that is easy to use and hard to misuse. So, basically, you start, you say who you are, who the other person is, and your secret. If you're a client, or, you know, it's a symmetric pick, this would be a password. If you're the server, then this would be your server secret data. Then you say, you let the API know what type of user you are and what type of mode you're using. And it will return a message status. You check the status for whatever. And the message, you may or may not get a message back. If you do, you send it to the other side. So, when you receive a message, you pass it into receive message. And then you get another message and a status. And every time you get a message, you send it to the other side. And you check to see if you're finished by the status. And then there's certain other things that you can do. Like, get server secret. Get user key. So, user key is a little bit different. It's kind of unrelated to pigs. But so, you're supposed to only run the password KDF once. And derive two keys from it. An authentication key and an encryption key. And since we're using blind salt and we can't generate two keys beforehand and give it to the API, we have the API run the password KDF. If you need a user key, which is user specific based on the password to encrypt data that only the user can read. So, you know, like a password vault or a, you know, encrypted backup or something. So, you know, what's client server. So, those are for augmented. And then Alice, Bob. So, there are some pigs where you have to say, I'm Alice, they're Bob. And vice versa. Or you can say, I'm either Alice or Bob. And the pig figures it out. And then mode uses, you know, you're using the pig. And then register. That just generates the server and gets sent to the server. Then the other two are special for a special case that we'll talk about later. You know, so, these are just the flags. Session key available. That means you can encrypt. So, that's there. Then you can get the session key and then start encrypting data to the other side. Server secret available. Fairly self explanatory. Verified other. You have already authenticated the other party. So, in the event that, like, you only want to verify the user, you could stop right then. Because if you're the server, because that's the whole entire goal is just verify that the user's password is correct. So, fairly straightforward. So, this is just, so, Carol, client, Steve, server. Hey, that's me. Those are actually the common names that are used for describing client and user. Just like, you know, Alice, Bob. So, fairly easy. So, the server doesn't have a server secret yet because it's on register. So, no. And, you know, for using, fairly straightforward. The common, this is for using or it's all pseudocode. But for using or registering. Because all you're doing is waiting until it's finished or errored out. And then you're just passing messages back and forth. There we go. So, HSM. So, basically, what you can do as a server is you can have an HSM that store, that has, that you give it encrypted data. And what it does is it does the whole PAKE algorithm on its own. So, that if your database ever gets leaked, then the an attacker wouldn't have the decryption key necessary to decrypt the verifying data. And they wouldn't be able to crack any passwords. So, the way it would work is, so, the is on the far left. Out of the picture. One goes that way. That's basically. So, finds the user. Gets the encrypted data. Sends it to the HSM. Decrypts it. And then it has the server secret data. Then it runs the PAKE and gets the session key. Then this is actually a slide from another talk that I gave a few years ago at B sides. So, this was for when you have, like, an encrypted service. So, you would have an encrypted master key. So, that when you change your password, you didn't have to reencrypt everything. So, what some does is, it encrypts the master key with the session key. Sends that over to the client. No one in between the HSM and the client can read these packets because of the PAKE session. And then a little bonus feature is, you can drive a second key from the session key or another session key from the session key and give that to the server so that they can talk to the client in a way such that no one in between the server and the client can man in the middle of that without knowing the password. So, secret salt. So, this is used by, well, they call it something else. They changed the name a few times. This is used by one password. So, what this allows you to do is, it's basically a key that's on your device. And you never send it to the server or anything like that. And you basically transfer it to all your devices some way. And then what it does is, it makes it so that an attacker would have to get your device, get the secret salt, and then they can then do online password guessing to the server. Which means that if it was in, like, a password manager, it would be actually more secure than an offline password manager. So, there is one small thing about one password. So, they require you to use a, their web client, which means if their servers are ever attacked or, you know, infiltrated, then when you do use the web client, then they can extract, send malicious JavaScript, which then can extract your key, which would be bad. But that's only during administration because that's not actually implemented in any of the other apps that they have. So, recovering a lost secret salt. I wrote a blog post about it. You can actually just go to tab2.com slash blog. I was lazy and it's just, like, you can, it's just directories. So, so, to the basic idea behind recovering a secret salt. So, if you ever lose the secret salt, then you're screwed. Even though you know your password, you just can't log in. And this would be really bad for users, which is why you need to make paper copies, which they won't make and what. But so, taking a recovery option for secret salt would invalidate the entire idea of having a secret salt, except there's this little trick. So, when you're doing, so, the recovery method is you do the password KDF with the, with another blind salt and your password and this guessing salt. It's, like, 16 bits. And what you do is after you run the password KDF, you throw away those 16 bits. And what you have to do from then is you have to, when you're recovering, you have to brute force those 16 bits that you don't know. So, if you ran a password KDF that was Argon 2 with 256 meg, one thread, three iterations, it would run for about one second on your computer. So, it would be, like, 18 hours. You probably have a few less bits than that so that it would run in a more reasonable amount of time, like, a couple hours. The thing is, you never actually, you're rarely ever doing this. So, from the user standpoint, it's, I never get my account back or I have to do two hours of hard computations on my computer. And since it takes, you know, two hours for one password guess, if a password cracker got this, that is a ridiculously slow speed. So, the recovery method also uses a pake and whatnot. But that's what those two extra ones were, the blind salt. So, you would actually need to do... there we go. So, these two, blind salt, only blind salt, you would do that with your password and then you would get back your blind salt. Then you would go and do your, basically, brute force the guessing salt. And then after that, you would have a bunch of candidates, which you would then use after blind salt. You're also given a very short, a smaller hash than the guessing salt. So, you'll have a few, like, 10 or whatever that you would have to do. Pake operations with the server. Then you would have a session key and then you would decrypt the secret salt that you lost. And then you would have it back. Questions? Yeah. All right. Thank you very much. Any questions? I'm slowly making my way up to the front. Can we have this with the mic, please? I'll be right there. Thanks. Sorry, I walked in late. I missed what a blind salt is. I missed what a blind salt is. Oh! I walked in. Sorry. There we go. So, basically, blind salt prevents pre-computational attacks. It was first added into a pake with opaque. So, basically, with this, so, basically, after you run through this, if you had the wrong password, you have the wrong salt for when you run your password KDF. And there's no information leakage in the algorithm. So, you can't, like, guess or whatnot what the password was from the server side. And this makes it so that you have to do online password guessing. Well, thanks for doing this talk, Steve. I think pakes are definitely underutilized and the landscape is definitely kind of confusing. So, have you thought about contributing an implementation of your API to something like Libsodium just to make it easier for developers? So, the nice thing is, you can actually, you don't really have to write much. You just have to write the, basically, like a wrapper for current implementation. What project did you say? Libsodium or any other general crypto library? Yeah. I did talk to, I forgot his name. Libsodium guy. Yeah. He didn't like it. What? No, he didn't like it. But, yeah. Thanks for your talk. Could you repeat, again, how Opaque and BSpake compare? Are they different? So, Opaque, basically, so, with Opaque, it's fragile for implementations because of the blind salt. Basically, if you solve that DLP or figure out, you know, like, what the salt is through some coding error, like the carry propagation, then the, an attacker would be able to get offline pass or guessing. And with BSpake, it does add some, another pass back and forth. Or, well, one more trip. But it has an extra property that is quantum annoying. It's just a name I came up with. I'm not really attached to it. But, um, basically, uh, due to the hash to point blinding on, uh, the, well, the, uh, the base function, uh, uh, uh, SPake 2 plus EE that it's based off of, uh, that blinding, uh, prevents, you, well, it requires you to, uh, solve one DLP for every password guess. So, um, so with hash to point, um, what that does is it creates a point on the curve that you don't know what the, um, the, uh, the, uh, discrete log is. So, uh, when you are trying to attack this, you would have to guess a password, then hash it, it would go hash to point, then you subtract it from the message that you saw that went by. And then you would have to solve the, uh, the DLP for what's left. And you would have to do that every single time. First, other picks where you just have to solve one and then you have everything that you need. Oh, there was one other thing with Opaque. Uh, you don't need to observe a successful key exchange, but with, uh, uh, Bspake, um, you have to observe a successful key exchange to be able to then, uh, use a quantum computer if it were to exist. Uh, and you'd have to do one for every guess. Any further questions? All right. One last round of applause for our speaker. Thank you.