start	end	text
0	5140	All right. Welcome back, everybody. Next up, please welcome Steve, who will be speaking
5140	6900	about EasyPake Oven.
10020	14460	I'm Steve. You may know me as Scoobs. Thank you for coming to my talk.
15840	25500	So, a quick overview of my talk. It's going to be, you know,
25500	34640	what, why, which, password, KDFs, APIs, and HSMs, secret salt, and recovery.
35740	40140	So, what is a Pake? A Pake is a password key...
43940	48220	This always happens in, like, the first five minutes. I always get super nervous.
48220	51560	I know. Anyways. Woo!
55540	62560	Anyway. So, a password authenticated key exchange is just that. It's a key exchange
62560	71460	that has a password involved such that anyone trying to do any, like, malicious attacks or
71460	78820	anything like that gains nothing from it. It's a zero knowledge proof, and the only thing that
78820	88980	leaks is yes or no for whether your password was correct or wrong. It also has... there's
88980	94620	two different types of Pakes. Balanced and unbalanced. Sometimes it's called symmetric
94620	104220	and asymmetric or augmented. So, a balanced Pake is where it's peer-to-peer.
105820	119500	So, sorry. So, a balanced Pake is where you're peer-to-peer. So, this is, like,
119500	129360	two people that have a shared low entropy key, such as, like, a short password or something that
129360	138080	you prearranged or whatever. You can do a key exchange, and it can be secure.
138520	146320	The other way, the augmented asymmetric unbalanced way, is server client. So,
146320	153940	the server has a password, and the client has a password, and the server has a verifier
156140	162500	that... so, the verifier, it can't be used as a way to authenticate to the server. So,
162500	168900	if the database ever leaks, that verifier data can't be used to authenticate to the server. But
169540	174170	basically, it's a password hash equivalent, but not a password equivalent.
175550	185010	So, why should you use Pake? Well, it may seem overly complex or scary or something,
185010	191010	but there are some use cases where it helps with security.
194510	203110	So, one of these cases is recently, over the last... over a span of about a year,
203110	210530	these tech companies accidentally were logging passwords. And if the password is never sent to
210530	220090	the server, then you can't log the password. You might think, oh, I could hash the password
220090	226990	first and send it over, but... so, you secure the database really well, but you still log, like,
227290	233090	a simple hash of the password, and that's in the log. Those can be cracked easily. But even if
233090	239430	you logged all the Pake data that's being going... that's going back and forth, you would gain
239430	247230	nothing from that as an attacker. There... since this isn't, like, implemented in the browser,
247230	254590	you'd have to be... you'd have to implement it in JavaScript. And sometimes people have JavaScript
254590	264130	disabled, so you'd have to still have a fallback. But that's, you know, like, 1%. So, some other
264130	272470	uses, as I was saying, peer-to-peer. What you can do is secure peer-to-peer file transfer with
272470	282530	magic wormhole. You can also... so, that's the GitHub page for it. You can also... it's in package
282530	294790	managers for Linux. I actually don't know which ones, but... so, anyway, so, basically what it
294790	304090	does is you have this small shared secret that you send... that you tell someone, they type it in,
304090	310230	and then you can get a secure connection between the two of you, assuming that someone didn't man
310230	319970	the middle and guess what it was with one try. Another good thing Pakes are for are for encrypted
319970	326470	cloud services, like password managers and encrypted backups. Because they have to do
326470	333130	authentication and encryption with your password. And there's a lot of things that you can do
333130	344450	incorrectly with passwords. Such as... so, there's downgrade attacks that Pakes prevent. So, a bug
344450	352510	that last pass had was you would log in, it would say error... well, if the server was compromised,
352510	358410	the server could reply with error iterations one. You would be like, oh, oops, I had the iterations
358410	364670	wrong. So, then you would do one iteration, which would be a really fast hash, and then send that.
364670	370530	And then it would say error iterations, the correct amount of iterations for your account.
370530	376880	And all the user would see is that it took twice as long to log in. And they'd just be like...
379330	385760	Then there was keeper. This was on full disclosure.
391140	404870	And so, the bug here was... so, the way authentication and encryption worked on this
404870	412490	is there was a salt and iteration count for the authentication key. And then there was a salt and
412490	417870	iteration count for the encryption key. And both of those were run through PBKDF2. And then you
417870	424210	would get the authentication key or encryption key. But if you sent the... if an evil server sent
424210	432870	the encryption salt and iteration count for the authentication stage, the client would just
432870	442830	send the encryption key. So, that would be really bad. I forgot which way I decided on doing this.
444150	458070	So, the fix... well... so, they don't like people not praising them. So, I'm not gonna say this one.
459470	467030	But it was very obvious from the previous slide what they're doing wrong. Because they're doing
467030	474750	exactly the same thing except for the authentication key is now hashed. So, you can probably figure
474750	483810	out what's wrong. But if any... well, I guess I'm still... if they were using pigs for authentication,
483810	493310	then none of these attacks would work. So, there's a bunch of pigs. And which one do you use?
493730	502050	So, you may have heard recently about dragon fly and the pony award for dragon blood.
504350	512310	So, basically, it was a timing attack on their hash to point algorithm. Because it was like an
512310	519970	iterated loop which would then leak information. This is actually known to be bad a while ago. I
519970	525430	don't know why anyone uses dragon fly. I guess their marketing team is good or something. But
530390	539430	no one's actually done a real life test on such as with dragon blood, which is the cool part.
540630	551290	Anyway, so, there's SRP 6A. So, the client's on the left. Server's on the right. And those are
551290	558170	just... the arrows are just packets going back and forth. When you see a key, that means at that
558170	570530	stage, the... that side can encrypt or send... well, and send the authentication key. Or, yeah.
570530	582810	Verifier thing. So, only need to authenticate the user. Such as, like, logging into an account.
582810	594890	Then you wouldn't need to do the last step. There's... so, on the server side, the key is
594890	602870	actually available after the first packet. But if you send encrypted data or you... or send the
602870	608990	authentication token from the server to the client, the client actually has all the information
609550	616070	necessary to do offline brute force. So, if you were to do that, your implementation would be
616070	623670	really, really bad. So, when I was doing my slides, I remembered seeing something weird on Wikipedia
623670	634570	like a year ago. And being like, wait a minute. This is wrong. So, I haven't actually had time
634570	644490	to fix this. But according to this, you can skip M1, which is the authentication method...
645570	651570	verification from the client to the server. And M2 is verification from the server to the client.
651570	659930	If you skip M1 or... well, if you skip M1 and M2 and then you encrypt data to the client
660420	667630	before verifying the encrypted data from the client, then the client has everything it needs
667630	679990	to do a offline password cracking. So, opaque, that's the new hotness.
682650	699620	So, this pig was presented at real world crypto a few years ago. So, what they introduced was
701840	709400	blind salt. It has this interesting property. So, with other pigs, the salt is given to the client
709400	718340	or, you know, assumed or whatever. And, you know, like, when I say assumed, I mean, like,
718340	727420	the user name combined with the domain name. That's the salt. So, what happens with these
727420	735160	other pigs is you can run the password KDF, which is expensive, on a bunch of password guesses.
736040	744440	So, you store all those keys. And then when you want to, what you do is, well, once you're done
744440	751240	with enough, you go and break into the server, grab the verification data, and run through all
751240	759700	those passwords extremely fast. So, if you are in a limited time scale from when you get in to when
759700	767160	they're going to change passwords or something, you would want to do this. It's like a theoretical
767160	779160	attack. But with opaque, with the blind salt, there's basically it prevents that by, well,
779160	787160	actually, so, you don't really have to read this. It's just sort of there. So, this is how blind
787160	798260	salt works. Basically, after it runs through, if you had the wrong password at the beginning, so,
798260	804180	H, that's a fast hash. That's not like a password KDF or anything. There's no information linkage
804180	810240	on this. There's no way to, you know, from the client's message to know, oh, hey, the password
810240	819340	could have been like that or something. But, so, if the password is wrong at the beginning,
819340	825420	then when you get back your blind salt, it will be the wrong salt. And then when you're doing the
825420	834720	password KDF, it will be also wrong. So, basically, you have to do this all. There's one small thing
834720	846940	with, so, the S column. Okay. You can't really see that. So, server, the part where that's doing
846940	853220	its work, if you're doing that with elliptic curves, basically, what's happening is the
853220	859260	server is receiving a point and then applying a private value to that. The same private value
859260	869440	every single time. And what you can do with that is if there's a implementation error, such as
870180	879860	this one implementation had a rare carry bug. And Sean and Filippo,
883700	891780	they did a black hat talk about breaking that. They were able to, so, every now and then,
891780	897180	given a point, it would cause an error. And when the value was incorrect, they could then
897180	903720	determine some information about the private key. They were able to recover the entire private key.
903720	914440	So, if the secret, the server is ever leaked in a case like that, then it would completely break
914440	924170	opaque because that would give you all the data as an attacker to do line password cracking.
925130	947160	So, SPake 2 plus EE with blind salt. That's a mouthful. So, basically, what I did was I added
947160	959360	blind salt to SPake 2 plus EE. And I ended up making the name smaller to BSpake or BSpake.
959380	968740	So, basically, it's similar to the round trips. Well, it is the same as the round trips for
970820	981520	SRP. Except for this has an extra property that not many Pakes have. Well, it also has the
981520	988000	property that opaque has where it prevents precomputations.
989800	999080	So, this also has a property that is fairly interesting. So, it's sort of quantum resistant.
999080	1003740	I call it quantum annoying. It's not really a quantum easy problem. It's not a quantum hard
1003740	1015220	problem. Basically, most Pakes, you have to solve one DLP and then you can do offline classical
1015220	1028720	computer password guessing. But with BSpake, you have to solve one DLP for every password guess.
1028720	1039620	So, it's fairly expensive because even if we did have quantum computers, I forgot to look this up.
1039620	1048680	There's this paper that tells you, like, how many quantum operations you have to do to solve a DLP
1048680	1058840	for a 256-bit elliptic curve, which is on the order of a few billion. So, even if you could do,
1058840	1065180	if your theoretical quantum computer could do a billion quantum operations per second,
1065180	1071580	you're looking at, you know, .1 passwords per second with a very expensive computer.
1071580	1079020	There is a PQPake. I haven't actually looked into it that much. But,
1081080	1088140	basically, with post-quantum algorithms, we don't really trust them that well yet. So,
1088140	1097040	we usually run them in parallel with classical cryptography, like elliptic curves and whatnot.
1097040	1107500	And so, with a Pake, you can't really run a PQPake next to a
1107500	1118700	BSPake. Because you wouldn't get the combination. It would be whichever is the weakest one.
1118700	1124100	So, basically, I think the best Pake to use is BSPake.
1124100	1133660	So, this brings us to password KDFs. So, there's many different ones. One that you probably
1133660	1140720	have heard of, or most common, probably, is just computationally hard. It's called
1140720	1151320	PBKDF2. There's just one small problem with it. It has a foot gun. So, it runs in iterations times
1151320	1162280	output length. So, if you ask for so, if you're doing PBKDF2 HMAC SHA-256, each block of output
1162280	1172580	of SHA-256 is 256 bits. So, if you ask for 256 bits of key, then you only do iterations amount
1172580	1181840	of work. But if you ask for 257 bits, then it has to do two blocks, and thus, it needs to do
1181840	1198580	twice as much work. So, one password, they generated an IV and a key from PBKDF2, and an
1198580	1207620	attacker only needed to generate one of those blocks and decrypt some stuff. And it was Adam
1207620	1213680	from Hashcat that found that. And then, technically, Google Sync isn't on this list, but I like
1213680	1222660	bringing them up because they did fairly bad. Basically, for Google Sync, they use Nigori,
1222660	1232640	which the first thing that they do is they use PBKDF2 on constant data to generate assault. Then
1232640	1240260	they do three more runs of PBKDF2 to generate three different keys. Technically, they could
1240260	1246980	have done PBKDF2 with just like a long output, which is kind of like what the foot gun would
1246980	1261020	have done. And then Microsoft, they were using was SHA1 base, so 160 bits, and they were asking
1261020	1270140	for, or they were storing 256 bits. So, their servers had to do twice as much calculations as
1270140	1279260	an attacker would have to. But, good thing, each block of output is independently generated. So,
1279260	1286720	is the foot gun to actually make PBKDF2 better? Because what they're doing, each block is
1286720	1294540	independently generated. So, you can use SIMD, which is single instruction multiple data.
1294540	1305980	So, with x86, you have SC2, AVX, AVX2, AVX512. AVX512, that can run 16
1307700	1317140	iterations of PBKDF2 SHA256 at the same time. So, it would be 16 times more work being done
1317140	1322600	in the same amount of time, and then you have multiple cores. So, you can make PBKDF a little
1322600	1330860	bit better, but still, other algorithms are better. You really shouldn't be using a script
1330860	1339220	at this point, because of the time memory tradeoff. Basically, an attacker is the only one
1339220	1345190	that actually uses this, to their advantage, because they use less memory, and they do a
1345190	1354150	little bit more work. And it ends up being faster overall. So, instead, you should be using
1354150	1363470	Argon2, but the problem with Argon2 is for short runs, for like authentication, you can't use
1363470	1376330	enough memory. It's just too slow. So, technically, a better algorithm would be a cache
1376330	1387670	hard algorithm. Bcrypt isn't actually a KDF, but there are some weird ones like PBKDF, Bcrypt,
1387670	1397710	or whatever. And then there's also Pufferfish. There are issues, but whatever. Really, I would
1397710	1414330	say, currently, Argon2 would probably be the ideal way to go. So, with, so, the problem with
1414330	1425850	pick APIs is, so, this is what you usually see when you see an implementation of SRP. So,
1425850	1433290	calculate B, calculate M2, what's V? And, you know, so, basically, the developer has to figure
1433290	1443250	out what all these are. And then they're like, okay, and some implementations leave it up to
1443250	1449910	the developer to figure out whether, how they're supposed to check M1, M2, which one they send
1449910	1463050	first, and whatnot. And as I said before, with SRP, this can lead to very bad bugs. So, a good
1463610	1474150	API would be one that is easy to use and hard to misuse. So, basically, you start, you say who
1474150	1480170	you are, who the other person is, and your secret. If you're a client, or, you know, it's a symmetric
1480170	1485990	pick, this would be a password. If you're the server, then this would be your server secret
1485990	1495370	data. Then you say, you let the API know what type of user you are and what type of mode you're
1495370	1505270	using. And it will return a message status. You check the status for whatever. And the message,
1505270	1512770	you may or may not get a message back. If you do, you send it to the other side.
1517450	1524390	So, when you receive a message, you pass it into receive message. And then you get another
1524390	1529770	message and a status. And every time you get a message, you send it to the other side. And you
1529770	1537490	check to see if you're finished by the status. And then there's certain other things that you
1537490	1550170	can do. Like, get server secret. Get user key. So, user key is a little bit different. It's
1550170	1558410	kind of unrelated to pigs. But so, you're supposed to only run the password KDF once.
1559390	1566270	And derive two keys from it. An authentication key and an encryption key. And since we're using
1566990	1573050	blind salt and we can't generate two keys beforehand and give it to the API,
1573990	1584770	we have the API run the password KDF. If you need a user key, which is user specific based on the
1584770	1591330	password to encrypt data that only the user can read. So, you know, like a password vault or
1591790	1601730	a, you know, encrypted backup or something. So, you know, what's client server. So,
1601730	1609950	those are for augmented. And then Alice, Bob. So, there are some pigs where you have to say,
1609950	1618070	I'm Alice, they're Bob. And vice versa. Or you can say, I'm either Alice or Bob. And the pig
1618070	1625650	figures it out. And then mode uses, you know, you're using the pig. And then
1628010	1635290	register. That just generates the server and gets sent to the server. Then the other two are
1635290	1639170	special for a special case that we'll talk about later.
1641350	1646470	You know, so, these are just the flags. Session key available. That means you can encrypt.
1646470	1653590	So, that's there. Then you can get the session key and then start encrypting data to the other
1653590	1663210	side. Server secret available. Fairly self explanatory. Verified other. You have already
1663210	1672270	authenticated the other party. So, in the event that, like, you only want to verify the user,
1672270	1680710	you could stop right then. Because if you're the server, because that's the whole entire goal is
1680710	1693810	just verify that the user's password is correct. So, fairly straightforward. So, this is just,
1693810	1702530	so, Carol, client, Steve, server. Hey, that's me. Those are actually the common names that are
1702530	1718330	used for describing client and user. Just like, you know, Alice, Bob. So, fairly easy. So, the
1719330	1726790	server doesn't have a server secret yet because it's on register. So, no. And, you know, for
1726790	1736830	using, fairly straightforward. The common, this is for using or it's all pseudocode. But for
1736830	1743730	using or registering. Because all you're doing is waiting until it's finished or errored out. And
1743730	1753830	then you're just passing messages back and forth. There we go. So,
1756130	1772310	HSM. So, basically, what you can do as a server is you can have an HSM that store, that has,
1773110	1782370	that you give it encrypted data. And what it does is it does the whole PAKE algorithm on its own.
1782370	1791950	So, that if your database ever gets leaked, then the an attacker wouldn't have the decryption key
1791950	1803410	necessary to decrypt the verifying data. And they wouldn't be able to crack any passwords.
1803970	1811250	So, the way it would work is, so, the is on the far left. Out of the picture.
1811250	1818410	One goes that way. That's basically. So, finds the user. Gets the encrypted data. Sends it to the
1821050	1828290	HSM. Decrypts it. And then it has the server secret data. Then it runs the PAKE and gets
1828290	1836550	the session key. Then this is actually a slide from another talk that I gave a few years ago
1837810	1846530	at B sides. So, this was for when you have, like, an encrypted service. So, you would have
1846530	1851950	an encrypted master key. So, that when you change your password, you didn't have to reencrypt
1851950	1860430	everything. So, what some does is, it encrypts the master key with the session key. Sends that
1860430	1868810	over to the client. No one in between the HSM and the client can read these packets because of
1868810	1878130	the PAKE session. And then a little bonus feature is, you can drive a second key from the session
1878130	1885970	key or another session key from the session key and give that to the server so that they can
1887290	1893330	talk to the client in a way such that no one in between the server and the client
1893330	1901850	can man in the middle of that without knowing the password. So, secret salt.
1905350	1914150	So, this is used by, well, they call it something else. They changed the name a few times. This is
1914150	1923330	used by one password. So, what this allows you to do is, it's basically a key that's on your
1923330	1930830	device. And you never send it to the server or anything like that. And you basically transfer
1930830	1943250	it to all your devices some way. And then what it does is, it makes it so that an attacker would
1943250	1951070	have to get your device, get the secret salt, and then they can then do online password guessing
1952050	1960510	to the server. Which means that if it was in, like, a password manager, it would be actually
1960510	1975230	more secure than an offline password manager. So, there is one small thing about one password.
1977610	1987090	So, they require you to use a, their web client, which means if their servers are ever
1989650	1999710	attacked or, you know, infiltrated, then when you do use the web client, then they can
1999710	2007870	extract, send malicious JavaScript, which then can extract your key, which would be bad. But
2008450	2015630	that's only during administration because that's not actually implemented in any of the
2017530	2032450	other apps that they have. So, recovering a lost secret salt. I wrote a blog post about it.
2032450	2043510	You can actually just go to tab2.com slash blog. I was lazy and it's just, like, you can,
2043510	2055250	it's just directories. So, so, to the basic idea behind recovering a secret salt.
2056030	2064990	So, if you ever lose the secret salt, then you're screwed. Even though you know your password,
2064990	2073390	you just can't log in. And this would be really bad for users, which is why you need to make
2073390	2084210	paper copies, which they won't make and what. But so, taking a recovery option for secret salt
2084990	2094930	would invalidate the entire idea of having a secret salt, except there's this little trick.
2094990	2102710	So, when you're doing, so, the recovery method is you do the password KDF with
2102710	2113290	the, with another blind salt and your password and this guessing salt. It's, like, 16 bits.
2113290	2120670	And what you do is after you run the password KDF, you throw away those 16 bits. And what you
2120670	2129550	have to do from then is you have to, when you're recovering, you have to brute force those 16 bits
2129550	2139010	that you don't know. So, if you ran a password KDF that was Argon 2 with 256 meg, one thread,
2139010	2147150	three iterations, it would run for about one second on your computer. So, it would be, like,
2147150	2154990	18 hours. You probably have a few less bits than that so that it would run in a more reasonable
2154990	2163430	amount of time, like, a couple hours. The thing is, you never actually, you're rarely ever doing
2163430	2174390	this. So, from the user standpoint, it's, I never get my account back or I have to do two hours of
2174390	2187070	hard computations on my computer. And since it takes, you know, two hours for one password guess,
2187070	2200150	if a password cracker got this, that is a ridiculously slow speed. So, the recovery
2200150	2209450	method also uses a pake and whatnot. But that's what those two extra ones were, the blind salt.
2209450	2221670	So, you would actually need to do... there we go. So, these two, blind salt, only blind salt,
2221670	2228130	you would do that with your password and then you would get back your blind salt. Then you would go
2228130	2237890	and do your, basically, brute force the guessing salt. And then after that, you would have a bunch
2237890	2245530	of candidates, which you would then use after blind salt. You're also given a very short,
2245690	2255150	a smaller hash than the guessing salt. So, you'll have a few, like, 10 or whatever that you would
2255150	2266230	have to do. Pake operations with the server. Then you would have a session key and then you
2266230	2277890	would decrypt the secret salt that you lost. And then you would have it back. Questions? Yeah.
2277890	2290510	All right. Thank you very much. Any questions? I'm slowly making my way up to the front. Can we
2290510	2293170	have this with the mic, please? I'll be right there.
2295250	2302530	Thanks. Sorry, I walked in late. I missed what a blind salt is. I missed what a blind salt is.
2302530	2312190	Oh! I walked in. Sorry. There we go. So, basically, blind salt prevents pre-computational
2312190	2334740	attacks. It was first added into a pake with opaque. So, basically, with this, so, basically,
2334740	2342160	after you run through this, if you had the wrong password, you have the wrong salt for when you
2342160	2353900	run your password KDF. And there's no information leakage in the algorithm. So, you can't, like,
2353900	2361320	guess or whatnot what the password was from the server side. And this makes it so that you have
2361320	2371660	to do online password guessing. Well, thanks for doing this talk, Steve. I think pakes are
2371660	2377040	definitely underutilized and the landscape is definitely kind of confusing. So, have you
2377040	2381520	thought about contributing an implementation of your API to something like Libsodium just to make
2381520	2388780	it easier for developers? So, the nice thing is, you can actually, you don't really have to write
2388780	2396370	much. You just have to write the, basically, like a wrapper for current implementation.
2397560	2400280	What project did you say?
2401080	2405020	Libsodium or any other general crypto library?
2406620	2424240	Yeah. I did talk to, I forgot his name. Libsodium guy. Yeah. He didn't like it.
2424580	2429860	What? No, he didn't like it.
2430280	2432320	But, yeah.
2432320	2440180	Thanks for your talk. Could you repeat, again, how Opaque and BSpake compare? Are they different?
2440880	2452080	So, Opaque, basically, so, with Opaque, it's fragile for implementations because of
2452080	2460160	the blind salt. Basically, if you solve that DLP or figure out, you know, like,
2460160	2470960	what the salt is through some coding error, like the carry propagation, then the, an attacker
2470960	2485660	would be able to get offline pass or guessing. And with BSpake, it does add some, another
2487000	2496220	pass back and forth. Or, well, one more trip. But it has an extra property that is
2497760	2504620	quantum annoying. It's just a name I came up with. I'm not really attached to it. But,
2504620	2516700	um, basically, uh, due to the hash to point blinding on, uh, the, well, the, uh, the base
2516700	2527320	function, uh, uh, uh, SPake 2 plus EE that it's based off of, uh, that blinding, uh, prevents,
2527320	2533660	you, well, it requires you to, uh, solve one DLP for every password guess.
2534100	2543380	So, um, so with hash to point, um, what that does is it creates a point on the curve that you
2543380	2556960	don't know what the, um, the, uh, the, uh, discrete log is. So, uh, when you are trying to
2556960	2563160	attack this, you would have to guess a password, then hash it, it would go hash to point, then
2563160	2567880	you subtract it from the message that you saw that went by. And then you would have to solve
2567880	2575560	the, uh, the DLP for what's left. And you would have to do that every single time. First,
2575560	2580380	other picks where you just have to solve one and then you have everything that you need.
2581020	2588180	Oh, there was one other thing with Opaque. Uh, you don't need to observe a successful
2588180	2597660	key exchange, but with, uh, uh, Bspake, um, you have to observe a successful key exchange to be
2597660	2606040	able to then, uh, use a quantum computer if it were to exist. Uh, and you'd have to do one for
2606040	2617370	every guess. Any further questions? All right. One last round of applause for our speaker.
2617370	2618190	Thank you.
