Learn to Implement password hash synchronization

  1. Home
  2. Learn to Implement password hash synchronization

This tutorial will help you to Learn to Implement password hash synchronization. The Active Directory domain service stores passwords in the form of a hash value representation, of the actual user password. A hash value is a result of a one-way mathematical function (the hashing algorithm). There is no method to revert the result of a one-way function to the plain text version of a password.

Detailed description of how password hash synchronization works

The following section describes, in-depth, how password hash synchronization works between Active Directory and Azure AD.

Learn to Implement password hash synchronization
Image Source – Microsoft
  1. Every two minutes, the password hash synchronization agent on the AD Connect server requests stored password hashes (the unicodePwd attribute) from a DC. This request is via the standard MS-DRSR replication protocol used to synchronize data between DCs. The service account must have Replicate Directory Changes and Replicate Directory Changes All AD permissions (granted by default on installation) to obtain the password hashes.
  2. Before sending, the DC encrypts the MD4 password hash by using a key that is a MD5 hash of the RPC session key and a salt. It then sends the result to the password hash synchronization agent over RPC. The DC also passes the salt to the synchronization agent by using the DC replication protocol, so the agent will be able to decrypt the envelope.

Further steps

  1. After the password hash synchronization agent has the encrypted envelope, it uses MD5CryptoServiceProvider and the salt to generate a key to decrypt the received data back to its original MD4 format. Indeed, The password hash synchronization agent never has access to the clear text password. The password hash synchronization agent’s use of MD5 is strictly for replication protocol compatibility with the DC. It is only used on premises between the DC and the password hash synchronization agent.
  2. Furthermore, The password hash synchronization agent expands the 16-byte binary password hash to 64 bytes by first converting the hash to a 32-byte hexadecimal string. Then converting this string back into binary with UTF-16 encoding.
  3. Subsequently, The password hash synchronization agent adds a per user salt, consisting of a 10-byte length salt, to the 64-byte binary to further protect the original hash.
  4. The password hash synchronization agent then combines the MD4 hash plus the per user salt, and inputs it into the PBKDF2 function. 1000 iterations of the HMAC-SHA256 keyed hashing algorithm are used.
  5. The password hash synchronization agent takes the resulting 32-byte hash. Concatenates both the per user salt and the number of SHA256 iterations to it (for use by Azure AD), then transmits the string from Azure AD Connect to Azure AD over TLS.
  6. When a user attempts to sign in to Azure AD and enters their password, the password is run through the same MD4+salt+PBKDF2+HMAC-SHA256 process. If the resulting hash matches the hash stored in Azure AD, the user has entered the correct password and is authenticated.

Security considerations

When synchronizing passwords, the plain-text version of your password is not exposed to the password hash synchronization feature, to Azure AD, or any of the associated services.

User authentication takes place against Azure AD rather than against the organization’s own Active Directory instance. The SHA256 password data stored in Azure AD–a hash of the original MD4 hash. It is more secure than what is stored in Active Directory. Further, because this SHA256 hash cannot be decrypted. And it cannot be brought back to the organization’s Active Directory environment. It is presented as a valid user password in a pass-the-hash attack.

Password policy considerations

There are two types of password policies that are affected by enabling password hash synchronization:

  • Password complexity policy
  • Also, Password expiration policy

Password hash synchronization and FIPS

You should learn about Password hash sync process for Azure AD Domain Services. If your server has been locked down according to Federal Information Processing Standard (FIPS), then MD5 is disabled.

To enable MD5 for password hash synchronization, perform the following steps:

  1. Go to %programfiles%\Azure AD Sync\Bin.
  2. Open miiserver.exe.config.
  3. Go to the configuration/runtime node at the end of the file.
  4. Add the following node: <enforceFIPSPolicy enabled="false"/>
  5. Save your changes.
free practice test for AZ- 303

Go back to home page

Reference documentation – Implement password hash synchronization with Azure AD Connect sync