Appearance
Kerberos and Windows Authentication
144. What is Kerberos, and how does it work at a high level?
The short answer
Kerberos is a network login protocol, created at MIT in the 1980s and the default in Windows domains, that lets you prove who you are to many services without ever sending your password over the network. A trusted server, the Key Distribution Center, which in AD is the domain controller, gives you a ticket-granting ticket when you log in. When you want a service, such as a file share, you show that ticket to the KDC and get a service ticket for that one service. You show the service ticket to the service, which checks it with its own key. Tickets expire, typically after 10 hours.
Why it works without sending the password. Every user and service shares a secret key with the KDC: for users, derived from their password; for services, a random key. The KDC encrypts each answer so that only the intended party can open it. A ticket for the file server is locked with the file server's key, so only the real file server can read it, and only the KDC could have made it.
What depends on it:
| Need | Why |
|---|---|
| Clocks within 5 minutes | Tickets carry timestamps to stop replay |
| DNS working | Clients find the KDC and name services through DNS |
| Service principal names (SPNs) | Each service is registered by name, such as HTTP/intranet.acme.example |
Attacks to know by name. Kerberoasting: any user can request service tickets, and a ticket for a service account with a weak password can be cracked offline, so service accounts need long random passwords or managed accounts. Golden ticket: with the KDC's own key, an attacker can forge tickets for anyone.
145. What is NTLM?
The short answer
NTLM, NT LAN Manager, is Windows' older challenge-response login protocol. The server sends a random challenge, the client answers with a value computed from the challenge and the hash of the user's password, and the server, or the domain controller for it, checks the answer. It works without a KDC, which is why it is still the fallback when Kerberos cannot be used, for example when connecting by IP address. It is weak: the password hash itself works as a password, so attackers can pass the hash or relay NTLM logins to other servers. Microsoft has deprecated it and is removing it step by step.
| Kerberos | NTLM | |
|---|---|---|
| Design | Tickets from a trusted KDC | Challenge and response per connection |
| Mutual authentication | Yes, the client also verifies the server | No |
| Password hash usable as a password | No | Yes, pass the hash |
| Relay attacks | Hard | A long series of real attacks |
| Works by IP address, outside a domain | Not normally | Yes |
| Status | Default | Deprecated; NTLMv1 removed in recent Windows |
What to do as an engineer: make apps and services use Kerberos, register their service principal names, audit NTLM use with Windows' logging, require SMB and LDAP signing so relays fail, and block NTLM where audits show it is unused.
146. How do Kerberos and LDAP differ?
The short answer
They do different jobs. Kerberos is for authentication: proving who you are and getting tickets for services, without sending passwords. LDAP is for directory access: looking up and changing information about users, groups and computers. In Active Directory they work together: Kerberos logs you in, and LDAP is how Windows and apps read your groups and attributes. An LDAP connection can itself be authenticated with Kerberos, through a SASL bind called GSSAPI, which is better than a simple bind with a password.
| Kerberos | LDAP | |
|---|---|---|
| Purpose | Authentication, SSO inside the network | Reading and changing directory data |
| Question it answers | Is this really Asha? | What groups is Asha in? |
| Port | 88 | 389, 636 |
| Carries passwords | Never over the network | A simple bind does; use TLS |
| Output | Tickets | Directory entries |
147. How does Windows authentication work?
The short answer
When you sign in to a domain-joined Windows PC, the local security service, LSASS, sends your credentials, protected with a key from your password or from Windows Hello's device key, to a domain controller using Kerberos, and gets a ticket-granting ticket. Windows builds an access token listing your user ID and all your group IDs. Every file, folder and printer has an access control list, and Windows compares your token against it. When you open a file share or an intranet site, Windows silently gets a Kerberos service ticket for it, so you are never asked for a password again. That is Integrated Windows Authentication.
From sign-in to opening a file share:
- Sign in. You type a password or use Windows Hello. LSASS authenticates you to a domain controller with Kerberos and receives a TGT.
- Access token. Windows builds a token with your security identifier and the identifiers of every group you belong to.
- Open
\\files\finance. Windows asks the domain controller for a service ticket for the file server and presents it. You type nothing. - Authorisation. The file server reads your groups from the ticket and checks them against the folder's access control list.
- Intranet website. A browser on the same PC can do the same with
Negotiateauthentication, sending a Kerberos ticket in anAuthorizationheader to sites in the trusted intranet zone. - Fallback. If Kerberos fails, for example because there is no service principal name, Windows may fall back to NTLM (question 145).
Windows Hello for Business replaces the password at step 1 with a key pair held in the PC's TPM chip and unlocked by face, fingerprint or PIN, much like a passkey, so there is no reusable password to steal.
Cloud sign-in. On a PC joined to Microsoft Entra ID, the same sign-in also gets a Primary Refresh Token from Entra ID, which gives silent SSO to Microsoft 365 and cloud apps, in the same way the TGT gives SSO to on-premises services.