Active Directory guide

How to reset the krbtgt password safely

In many domains the krbtgt password hasn't changed since the domain was built. This guide explains what the account does, why it has to be reset twice, and how to do it without breaking sign-ins.

What krbtgt does

Every Active Directory domain has a disabled account called krbtgt. It belongs to the Key Distribution Center (KDC), the service on each domain controller that issues Kerberos tickets.

When a user or computer signs in, a domain controller gives it a ticket-granting ticket (TGT). It shows that TGT whenever it needs access to a server, file share or application. Every TGT is encrypted and signed with a key made from krbtgt's password, and domain controllers trust a TGT because only they know that key.

All the writable domain controllers in a domain share one krbtgt account. Each read-only domain controller (RODC) has its own, named krbtgt_ followed by a number, and it's reset separately.

Golden tickets

An attacker who gets the krbtgt key can make their own TGTs. They might take it with DCSync from an account that has replication rights, or copy ntds.dit from a domain controller or a backup. A forged TGT, called a golden ticket, can name any user and any group memberships, with a lifetime of years. Domain controllers accept it because it's encrypted with the right key.

Resetting the passwords of compromised admin accounts doesn't stop this, because the forged ticket never depended on them. The stolen key stops working only when krbtgt's password is changed, and it has to be changed twice.

Why it has to be reset twice

Active Directory keeps krbtgt's current password and the one before it, and domain controllers accept tickets made with either. That's what lets a single reset happen without signing everyone out: tickets issued before the reset still work.

It also means that after one reset, a stolen key is still valid as the previous password. The second reset pushes it out of the history.

Where resets go wrong

Check when krbtgt was last reset

Run this on a machine with the Active Directory PowerShell module:

Get-ADUser krbtgt -Properties PasswordLastSet, msDS-KeyVersionNumber |
  Select-Object Name, PasswordLastSet, msDS-KeyVersionNumber

If PasswordLastSet is close to the date the domain was created, it has never been reset. To include the RODC accounts:

Get-ADUser -Filter 'Name -like "krbtgt*"' -Properties PasswordLastSet |
  Select-Object Name, PasswordLastSet

Your maximum ticket lifetime is in the Default Domain Policy, under Computer Configuration > Policies > Windows Settings > Security Settings > Account Policies > Kerberos Policy > Maximum lifetime for user ticket.

Resetting it by hand

  1. Check that replication is healthy with repadmin /replsummary, and fix any failures first.
  2. Note your maximum user ticket lifetime.
  3. Reset the krbtgt password once. In Active Directory Users and Computers, right-click krbtgt in the Users container and choose Reset Password. The value you type doesn't matter: the domain controller replaces it with a random, strong password.
  4. Confirm that every writable domain controller has the change. Each one should report the same key version:
    Get-ADDomainController -Filter * |
      Where-Object { -not $_.IsReadOnly } |
      ForEach-Object {
        $u = Get-ADUser krbtgt -Server $_.HostName `
          -Properties msDS-KeyVersionNumber
        [pscustomobject]@{
          DC         = $_.HostName
          KeyVersion = $u.'msDS-KeyVersionNumber'
        }
      }
  5. Wait at least the maximum ticket lifetime. Many admins leave 24 hours.
  6. Reset it a second time, then check replication again.

Microsoft has published a script, New-KrbtgtKeys.ps1, that resets krbtgt with replication checks and can run in a simulation mode first. Microsoft has since archived it on GitHub, so it no longer gets updates.

If you believe the key has been stolen, waiting 10 hours or more between resets leaves the attacker that long. During an incident you may decide to do the second reset sooner and accept some failed sign-ins. Plan that with whoever is running the response.

How often to reset it

Good practice is to reset krbtgt at least every six months, and straight away after any suspected compromise of a domain controller or a domain admin account. Resets tend to slip because each one has to be done twice, with the right gap and a replication check in between.

Or let Rotara do it

Rotara resets krbtgt on a schedule you set. It resets the password twice, hours apart, and before the second reset it checks that every writable domain controller has the first. It looks after the krbtgt accounts of your read-only domain controllers too. Each schedule needs a second administrator's approval, and every run is logged as evidence for auditors and insurers.

If you think the key has been stolen, Rotara can run an emergency rotation instead. It skips the usual wait between the two resets but still checks replication before the second, so once a second administrator approves it, both resets are done in under five minutes. As with any fast reset, some users and services may need new tickets afterwards.

How Rotara handles krbtgt · Book a demo