Encrypted File Recovery
As we saw in the last topic, a long sequence of events fire off when a user opens an encrypted file. EFS must access the user's private key, which requires help from DPAPI to use the Session key derived from the Master key, which is itself protected by a key containing the user's password hash.
If the user leaves the company or goes on vacation or dies or just plain gets stubborn and refuses to open a file, you can reset the user's password in Active Directory and then log on as the user. The DPAPI will build a new Master key with the new password hash and use a Session key derived from this Master key to re-encrypt the private keys.
If commandeering a user's account is not an option, you can open the user's encrypted files using the credentials of the Data Recovery Agent, or DRA. This section discusses how the DRA public key is distributed around a domain, how to domain member clients use those certificates, and how a DRA account is used to read an encrypted file if the originating user is not available.
Encrypted File Recovery Group Policies
A file encrypted on a domain member computer contains a copy of the File Encryption Key (FEK) encrypted with the FR public key issued to a DRA. The default DRA is the domain Administrator account. You can and should install others.
EFS clients get a copy of the DRA's FR public key via an X.509 certificate stored in a group policy called Encrypting File System. The policy is located under Computer Configuration | Windows Settings | Security Settings | Public Key Policies (see Figure 17.8).
Figure 17.8. Default Domain GPO showing Administrator certificate under Public Key | Encrypting File System Policies.
When a domain member computer starts up, it downloads the DRA certificate as part of the group policies it gets from its logon server. The client caches the certificate in the local Registry. Thanks to this local cache, laptop users continue to use the DRA certificate when encrypting files, even when they are not on the network. This ensures that you can recover their files should there be a problem with their account.
Standalone Windows Server 2003 and XP clients either use a local account as a DRA or use no DRA at all. For this reason, it is very important that each and every desktop and laptop join an Active Directory-based domain, either a Windows Server 2003 domain or a Windows 2000 domain. If you try to manage file encryption on a hodgepodge of standalone servers and desktops, your job is much more difficult.
Because the EFS group policy that contains the DRA FR certificate is located in the Computer Configuration section of the group policy object, clients continue to use the certificate when encrypting files even if the user logs on to the local SAM instead of the domain. This is because the computer itself still belongs to the domain and will log on using cached credentials that include any cached group policies.
If a laptop is stolen, the bad guy can hack away at the accounts in the SAM without compromising the encrypted files. Only the DRA's public key is cached, not the private key, and exposing the public key does not represent a security vulnerability. Remember that the user has no local account that can be hacked, and the user's domain password hash is cached in LSA secrets where it cannot be modified.
The user's cached credentials are encrypted and stored in the Security hive of the Registry. As of this writing, the local credentials cache of any NT-based Windows platform has not been successfully hacked. This is not true of other Registry keys such as LSA Secrets, which have been the object of many successful hacks over the last few years.
Disabling EFS Group Policy Settings
A new feature in Windows Server 2003 permits you to turn off EFS in a domain or an OU with a single mouse click. Figure 17.9 shows the Properties window of the Encrypting File System policy that controls encryption in a domain.
Figure 17.9. Properties window for Encrypting File System Policies showing the new Disable feature for domain file encryption.
By unchecking the Allow Users To Encrypt Files Using Encrypting File System option, you distribute a Registry update that turns off EFS. The Registry setting is as follows:
Key: HKLM | Software | Policies | Windows NT | CurrentVersion | EFS
Data: 1 to disable, 0 or removed to enable (REG_DWORD)
Windows Server 2003 and XP clients look for this entry in their group policies. If it is not there, the clients will encrypt files even if a File Recovery certificate is not present in group policies.
This is exactly the opposite behavior that Windows 2000 clients exhibit and it will catch you by surprise if you aren't watching for it. Microsoft engineers should have made the clients look for a "1" in the EFSConfiguration setting to enable EFS, not disable it, but that's water under the proverbial bridge. The result, though, is that any XP desktops you deploy in a Windows 2000 domain will be perfectly content to let users encrypt files even though you have removed all certificates from the file recovery group policy.
The best course of action to take in this circumstance is to create a custom group policy in your Windows 2000 domain that distributes the EFSConfiguration Registry entry to your Windows Server 2003 and XP clients. Windows 2000 clients will ignore this Registry entry.
Opening Files as DRA
The term encrypted file recovery is a little misleading. You don't really "recover" an encrypted file. If you log on as the domain Administrator (or some other account that has been configured as a DRA) and your private key is available in your user profile on that machine, you'll be able to open any encrypted files on the machine. The act of opening the files is called recovery.
The secret to understanding the recovery process is to keep your eyes on the DRA's File Recovery private key. By default, this key resides in the Administrator profile on the first domain controller in the domain. If you log on at a client desktop as the domain Administrator, you cannot open encrypted files because there is no local copy of the Administrator's private key.
You can enable a roaming profile for the Administrator account, but this leaves copies of the private key everywhere. You might as well make 100 copies of your house key and give them to strangers. You have a couple of alternatives if you want to open a user's encrypted files without changing the user's password and essentially taking over the user's account:
You can transport the DRA's private key to the user's desktop, either via a roaming profile or by exporting and then importing the key into the certificate store on the desktop. When you're done, you can delete the key and then wipe the unallocated space clean.
A better solution is to transport the encrypted files to the machine where the DRA's private key resides. You cannot copy the files across the network, but you can roll them up into a backup file using Ntbackup and transport the backup file to the DRA's machine.
You must protect each DRA's private FR key to assure the reliability of your file encryption infrastructure. You should not leave copies of the FR private key on any machines in a normal production environment. Instead, you should export the key to transportable media that can be kept in a secure location and then import it only when required to perform a file recovery.