3

I'm designing a system so that it encrypts a user's profiles. The only way of accessing the information stored in it is by either:

  1. Providing the password for the account
  2. Resetting the password using offline backup codes
  3. Resetting the password by sending an SMS code

We will assume that the device receiving the SMS code, nor the transportation method of the SMS, is not compromised.

In order for the three methods to grant access to the user's profile, a key will be generate to encrypt and decrypt the profile. We will then store encrypted versions of the key so that each of the following methods listed above can access the information in the profile.

For method 1 & 2, ensuring that the key remains confidential is easy. For method 1 simply encrypt the key using the user's password. For method 2 generate the backup codes, encrypt the key with them, and then give them to the user. For method 3 however, I'm not sure how this should be done.

Question 1: How can I provide a feature that allows a user to recover their account by sending a SMS code to their device, such that the organisation that stores the data cannot access the information in the user's profile?

Question 2: A company allows users to reset their passwords using SMS. Does this imply that the company can access information stored in their user's account?

An organisation is able to modify the system so that they can retrieve whatever data was encrypted - just make sure that the next time the user logins in you store a copy of their password. However, in the event that an adversary obtains a copy of the accounts, my question still remains valid.

  • 1
    The answer to question 2 is yes, regardless, unless the decryption occurs on the client. But given your last comment you are aware of that. So if seems your real concern is not the company but an adversary getting access to the raw database. Correct? – Rolf Rander Feb 10 '18 at 7:41
  • Yes, you're correct. – Mrwerdo Feb 10 '18 at 8:05
  • I thought of the second question before the first. Is there any way of achieving the first question regardless of the answer to the second question being yes? – Mrwerdo Feb 10 '18 at 8:19
  • I found this reference in another post which might be relevant to you: troyhunt.com/everything-you-ever-wanted-to-know – Rolf Rander Feb 11 '18 at 7:04
2

I don't think this is possible, with 1 and 2 you are effectively giving the user full control of the encryption keys and making sure the server does not know them. However, with 3 you need to generate new keys.

However, for securing against an attacker getting a copy of your database, a HSM will help. An HSM is a hardware storage of private keys, meaning it is impossible to copy the private key.

For your SMS-application, you would encrypt the profile key with the public part of the HSM keypair. When you need to generate an SMS-key, you can have the HSM decrypt the profile key and either re-encrypt it with the SMS-password (as you do with the regular password), or just use this as a part of the password-reset process (decrypting and re-encrypting when the user sets the new password).

There might be advanced cryptographical tools I don't know, maybe zero knowledge proofs could be used, however, this sounds like PhD-research-level stuff.

  • Thanks for your answer. I didn't think about using a HSM, that's a good idea. Cheers – Mrwerdo Feb 11 '18 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.