How does Active Directory sign you in at work?

The short answer

Active Directory is a company's list of every user, computer and group, and at sign-in it uses Kerberos to prove who you are without your password ever crossing the network.

Animated diagram: How does Active Directory sign you in at work?

Active Directory

Active Directory is the directory a company keeps on special servers called domain controllers. It holds the list of every user, computer and group, and it includes the services that use that list. Microsoft calls the whole package AD DS (Active Directory Domain Services). That means the directory database plus services such as the KDC (Key Distribution Center), LDAP (Lightweight Directory Access Protocol) on port 389, and replication, which copies every change to all domain controllers in the domain.

When you sign in to a work computer, the protocol doing the work is Kerberos, on port 88. It exists so your password never has to cross the network. You type your password once, at sign-in. After that, Kerberos hands out tickets that get you into later resources without asking for it again. That is SSO (single sign-on).

What Active Directory actually checks

Your PC turns your password into a key and uses it to encrypt the current time. This step is called pre-authentication, and the encrypted timestamp travels as PA-ENC-TIMESTAMP. The password itself is not sent. The KDC runs on every domain controller and uses the AD DS database as its account list. So it holds its own copy of your key, and it decrypts the timestamp with that copy.

Then it runs its checks. The time must be within five minutes of its own clock, which is the default in the Default Domain Policy. Your account must be enabled, not locked and not expired. If everything passes, you get a TGT (ticket-granting ticket), your master pass. It is encrypted with the key of a special account named krbtgt, and by default it is valid for ten hours. The klist command shows it with the server name krbtgt/<REALM>.

How Kerberos opens a shared drive

  1. Your PC shows the pass. When you open a shared drive, your PC presents the TGT to the domain controller and asks for a service ticket.
  2. One ticket per service. The ticket is issued for a service principal name, such as cifs/fs01, not for the whole machine.
  3. Your groups ride along. The PAC (Privilege Attribute Certificate), the list of your group memberships, is copied into the service ticket.
  4. The server checks locally. The file server decrypts the ticket with its own key. It usually doesn’t need to contact a domain controller, unless it has to validate the PAC.

The result: you typed your password once, and every later service gets a ticket instead. Active Directory proves who you are, and your groups decide what opens.

Replication is not a backup

Domain controllers copy each other, so it’s easy to think they back each other up. They don’t. Replication copies every change to all domain controllers, bad changes too. In June 2017, NotPetya took out every online domain controller at Maersk, along with their backups. One powered-off domain controller in Accra, Ghana survived, and it saved them. Rebuilding Active Directory took nine days.

What to do

  • Use a long work passphrase that you use nowhere else.
  • Use MFA (multi-factor authentication) on your work account whenever it’s offered.
  • Run klist to see your cached tickets, with the Server and End Time of each one.
  • If you run Active Directory, keep a backup that replication can’t reach, like a powered-off copy.

#ActiveDirectory#Kerberos#DomainController#IdentitySecurity#WindowsServer#NotPetya#CyberSecurity#InfoSec

Watch it in 60 seconds