Active Directory / ARTICLE

AD Authentication

بسم الله والصلاة والسلام على رسول الله
اللهم علمنا ما ينفعنا وانفعنا بما علمتنا وقنا عذاب النار

NTLM vs Kerberos

  • Kerberos is the default authentication protocol in any Active Directory environment it’s faster, more secure, and doesn’t expose credentials the same way NTLM does.
  • NTLM kicks in as a fallback when Kerberos isn’t possible: when you authenticate using an IP address instead of a hostname, when the target machine is not part of the domain, or when Kerberos fails for any reason.

Kerberos

Kerberos Authentication TGT

The KDC (Key Distribution Center) is the component responsible for issuing Kerberos tickets for authentication.

The KDC is stateless, meaning it does not maintain session state for clients; it simply processes requests and issues Kerberos tickets when needed.

Step 1

When Ehab logs in, his machine never sends the password over the network. Instead, Kerberos hashes the password using RC4, AES128, or AES256 and uses that hash as a key to encrypt a timestamp, which is what gets sent to the KDC.using one of three encryption types:

Algorithm              Notes
RC4                    Uses the NT hash directly legacy, still common
AES128                 Stronger, modern environments
AES256                 Strongest, preferred in hardened environments

A timestamp is also included this is Kerberos’s replay attack protection. If the same request is seen twice, the KDC rejects it.

Step 2

Ehab’s machine sends an AS-REQ (Authentication Service Request) to the KDC (Key Distribution Center) which lives on the Domain Controller.

The request contains:

  • Ehab’s username
  • The encrypted timestamp encrypted using the hash of Ehab’s password as a key
  • The requested encryption type

The KDC receives this, looks up Ehab’s hash in NTDS.dit, derives the same key, and tries to decrypt the timestamp. If it matches Ehab is authenticated.

Step 1 + Step 2 ⇒ called “Pre-authentication”

Pre-authentication is a Kerberos security step where the user must prove they know the password (or key) before the KDC issues a ticket, helping prevent password-guessing attacks.

Step 3

AS-REP ⇒ The Response : The KDC sends back an AS-REP containing two things:

1. Session Key ⇒ Encrypted with Ehab’s password hash (e.g. NTLM/AES).only Ehab can decrypt this. It’ll be used later to request service tickets.

2. TGT (Ticket Granting Ticket) ⇒ Encrypted with the krbtgt hash Ehab cannot decrypt this. He just holds it and presents it later.

Inside the TGT:

  • Ehab’s identity
  • PAC (Privilege Attribute Certificate) contains his SID, group memberships, and other authorization data
  • session key also
  • Expiry time (default 10 hours)

attacks

Artifact                           Attack
RC4 encrypted AS-RE                AS-REP Roasting if pre-auth is disabled, attacker gets
                                   encrypted blob to crack offline

krbtgt hash                        Golden Ticket forge any TGT in the domain                                   

TGT in memory (LSASS)              Pass the Ticket — steal and reuse the TGT   

PACPAC forgery                     manipulate group memberships                                                             

Kerberos Authentication TGS

step 1

After Step 1, Ehab’s machine is holding two things in memory (inside LSASS):

  • The Session Key decrypted and ready to use
  • The TGT still encrypted with the krbtgt hash, Ehab can’t read it

step 2

TGS-REQ The Request ⇒ Ehab now wants to access a specific service (a file share, a web app, anything on the domain). His machine sends a TGS-REQ (Ticket Granting Service Request) to the KDC containing:

  • The TGT presented as proof of identity
  • Username & timestamp encrypted with the Session Key
  • The name of the service he wants to access (SPN)

The KDC receives this, decrypts the TGT using the krbtgt hash, verifies the timestamp, and confirms Ehab is who he says he is.

step 3

TGS-REP The Response ⇒ The KDC looks up the service account in NTDS.dit and sends back a TGS-REP containing two things :

1. Session Key A new session key, encrypted with Ehab’s previous Session Key only Ehab can decrypt it. This will be used to communicate with the target service.

2. TGS (Ticket Granting Service ticket) Encrypted with the service account’s hash Ehab cannot decrypt this. He just holds it and presents it to the service.

⇒ Inside the TGS:

  • Ehab’s identity
  • PAC his SID, group memberships, privileges
  • Expiry time
note : 
when the KDC receives a TGS-REQ, it only verifies your identity. It never checks whether you
actually have permission to access the requested service. That check happens later at the 
service itself.
This means any authenticated domain user can request a TGS for any service in the domain and 
that's exactly why Kerberoasting exists.

service Request “AP REQUEST”

Accessing the Service ⇒ Ehab’s machine takes the TGS and sends it directly to the target service. The service decrypts it using its own hash no need to contact the KDC again.

If the PAC says Ehab has the right permissions , access granted.

Ehab → TGS-REQ (TGT + encrypted timestamp)  → KDC
KDC  → TGS-REP (Session Key + TGS)          → Ehab
Ehab → AP-REQ  (TGS)                        → Service
Service decrypts TGS with its own hash      → Access granted

another Useful Resource

{% file src=”/files/VD9QHtdjDzVT9BxKWPZu” %}


NTLM-V2

NTLMv2 How It Works

NTLMv2 is a challenge-response authentication protocol. Unlike Kerberos, there are no tickets involved instead, the server challenges the client to prove it knows the password without sending it over the network.

Step 1 ⇒ Negotiation

machine tells the server it wants to authenticate and what NTLM version it supports.

Step 2 ⇒ Challenge

The server generates a random 8-byte value called a nonce and sends it to Ehab’s machine.

Step 3 ⇒ Response

Ehab’s machine takes the nonce and combines it with:

  • The NT hash of user’s password
  • A client-generated nonce
  • A timestamp

And produces the NTLMv2 Response this is what gets sent back to the server.

Step 4 ⇒ Verification

The server forwards the response to the Domain Controller, which looks up Ehab’s NT hash in NTDS.dit, performs the same calculation, and checks if the results match.


سبحانك اللهم وبحمدك, أشهد أن لا إله إلا أنت, نستغفرك ونتوب إليك
← All journal articles
Scroll to Top
Home