Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 80 ยท Authentication and Access Control

Kerberos, LDAP and RADIUS

Understand how Kerberos tickets authenticate users without sending passwords, what LDAP and RADIUS do, how they compare with SAML, and how to detect Kerberos abuse.

Inside a company, hundreds of users reach thousands of services: file shares, databases, printers, Wi-Fi, VPNs. Each service cannot keep its own password database, and users cannot type a password for every one. Organizations solve this with central authentication: one trusted system verifies who you are, and other systems rely on its answer. This lesson covers three protocols you will meet constantly:

  • Kerberos, a ticket-based protocol that authenticates users and services without sending passwords over the network (the heart of Windows Active Directory).
  • LDAP, a protocol for querying and updating a directory of users, groups and devices.
  • RADIUS, a protocol that gives network devices (Wi-Fi access points, VPN gateways, switches) centralized authentication, authorization and accounting.

You will follow the Kerberos exchange step by step, simulate it with a toy model in Python, and learn how defenders spot abuse in its logs. The web-oriented equivalents are in OAuth 2.0, OpenID Connect and SSO. Because the ideas rest on shared secrets and timestamps, it helps to know HMAC and Message Authentication and Symmetric Encryption and Modes.

Kerberos in one picture

Kerberos was designed at MIT in the 1980s and is now at version 5. It has three parties:

  • Client: the user (or their machine).
  • Key Distribution Center (KDC): a trusted server with two parts, the Authentication Service (AS) and the Ticket-Granting Service (TGS). In Active Directory, the domain controller is the KDC.
  • Service: the file server, database or other resource the user wants.

The KDC knows a secret key for every user (derived from the password) and every service. Its core idea: the client never sends its password. It proves it knows the key by being able to decrypt something, and the KDC hands out tickets that services can verify without contacting the KDC.

sequenceDiagram
    participant C as Client
    participant AS as KDC: Authentication Service
    participant TGS as KDC: Ticket-Granting Service
    participant S as Service
    C->>AS: 1. AS-REQ: I am alice (+ timestamp proof)
    AS->>C: 2. AS-REP: session key (readable only with Alice's key) + TGT (readable only by KDC)
    C->>TGS: 3. TGS-REQ: TGT + authenticator + "I want the file server"
    TGS->>C: 4. TGS-REP: service ticket (readable only by the service) + new session key
    C->>S: 5. AP-REQ: service ticket + authenticator
    S->>C: 6. AP-REP: (optional) proves the service is genuine

Six messages: two to log in, two to get a ticket for a service, two to use it.

The six steps

  1. AS-REQ. Alice asks the Authentication Service for a ticket-granting ticket (TGT). With pre-authentication, she includes the current time encrypted with her password-derived key, which proves she knows the key.
  2. AS-REP. The KDC replies with two things: a TGT session key encrypted with Alice's key, and the TGT, which contains the same session key and her identity but is encrypted with the KDC's own secret key (the krbtgt key). Alice can read her part but cannot read or alter the TGT. Only if she knew her password can she unlock the session key.
  3. TGS-REQ. To reach a service, Alice sends the TGT, the name of the service, and an authenticator (her name and a timestamp encrypted with the TGT session key).
  4. TGS-REP. The KDC checks the TGT, and issues a service ticket encrypted with the service's secret key, plus a fresh session key for Alice and that service.
  5. AP-REQ. Alice sends the service ticket and a new authenticator to the service. The service decrypts the ticket with its own key (learning who Alice is and the session key) and verifies the authenticator.
  6. AP-REP. Optionally the service proves its own identity (mutual authentication) by returning something only a genuine service could produce.

After step 2 Alice does not type her password again until the TGT expires (typically about 10 hours). That is single sign-on inside the domain.

A toy Kerberos in Python

Real Kerberos uses AES. The model below uses a tiny keyed-stream "cipher" built from SHA-256 and an HMAC integrity tag, purely to show who can read what. It is not secure and must never be used for real data.

Python Tickets: who can read what

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Each secret is readable by exactly one party. The password never crosses the network; Alice's ability to open her message is the proof. Services never talk to the KDC when they check a ticket, which makes Kerberos scale well.

Time, replay and limits

Authenticators carry a timestamp, and the receiver accepts them only within a small window (five minutes by default in Active Directory) and remembers recent ones to reject a replay of a captured message. This makes clock synchronization (NTP) essential: a skewed clock breaks logins.

Python Authenticator freshness and replay cache

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Kerberos has weaknesses that defenders must understand:

  • Single point of failure and trust: if the KDC is down, logins stop; if its secrets are stolen, everything is compromised. Protect domain controllers like crown jewels (Endpoint Protection and System Hardening).
  • Password-based keys: weak passwords can be guessed offline if an attacker captures the encrypted parts of a reply. Pre-authentication and strong passwords reduce this (Password Strength and Policies).
  • Ticket abuse: service tickets for accounts with weak passwords can be requested by any domain user and cracked offline (often called Kerberoasting), and a stolen krbtgt key allows forged TGTs ("golden tickets"). Defences: long random passwords or managed service accounts for services, AES encryption types instead of legacy RC4, and rotating the krbtgt secret after a compromise.
  • Delegation risks: services allowed to act on behalf of users can become powerful stepping stones; restrict delegation.

Detecting abuse in the logs

Domain controllers log ticket requests (Windows event IDs 4768 for TGTs and 4769 for service tickets). The patterns defenders look for are volume, rare accounts, and weak encryption. This sketch flags both:

Python Flag suspicious service-ticket requests

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Normal users request a handful of tickets for services they use. An account requesting many different services, all with the old RC4 type, is a classic signal. Feed such rules into your SIEM (Logging, Log Analysis and SIEM).

LDAP: the directory

LDAP (Lightweight Directory Access Protocol) is a protocol for reading and writing a directory: a tree of entries such as users, groups, computers and printers. Each entry has a distinguished name like uid=alice,ou=People,dc=example,dc=com and attributes (mail, memberOf). Applications use LDAP to look up users, check group membership for authorization, and sometimes to authenticate with a bind (supplying a DN and password). Active Directory is a directory service that speaks LDAP and Kerberos.

Security points:

  • Always use LDAPS or StartTLS; a plain bind sends the password in clear text.
  • Avoid anonymous binds, and give applications read-only service accounts with the least privilege.
  • Escape user input in LDAP filters: building (uid= + input + ) by concatenation allows LDAP injection, the same flaw as SQL injection. Use the library's escaping or parameterization.

RADIUS: AAA for the network edge

RADIUS is a client-server protocol providing authentication, authorization and accounting (AAA) for network access. The device the user connects to (a Wi-Fi access point, VPN gateway or switch) is the network access server; it forwards credentials to the RADIUS server, which checks them (often against LDAP or Active Directory) and replies accept or reject, optionally with attributes such as the VLAN to place the user on. It also records session start and stop for accounting. It is the engine behind enterprise Wi-Fi with 802.1X/EAP (VPNs, Wi-Fi and Remote Access Security). Weaknesses: classic RADIUS encrypts only the password field and relies on a shared secret between the device and server, so protect that secret and tunnel RADIUS (for example with RadSec, which runs RADIUS over TLS) across untrusted networks. A related protocol, TACACS+, is often used for administrator logins to network devices because it encrypts the whole payload and separates authorization.

How they compare

Kerberos LDAP RADIUS SAML / OIDC
Main job Ticket-based login inside a domain Directory lookups and binds AAA for network access Web single sign-on across organizations
Credential travels Never the password; tickets Password in a bind (use TLS) Password to the NAS server (protected) Signed assertion or token
Typical users Domain computers and services Applications, admin tools Wi-Fi, VPN, switches Cloud and web apps
Needs clock sync Yes No No Yes (token validity)

They work together: a user signs in to Wi-Fi via RADIUS that checks the directory (LDAP), then opens a file share with a Kerberos ticket, then reaches a cloud app through SAML or OIDC single sign-on.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What does the TGT let Alice do?

    The ticket-granting ticket proves she already authenticated to the KDC, so she can ask for tickets to specific services until it expires.
  2. 2. Why does a service ticket not need to be checked with the KDC?

    The service decrypts the ticket with its long-term key. A successful decryption shows the KDC issued it.
  3. 3. Why does Kerberos require synchronized clocks?

    Time limits how long a captured authenticator can be replayed, but only if clients and servers agree on the time.
  4. 4. A web application builds an LDAP filter by concatenating a user-supplied name. Which flaw is this?

    Unescaped input can change the filter's meaning, just like SQL injection. Escape or parameterize filter values.
  5. 5. Which protocol is mainly used so that a Wi-Fi access point can check a user against a central server?

    RADIUS gives network access devices centralized authentication, authorization and accounting, typically with 802.1X.

Summary

  • Kerberos authenticates through tickets from a KDC (AS and TGS) so passwords never cross the network; six messages cover login, service ticket and service access.
  • Each ticket is encrypted for exactly one party; timestamps and replay caches require synchronized clocks.
  • Risks: KDC compromise, offline cracking of weak keys, forged tickets and delegation; defend with strong service passwords, AES, hardening and monitoring of ticket requests.
  • LDAP is a directory protocol; use TLS, least-privilege service accounts and escaped filters.
  • RADIUS provides AAA for network access such as 802.1X Wi-Fi and VPNs; protect its shared secrets or use RadSec.
  • Kerberos, LDAP, RADIUS and SAML/OIDC complement each other in a real organization.

Next: Classic Security Models, or go back to Authorization and Access Control Models.