Active Directory: Authentication with Kerberos and NTLM
Almost every attack on Active Directory is, at heart, an attack on authentication: requesting tickets you shouldn’t have, reusing a hash, relaying a challenge or forging what the domain believes you are. None of them make sense until you know how a user proves who they are, what gets stored in their session afterwards, and when Windows uses Kerberos or NTLM. This card explains the mechanism, not the attack.
Concepts
Section titled “Concepts”Authentication and authorization
Section titled “Authentication and authorization”These are two different questions, answered by different parties:
| Question | Who answers it | With what |
|---|---|---|
| Authentication: who are you? | The domain controller (the KDC, in Kerberos) | Your password or its hash, never sent in cleartext |
| Authorization: what can you do? | The machine that holds the resource | Its ACL against the SIDs in your token |
The DC doesn’t decide whether you can open \\fs01\finance: fs01 does. The DC only vouches for who you are and which groups you belong to.
The access token
Section titled “The access token”When you log on, Windows creates a token that travels with every process you run. It contains:
- Your SID and the SIDs of all your groups (nested ones included).
- Your privileges (
SeImpersonatePrivilege,SeBackupPrivilege…). - The integrity level (Medium when not elevated, High when elevated).
Every time you touch a file, a registry key or a service, the system compares that token with the object’s ACL. In a domain, the group list arrives inside the Kerberos ticket, in a structure called the PAC, and the server uses it to build your token on its side.
Kerberos step by step
Section titled “Kerberos step by step”Kerberos is the default protocol in a domain. The key idea: the password never travels; what travels are tickets, encrypted with keys only the parties involved know.
- The KDC (Key Distribution Center) is a service running on every DC, on port 88 (TCP and UDP).
- The krbtgt account is the KDC’s own account: its key encrypts every TGT in the domain.
- An SPN (Service Principal Name) is the name a service is known by when you request a ticket for it, in the form
class/host[:port]. It’s registered on the account that runs that service.
| Example SPN | What it identifies |
|---|---|
HTTP/web01.pwnlab.local |
Website with integrated authentication on web01 |
MSSQLSvc/sql01.pwnlab.local:1433 |
SQL Server instance on sql01 |
CIFS/fs01.pwnlab.local |
File shares (SMB) on fs01; the KDC resolves it through the computer account’s HOST/fs01.pwnlab.local SPN |
HOST/ws05.pwnlab.local |
Generic services on the ws05 machine |
The flow has three exchanges:
- AS-REQ / AS-REP: the client identifies itself to the KDC and receives a TGT (Ticket Granting Ticket), encrypted with the krbtgt key. By default it lasts 10 hours and can be renewed for up to 7 days. With pre-authentication (enabled by default), the client proves it knows the password by encrypting a timestamp with its key.
- TGS-REQ / TGS-REP: using the TGT, the client requests a service ticket for a specific SPN. The KDC encrypts it with the key of the account that owns that SPN.
- AP-REQ: the client presents the service ticket to the server. The server decrypts it with its own key and doesn’t need to contact the DC.
sequenceDiagram
participant C as Client (ana)
participant K as KDC on DC01
participant S as fs01 (CIFS)
C->>K: AS-REQ (timestamp encrypted with ana's key)
K-->>C: AS-REP with TGT (encrypted with the krbtgt key)
C->>K: TGS-REQ: TGT + SPN CIFS/fs01.pwnlab.local
K-->>C: TGS-REP with service ticket (encrypted with fs01's key)
C->>S: AP-REQ: service ticket
S-->>C: Access according to the ACL and the groups in the ticket
Clock skew tolerance
Section titled “Clock skew tolerance”Kerberos puts timestamps in its messages so they can’t be replayed. If the client’s clock and the DC’s clock drift more than 5 minutes apart (the default value of the Maximum tolerance for computer clock synchronization policy), the KDC rejects the request with a skew error (KRB_AP_ERR_SKEW). Domain-joined machines sync with the DC automatically; machines outside the domain, like your Kali, don’t.
NTLM is the older challenge-response protocol. It’s still enabled for compatibility. It uses three messages:
- NEGOTIATE: the client announces what it supports.
- CHALLENGE: the server replies with a random number (the challenge).
- AUTHENTICATE: the client sends back the challenge processed with its password hash.
The server doesn’t know your hash, so it forwards the response to the DC over the Netlogon secure channel (pass-through authentication) and the DC tells it whether it’s correct. Unlike Kerberos, every authentication goes through the DC.
Windows uses NTLM instead of Kerberos when:
- You access a resource by IP instead of by name: by default there’s no SPN for an IP, so no ticket can be requested.
- The machine is in a workgroup or the account is local.
- The application is old or only speaks NTLM.
- Kerberos fails (clock, DNS, misregistered SPN) and the system falls back to NTLM.
\\fs01.pwnlab.local\finance → Kerberos (there's an SPN CIFS/fs01.pwnlab.local)\\192.168.56.20\finance → NTLM (by default there's no SPN for an IP)Microsoft has deprecated NTLM and removed NTLMv1 from its most recent releases, but NTLMv2 is still enabled on most networks, because turning it off breaks applications.
| Kerberos | NTLM | |
|---|---|---|
| What travels | Tickets | A challenge and a response derived from the hash |
| Contacts the DC on every access? | No: only to request tickets | Yes, through pass-through |
| Requires | A name (SPN), DNS and a synced clock | None of that |
| Authenticates the server | Yes (mutual authentication) | No |
| When it’s used | By default in the domain | By IP, workgroups, legacy apps, as a fallback |
In practice
Section titled “In practice”PS> klistCurrent LogonId is 0:0x5a21cCached Tickets: (2)
#0> Client: ana @ PWNLAB.LOCAL Server: krbtgt/PWNLAB.LOCAL @ PWNLAB.LOCAL # the TGT: addressed to the KDC itself KerbTicket Encryption Type: AES-256-CTS-HMAC-SHA1-96 Start Time: 11/5/2026 9:02:11 (local) End Time: 11/5/2026 19:02:11 (local) # 10 hours Renew Time: 11/12/2026 9:02:11 (local) # renewable for 7 days Kdc Called: DC01.pwnlab.local
#1> Client: ana @ PWNLAB.LOCAL Server: cifs/fs01.pwnlab.local @ PWNLAB.LOCAL # service ticket for fs01's SPN KerbTicket Encryption Type: AES-256-CTS-HMAC-SHA1-96 ...If klist is empty on a domain-joined machine, either the session belongs to a local account, or the logon didn’t use Kerberos (for example, cached credentials with no reachable DC, or NTLM), or it’s a network session with no TGT (WinRM or PsExec: the double-hop problem).
# Check your groups before and after being added to onePS> whoami /groups | Select-String "Finance" # nothing: your token predates the change# ... log off and back on ...PS> whoami /groups | Select-String "Finance"PWNLAB\Finance Group S-1-5-21-...-1108 Mandatory group, Enabled by default, Enabled group
# SPNs registered on an account, and a search by classPS> setspn -L svc_sqlRegistered ServicePrincipalNames for CN=svc_sql,OU=Services,DC=pwnlab,DC=local: MSSQLSvc/sql01.pwnlab.local:1433PS> setspn -Q HTTP/* # which accounts have an HTTP SPN
# Is the clock right?PS> w32tm /query /status # time source and last syncPS> w32tm /stripchart /computer:dc01.pwnlab.local /samples:3 # offset against the DC# From Kali, in your lab: check and fix the offset against the DCsudo ntpdate -q dc01.pwnlab.local # -q only queries, doesn't change the timesudo ntpdate dc01.pwnlab.local # sync (or: sudo rdate -n dc01.pwnlab.local)faketime "$(date -d '+7 min')" command # run a command with a different time without touching the system clockNext offensive step
Section titled “Next offensive step”- Request service tickets and crack their key, or target accounts without pre-authentication: Kerberos (Kerberoasting and AS-REP roasting).
- Reuse hashes and relay NTLM authentications: NTLM (pass-the-hash and relay).
- Services that request tickets on your behalf: delegation.
- Capture NTLM challenges on the local network: LLMNR and NBT-NS.
Cheat sheet
Section titled “Cheat sheet”| Concept | What to remember |
|---|---|
| Authentication · authorization | Decided by the DC · decided by the resource’s machine. |
| Token | Your SID, your groups and privileges. Created at logon. |
| New group | Doesn’t count until you log on again. |
| KDC | A service on every DC, port 88. |
| krbtgt | Its key encrypts every TGT. |
| TGT | 10 h by default, renewable for 7 days. |
| SPN | class/host[:port], registered on the service account. |
| Service ticket | Encrypted with the key of the SPN’s account. |
| PAC | The user’s groups, inside the ticket. |
| Clock | More than 5 min of skew and Kerberos fails. |
| NTLM | NEGOTIATE · CHALLENGE · AUTHENTICATE; the DC validates every time. |
| By IP · by name | NTLM · Kerberos. |
klist · klist purge |
Show tickets · delete them. |
setspn -L · -Q |
An account’s SPNs · search for SPNs. |
Review questions
Section titled “Review questions”-
A user tries to open
\\fs01\projectsand is denied. Who made that decision, the DC orfs01?Answer
fs01. The DC only authenticates (it confirms the identity and hands over the groups in the ticket); authorization is decided by the resource’s machine, comparing its ACL with the user’s token. -
You add Ana to the Finance group and she still can’t open the department’s folder. Why, and how do you fix it?
Answer
Because her token and her tickets were created before the change and don’t include the new group. Logging off and back on creates a new token; for network access,
klist purgealso forces new tickets that include the group. -
Describe the three Kerberos exchanges and what the client gets from each one.
Answer
AS-REQ/AS-REP: it identifies itself to the KDC and gets a TGT. TGS-REQ/TGS-REP: it presents the TGT and gets a service ticket for an SPN. AP-REQ: it presents that ticket to the server, which validates it with its own key without contacting the DC.
-
Which key encrypts the TGT, and which one encrypts the service ticket?
Answer
The TGT is encrypted with the krbtgt account’s key. The service ticket is encrypted with the key of the account that has the SPN registered (the service or machine account).
-
From your Kali, every Kerberos tool against the DC returns
KRB_AP_ERR_SKEW. What’s going on?Answer
Your Kali’s clock and the DC’s clock are more than 5 minutes apart. Sync it with the DC (
ntpdate,rdate) or run the tool underfaketime. -
Why does
\\192.168.56.20\shareuse NTLM while\\fs01.pwnlab.local\shareuses Kerberos, if it’s the same folder?Answer
Because Kerberos requests the ticket for an SPN, which is tied to a name (
CIFS/fs01.pwnlab.local). By default there’s no SPN for an IP, so Windows falls back to NTLM. -
Name two important differences between Kerberos and NTLM.
Answer
With NTLM the server contacts the DC on every authentication; with Kerberos it doesn’t, because the ticket arrives already validated. Kerberos also authenticates the server (mutual authentication), while NTLM doesn’t.