20

Suppose someone gets access all of my hard disk, I guess the weak spot would be my windows password. Without knowing/being able to retrieve that, the data should be pretty much safe, shouldn't it?

I'm asking specifically because of the EFS entry in wikipedia which states that

In Windows 2000, the local administrator is the default Data Recovery Agent, capable of decrypting all files encrypted with EFS by any local user.

and EFS happens to use DPAPI. So does the same apply to my own data protected using this:

ProtectedData.Protect(plain, null, DataProtectionScope.CurrentUser);

And if that is indeed the case, how could I prevent it?

[Edit] N.B. I'm trying to store credentials for a winforms app so that the user does not have to enter their password every time they login. In other words, if someone is able to login as that user (i.e. know the user password), then they might as well be able read the encrypted data.

Which - not coming from a windows background - now makes me wonder - can't the local admin login as any local user anyway? In that case I shouldn't be concerned about the admin being able to retrieve passwords anyway...

[Edit2] As google reveals, it looks like an Administrator cannot just login as any user without resetting/changing their password first. So my question still seems relevant...

6
  • 1
    Windows passwords are notoriously easy to break given that you have physical access. (This may have changed in recent versions, though not to my knowledge. I'd love to be proven wrong.) Commented Jan 21, 2011 at 6:35
  • 1
    @Matthew: any link to support that? Commented Jan 21, 2011 at 6:36
  • look up l0ftcrack. I refuse to link to it directly. As of XP at least (and again, my info may be out of date) almost any Windows password can be cracked in a matter of minutes given access to the password files (ie. physical access). As far as I'm aware, this is all irrelevant for network users. This is due to a weakness in the way passwords are processed/hashed. Commented Jan 22, 2011 at 13:54
  • 1
    @MatthewScharley so you dont have a link to support what you are claiming... therefore not true Commented Mar 28, 2018 at 15:56
  • 1
    @i_shoot_photos clearly you didn't read all the comments. Other people linked to the tools I mentioned. Commented Mar 29, 2018 at 0:08

3 Answers 3

20

EFS uses DPAPI, not the other way around. And Administrator can't read your key just like that.

Before forgetting about DPAPI, I would consider the alternatives. If you encrypt the file yourself,

  1. You must select a strong algorithm and implement it well.
  2. You will need a key. Where will it be ?
  3. You will store the key in a file somewhere on your drive.
  4. That key is sensitive, obviously, you will want to encrypt it
  5. Goto 1

DPAPI does 1 to 3 well. 4 and 5 are moot. If a Windows password is not enough to protect data, ask yourself why it is enough to CRUD that data in the first place.

For better security, you can consider not saving the data but a (salted) hash of it, if possible. It makes your data write only, though. For example, if you want to verify a customer license number :

  • Save a salted hash value of it
  • Run the same hash on the salted license number you want to verify,
  • Compare the two. It they match, the license is valid.

If you must read back encrypted data and a locally encrypted key is not enough, consider encrypting your application key (step 2 above) with a private key stored on a smart card.

Either way, remember that things happens. You always need a backup key somewhere.

6

See this article on DPAPI Security. Basically, it is as secure as your Windows password -- if your password is reset by an administrator, the decryption key will be lost. The major attack vectors you'll need to look at are:

  • Password disclosure: "shoulder surfing", sticky notes, etc.
  • Capture of the computer's accounts database and the use of a password cracker
  • Online attack by "drive-by download", removable media AutoPlay, etc.
  • Capture of a password reset disk, if you've made one
  • Physical installation of a key-logging device or other "bug"
3
  • Unfortunately, that article does not address the Administrator issue I'm specifically interested in. Commented Jan 21, 2011 at 7:12
  • 2
    "if your password is reset by an administrator, the decryption key will be lost." - Not according to this article. It says "DPAPI hooks into the password-changing module and when a user's password is changed, all MasterKeys are re-encrypted under the new password."
    – Jez
    Commented Mar 25, 2015 at 0:47
  • 2
    @Jez, in a password-change (as distinct from a password-reset) the old password is provided so the old keys can be decrypted; a password reset disk can provide a backup of the old key for self-resets. For domain accounts, a backup key may also be stored at the domain controller, but for local accounts the password reset disk is the only backup made. Commented Mar 26, 2015 at 4:17
2

DPAPI can be used both with and without optional entropy. There are only two ways DPAPI blobs without optional entropy can be compromised:

  1. A domain admin can directly retrieve anyone's history of DPAPI master keys at any time. Nothing else is required. These can be used to decrypt all blobs. Local administrators cannot do this.

  2. The user's Windows credentials are compromised.

If you use optional entropy then the data cannot be decrypted by anyone who doesnt know the value. The entropy may be derived from a password required to launch the application etc. Without the value, the data is lost forever.

EFS works differently. The user's key is protected using DPAPI for his profile, but the decryption key for the file itself is additionally directly encrypted with the administrator's public key as well. Therefore a domain admin can access the files.

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