Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

Imagine you have a private RSA-key on your computer encrypted (through PBKDF2, AES-CTR, HMAC256) with a password, now if the user would like to tick "Remember Password", what is the most secure way to save/remembmer the password? Obviously it's not storing it in plaintext in the local directory.

One option would be to use:

  • the HardwareID of the computer
  • the SID of the current user
  • the windows built-in EncryptFile (needs to be logged in as the same account)

Problem is that all of those informations can be compromised when you use the Utilman.exe Trick for example.

An alternative would be obfuscation, but we know that isn't really a solution for the long term.

Is there a proper solution for this or is this just bad practice?

share|improve this question

migrated from crypto.stackexchange.com Jul 11 at 0:47

This question came from our site for software developers, mathematicians and others interested in cryptography.

5  
What threat are we protecting against? –  Andrew Hoffman Jun 30 at 16:34
    
Cache the result of the PBKDF2 instead? –  owlstead Jun 30 at 16:47
    
What threat are we protecting against? - Against an attacker on the PC who does not know the password but is using the local PC aswell. Cache the result of the PBKDF2 instead? In raw bytes? Is that good practice? –  hl3mukkel Jun 30 at 17:59
    
@hl3mukkel, there's generally no way to keep passwords secure if you assume the attacker has root powers or can see your process memory. If you assume the attacker can only see what you store on disk, you can go the password manager route and encrypt the passwords with a master password that is required e.g. every reboot. –  otus Jun 30 at 18:24
    
@otus okay, any idea how chrome or firefox manages this then? They never ask for a master password or something like that, are they really that naive to store the passwords in plaintext? –  hl3mukkel Jun 30 at 19:31
show 1 more comment

1 Answer 1

up vote 1 down vote accepted

Ultimately, if the machine can use the saved password without specific human intervention, then... it can use it. This means that an attacker who gains full control of the machine (either an hostile software hijack with Administrator/root privileges, or he grabs the laptop and runs for it) will be able to recover the password. On a theoretical basis, if you want to resist such an attacker, then you need the password to never make it to the machine RAM itself; you need some tamper-resistant component which does all the processing. This is the model of smart cards and payment terminals, which have physical shielding and actively destroy sensitive data in case of physical breach; and they have no notion of "root user" accessible to the actual human user either.

At best you can hope to slow the attacker down. Yet, there still are management methods which are better than others. For instance, when you store some sensitive secret value, you want to avoid letting leak to the backups, or at least with some specific protection. Similarly, the user may want to integrate such storage within a bigger secret management solution, e.g. a "password safe" with a master password, or things like that. Your best bet, then, it to rely on OS-provided services for storage of sensitive data. On Windows systems, this points to DPAPI. On Mac OS X, use Keychain. As usual, the software which is easiest to design and implement and deploy is software which has already been designed, implemented and deployed by somebody else. Thus, don't try to do more or less smart things on your side; just let the OS do its work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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