-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Security: weak key material used for encrypting passwords #4
Comments
Hi! Thanks for opening this issue; security is one of the aspects of this project I wanted to compartmentalize to easily get and implement feedback. My intentions for this device is to allow the user to choose their own security level. For example, I choose a 4-digit PIN for my Zamek because I am sure that I would be able to change all of my passwords in less than a day if I lose my device ( using a backup I keep at home ). Other people may choose longer passwords to get extra time. The balance between convenience and security is tough and I want to leave this issue open for discussion :) One idea I had was to initialize the password store with a completely random 16-digit number and allow the user to edit certain digits, e.g. your randomly generated seed is 123456789abcdef, and your PIN is 4031, then the seed would be 403156789abcdef. Storing these last few digits somewhere other than a secure store is a weakness, but it needs to be nonvolatile... I assume if someone has hardware access then they can dump your payload and anything else on the device at will, so at most this should give you some extra time to change your passwords if your device gets stolen.... This probably needs input from a security expert. |
In my opinion you should use key derivation function. This crypto scheme turns input into fixed-size key (for your usage it turns PIN into 128 bits length AES key). You can use AES-KDF scheme (which is used by KeePass) or PBKDF2 (it is more flexible solution because you can choose pseudorandom function which determines security). An additional advantage of using KDF is that this solution can stronger resist against offline attacks. You can check it on your own - just create KeePass database and in database's settings set "1 second delay" to calculate how many iterations of KDF should be set to have 1 second computation of one password on your machine. |
Hi, I know this is a long post but all this explanation is probably needed to clarify some misunderstandings. Key entropy depends only on how random your key material is. But lets first clarify why your current PIN need to be long. The entropy of single ASCII digit is log2(10) = 3.322 bits (yes might seems odd that there are fraction of bits). It means that with 4 ASCII digit key material you have ~13bit entropy for the key, which is 9999 combinations or 2^14 - 1 in terms of bit combinations that can be cracked with speed 55 millions tries per second in ~ 0.2ms Ok, that was a bit of nerd joke from my side ;) So: As you see those are rather long PINs even if we assume that there is any sense in the computations I just made, since nobody calculate the amount of entropy needed to secure assets from 6h long attack (silly method) ;) As the solution I propose:
|
Thank you for the detailed explanation @rosly, I have not been keeping up with how fast keys can be cracked on modern hardware, to me it makes sense to use both methods, and you are correct the current hardware limits the ease of inputting a long enough key. I am thinking about a redesign of the way keys are generated and input by the user ( using hardware because I am more comfortable with hardware haha ) and need to do some more research on the easiest way for people to accurately replay a long enough key that will be useful to feed into @ventaquil's proposal :) |
what about a biometric fingerprint sensor, how hard can be to implement? i see that a lot of phone implement already that like Fingerprint-->hash from biometric data-->decrypt |
Hi,
Just by quick search I found this in zamekSecurity.unlock():
23: key[ i ] = pinArray[ i ];
28: aes128_cbc_enc( key, iv, data, 48 )
Means that all the key entropy came from PIN, which can be from 1 to 16 ASCII digits.
Combining that with user tendency to use short PINs this solution is far from secure.
Obviously, for 4 digit PIN we have 9999 key space.
On my PC CPU only I would be able to crack data secured by this method up to 13 digits PIN just in one day.
Probably most of the people will use PINs far shorter than 13 digits.
That's just if we considering entropy. The key should never be pure ASCII string.
You need to use proper encryption scheme.
The text was updated successfully, but these errors were encountered: