Active Directory Password Encryption

Searching for Active Directory and password encryption I found a very interesting statement regarding encryption settings at rest:

With Windows Server 2016 TP4 the RC4 encryption has been replaced with AES encryption (AES256 in CBC with IV and zero padding).

Within the Active Directory database NTDS.DIT we have encrypted fields protected against offline data extraction:

  • Password Encryption Key (ntds.dit field ATTk590689, attribute pekList)
  • LM Hash (field ATTk589879, attribute dBCSPwd)
  • LM Hash History (field ATTk589984)
  • NT Hash (field ATTk589914, attribute unicodePwd)
  • NT Hash History (field ATTk589918)
  • Supplemental Credentials (field ATTr589949, attribute supplementalCredentials)

While the LM hash has been disabled with Windows Server 2008, the NT hash is still a MD4 hash of the password (and the key for Kerberos RC4_HMAC_MD5). AES keys and other password hash formats are stored as “KeyPackages” in the supplementalCredentials attribute. Michael Grafnetter analyzed the supplementalCredentials with his great DSInternals tool and posted some examples on TechNet:

  • DES_CBC_MD5 – Salted with user logon name and hashed 4096 times using MD5. Used for Kerberos authentication.
  • AES256_CTS_HMAC_SHA1_96, AES128_CTS_HMAC_SHA1_96 – Used for Kerberos authentication since Windows Server 2008. Salted with user logon name and hashed 4096 times using HMAC-SHA1.
  • 29 MD5 hashes, each using a different combination of login and domain name. Used for WDigest authentication
  • Reversibly encrypted cleartext password – Disabled by default. Required by MS-CHAPv1 RADIUS authentication.

According to Csaba Barta there are 3 layers of encryption:

  • Password Encryption Key (PEK) encryption with RC4
  • Hash encryption with DES
  • Hash encryption with RC4

The PEK or Password Encryption Key is used to encrypt data stored in NTDS.DIT. This key is the same across the whole domain, which means that it is the same on all the domain controllers. The PEK itself is also stored in the NTDS.DIT in an encrypted form. The PEK is encrypted with the BOOTKEY which is different on all domain controllers (and in fact on all computers in the domain).

Csaba Barta’s code example shows that the PEK is encrypted using RC4 with the MD5 hash of the bootkey as key. But a post by GuyTe on says that in case of Windows Server 2016 the pekList is encrypted using AES.

GuyTe describes the new encryption process of hashes as followed:

  1. Each hash is encrypted using DES, while the RID of the security principal is used as salt for the encryption function (SystemFunction026 in AdvApi32.dll). The result is a partially encrypted hash. In the case of password history attributes, the partially encrypted hashes are concatenated into a single blob.
  2. The resultant blob is encrypted:
    • Pre-W2K16. In this case RC4 is used
      • Generate random salt of 16 bytes
      • RC4key = MD5(Pek, random salt)
      • EncryptUsingRC4(partially encrypted blob, rc4key) (SystemFunction033 in AdvApi32.dll)
    • W2K16 uses AES
      • Generate random salt of 16 bytes
      • EncryptWithAES, while the salt is used as IV (initialization vector) and PEK as the encryption key

SystemFunction026 = RtlEncryptDES2blocks1DWORD
SystemFunction033 = RtlEncryptDecryptRC4

Another blog post from the Industrial Security Research Group by tijl also states that Microsoft decided to remove RC4 encryption in favor of AES encryption (AES-128-CBC with an IV) for NTLM hashes with Windows 10 Anniversary Update (10.0.14393 or v1607).

I haven’t found any official document for this new way of encryption. If it’s true, a password change will not only remove RC4 but also MD5 for data at rest. When it comes to Kerberos you still have to disable RC4 for your domain but this is another story.


Microsoft Open Specifications (2019): [MS-SAMR]: supplementalCredentials (

Michael Grafnetter (20.10.2015): Dumping the contents of ntds.dit files using PowerShell (

Michael Grafnetter (25.10.2015): Forum FAQ: How is user password of user objects stored in Active Directory? Can I view it? Can I modify it? (

Microsoft Open Specifications (2019): Active Directory Schema Attributes (

Csaba Barta (07.2011): Active Directory Offline Hash Dump and Forensic Analysis (

GuyTe (23.10.2017):

Christoffer Andersson (2014):

gentilkiwi (05.09.2013): Croyptographie rapide sous Windows (

gdedrouas (2014): GitHub AD-permissions / esent_dump (

Industrial Security Research Group (2018): Retrieving NTLM Hashes and what changed in Windows 10 (

Sean Metcalf (03.01.2016): How Attackers Dump Active Directory Database Credentials (