1. Resources
  2. Identity Threats
  3. Active Directory

DPAPI Domain Backup Key Theft

Also known as: DPAPI backup key, Domain backup key extraction, lsadump::backupkeys, BCKUPKEY, DPAPI domain recovery key

An attacker with Domain Admin rights can export the domain's DPAPI backup key and use it, for good, to decrypt the DPAPI-protected secrets of every domain user.

Platform
Active Directory
Impact
Critical
Last updated
Attack difficulty
Medium
Detection difficulty
High
Privileges required: Tier 0 or tenant admin
Domain Admin or equivalent on a domain controller, or read access to a domain controller backup or disk image. Access to the keys is restricted to domain administrators by default.
What the attacker gains
A private key that never changes and decrypts any domain user's DPAPI master keys: saved credentials, browser passwords, private keys.
Threat groups
APT33APT38APT39APT41EvilnumFIN6HEXANELeafminerMalteiroMuddyWaterOilRigStealth FalconVolt TyphoonKimsukyand 5 more in MITRE ATT&CKGroups that MITRE ATT&CK records using T1555, T1552.004.

How it works

The Data Protection API (DPAPI) is what Windows and applications use to encrypt secrets for a user: Credential Manager entries, saved Remote Desktop and network passwords, the keys that browsers use to protect saved logins and cookies, private keys of user certificates. The data is encrypted with keys derived from a per-user master key, and the master key is encrypted with a key derived from the user's password.

That design has a recovery problem: after an administrative password reset, the old password is gone and the master key could no longer be opened. For domain accounts, DPAPI solves it with a second copy. When a master key is created, the client fetches the domain's DPAPI public key from a domain controller and stores the master key encrypted with it, next to the password-protected copy. When the password-based copy cannot be opened, the client sends the backup copy to a domain controller, which decrypts it with the private key and returns it over an authenticated, encrypted RPC call (the BackupKey Remote Protocol, MS-BKRP).

The private half of that key pair is the DPAPI domain backup key. Microsoft documents how it is kept:

  • It is stored in the directory as objects of class secret in the CN=System container of the domain partition: BCKUPKEY_P Secret, BCKUPKEY_PREFERRED Secret and two BCKUPKEY_<guid> objects.
  • It is generated once, when the domain is created, and there is no supported way to change or rotate it.
  • By default only domain administrators can access it.
  • Anyone who holds it can decrypt DPAPI-protected data of any domain user, even after the user's password has changed.

So the attack is an export. An attacker who already has Domain Admin rights asks a domain controller for the key through the LSA private data interface, or reads it out of a copy of the directory database, and keeps it. From then on the attacker needs no password and no domain controller to decrypt any domain user's master key, and the key stays valid for the life of the domain.

Two limits apply. The key covers master keys of domain users that were backed up with it; data protected with the machine's own DPAPI keys and local accounts' master keys is a separate matter. And the key is not the data: to read a secret the attacker still needs the user's master key file and the protected blob.

ATT&CK mapping

ATT&CK has no technique for taking the backup key itself. This page maps the use of the key to Credentials from Password Stores (T1555), which applies when a password store, such as Credential Manager or a browser, is actually decrypted, and the export of the key to Private Keys (T1552.004). Loss of the key alone does not identify which store was read.

Prerequisites

  • Domain Admin or equivalent rights and network access to a domain controller, or
  • a copy of a writable domain controller's directory database with its SYSTEM hive: a system state backup, a virtual disk, a snapshot. The backup keys are directory objects, so every such copy contains them.
  • For decryption: the target user's master key files (%APPDATA%\Microsoft\Protect\<user SID>\) and the protected data, taken from the user's computer, a roaming profile or a backup. Administrator access to the workstation, or read access to the profile share, is enough.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

1. Export the backup key

SharpDPAPI retrieves the key from a domain controller with the LsaRetrievePrivateData API. Without /server it locates a domain controller itself; /file writes the key to a .pvk file instead of printing it as Base64:

SharpDPAPI.exe backupkey /server:DC01.corp.example.com /file:key.pvk

:: Print the key as one Base64 line instead
SharpDPAPI.exe backupkey /nowrap

From Linux, Impacket's dpapi.py does the same over the network with Domain Admin credentials:

dpapi.py backupkeys -t corp.example.com/da-alice@DC01.corp.example.com --export

Mimikatz implements the same retrieval in its lsadump::backupkeys command, which is where the approach originated. With a copy of ntds.dit instead of live access, the same key objects are read from the database offline.

2. Collect master keys and protected data

From a target user's profile the attacker needs the master key files and whatever is to be decrypted:

Item Location in the user's profile
Master keys AppData\Roaming\Microsoft\Protect\<SID>\<GUID>
Credential Manager files AppData\Local\Microsoft\Credentials\ and AppData\Roaming\Microsoft\Credentials\
Vaults AppData\Local\Microsoft\Vault\

3. Decrypt

SharpDPAPI's triage command, run with the key, decrypts every user's master keys and then the credentials, vaults and certificates they protect. /server points it at another computer's profiles over the network:

:: All user profiles on the local machine
SharpDPAPI.exe triage /pvk:key.pvk

:: The same against a remote workstation
SharpDPAPI.exe triage /pvk:key.pvk /server:WS01.corp.example.com

:: Only decrypt master keys, or only Credential Manager files
SharpDPAPI.exe masterkeys /pvk:key.pvk
SharpDPAPI.exe credentials /pvk:key.pvk

Offline, with files copied from a profile, dpapi.py works in two steps: decrypt the master key with the backup key, then decrypt the credential file with the master key:

dpapi.py masterkey -file <master key file> -pvk key.pvk
dpapi.py credential -file <credential file> -key 0x<decrypted master key>

Impact

The domain backup key is one of the few secrets in Active Directory that cannot be reset. With it, the attacker can decrypt, now and in the future, the DPAPI-protected data of any domain user whose profile files they can reach: saved passwords for servers, websites and cloud consoles, session cookies and tokens held by browsers, and private keys of user certificates. Those are often credentials for systems outside Active Directory, so the damage reaches past the domain.

It is also a persistence mechanism. After the incident is cleaned up, the krbtgt account reset twice and every password changed, the stolen key still opens every master key, including the ones created after the cleanup. This is why Microsoft treats a confirmed compromise as a reason to build a new domain, and notes that an attacker who got this far had domain administrator access and may have left other backdoors.

Because the key is useless without profile files, the practical exposure depends on what else the attacker can read: workstations, roaming profile and folder redirection shares, and endpoint backups.

OPSEC and artifacts

  • One quiet request. The export is a single LSA policy call to a domain controller over the lsarpc named pipe, made once. It needs no code execution on the domain controller and creates no object. What remains is a network logon by a privileged account (event 4624 with special privileges) and, with Audit Detailed File Share enabled, an event 5145 for IPC$ with lsarpc in RelativeTargetName. Both are common on domain controllers, so the source host and the account are what make it stand out.
  • No dedicated event. Microsoft documents no audit event for the retrieval of the backup key through this interface. Directory access auditing (event 4662) on the BCKUPKEY secret objects in CN=System records reads that go through the directory, when an audit entry is placed on those objects.
  • Offline extraction. Reading the key from a backup or a disk image of a domain controller leaves nothing in the domain. The evidence is in the backup system, the hypervisor and the storage layer: who restored, mounted or copied the image.
  • Decryption leaves no domain trace. Normal DPAPI recovery asks a domain controller to unwrap a master key and can be audited there and on the client. With the private key in hand the attacker unwraps master keys locally and never makes that request.
  • Collecting profile data is the visible part. Reading Protect, Credentials and Vault folders from many profiles or many workstations is file access by an administrator account: share access events on the workstations, and EDR telemetry for a process that reads other users' DPAPI folders.
  • The .pvk file. A key written to disk on a compromised host is an artifact that forensics can find. Operators print it as Base64 to avoid the file.

Detection

The retrieval is hard to see with standard logging, so detection concentrates on what surrounds it:

  • Privileged logons to domain controllers from unexpected hosts. The export requires domain administrator rights. A Domain Admin network logon from a workstation that is not an administration host is the earliest signal.
  • Audit entries on the key objects. Place a SACL for read access on the BCKUPKEY_* objects under CN=System and alert on any event 4662 that names them. Legitimate reads of these objects by anything other than the domain controllers themselves are not expected.
  • Other signs of domain compromise. The key is taken after domain dominance, usually together with a replication of all secrets. The DCSync detection rules and the NTDS.dit extraction rules cover the activity that tends to come with it.
  • DPAPI activity events. With Audit DPAPI Activity enabled, event 4692 records master key backups and event 4693 records master key recovery through a domain controller. They describe normal operation and are context for an investigation; offline use of a stolen key writes neither.
  • Access to other users' DPAPI folders on endpoints, from EDR file telemetry.
// Reads of the DPAPI backup key objects (requires a SACL on the objects)
WindowsEvent
| where Channel == "Security" and EventID == 4662
| extend Object = tostring(EventData.ObjectName),
         Account = tostring(EventData.SubjectUserName)
| where Object has "BCKUPKEY"
| project TimeGenerated, Computer, Account, Object,
          Access = tostring(EventData.AccessMask)

Event 4662 often shows the object as a GUID in the form %{...}. If it does in your data, match on the GUIDs of the four secret objects instead of the name. The audit policy guide covers Audit Directory Service Access.

Mitigation

There is no setting that turns this off. The key has to exist, and domain administrators can read it. Mitigation is about who can reach it:

  • Protect Tier 0. Keep the number of Domain Admin accounts small, use them only from dedicated administration hosts, and never on workstations or member servers. The Active Directory hardening guide lays out the order of work.
  • Protect domain controller backups and images as Tier 0. Microsoft says to guard Active Directory backups as carefully as the domain controllers. Backup operators, hypervisor administrators and storage administrators who can copy a domain controller's disk can obtain the key.
  • Limit what DPAPI holds. Keep privileged passwords out of browsers and Credential Manager, above all on shared or lower-tier machines.
  • Restrict profile data. Limit administrative access to workstations and to roaming profile and redirected folder shares, so that a stolen key has less to decrypt.
  • Audit the key objects as described above, so that a directory read does not go unnoticed.

After a confirmed compromise:

  • Escalate to the owners of domain recovery. An account password change cannot recall a copied key.
  • Follow Microsoft's guidance: create a new domain and migrate users to it. Third parties can write a new preferred backup key with the MS-BKRP protocol, but Microsoft does not support that.
  • Replace the downstream secrets. Every password, token and certificate that domain users had saved under DPAPI, on any machine whose profile data the attacker could have reached, should be changed or reissued.

Detection rules for this attack

Log events to collect

FAQ

What is the DPAPI domain backup key?

A public and private key pair that the domain controllers hold for DPAPI. Every domain user's DPAPI master key is also stored encrypted with the public half, so that data can be recovered after a password reset. Whoever has the private half can decrypt the master keys of any domain user without knowing a password.

Can the DPAPI backup key be rotated after a compromise?

Not in a supported way. Microsoft states that the key is generated once, when the domain is created, and that there is no officially supported method to change or rotate it. For a confirmed compromise, Microsoft's recommendation is to create a new domain and migrate the users to it.

Does resetting user passwords help?

No. The backup key exists precisely so that data stays recoverable after a password change. Data that was protected before and after the reset can still be decrypted with the stolen key. What can be changed are the secrets that DPAPI was protecting: saved passwords, tokens and certificates.

Is the backup key alone enough to read a user's secrets?

No. The attacker also needs the user's master key files and the protected data itself, such as Credential Manager entries or a browser's key file, from the user's profile on a workstation, a roaming profile share or a backup. The key removes the need for the user's password, not the need for the files.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.