Kerberos Unmasked: How a Castle, a Key, and a Ticket Keep Your Enterprise's Network Safe
?? DISCLAIMER ??
Prerequisites
To follow along, it helps if you have at least a basic understanding of:
? Networking (What a server and a client are).
? User authentication (Logging in with usernames & passwords).
? Active Directory (AD) basics (Very high-level, just knowing it exists).
? Basic encryption concepts (The idea that data can be "locked" and "unlocked" for security).
? You do NOT need to be a cryptography expert.
? You do NOT need to configure AD or manage Kerberos in production.
Well, I know you’re probably familiar with the formal definition of Kerberos, so let’s cut to the chase and break it down in a way that actually makes sense to normal humans. But before diving into the details, let’s rewind to a time when Kerberos was still in its infancy; because, trust me, "The Beginning" might be the only part of history that won’t put you to sleep.
The Beginning
In the early 1980s, MIT launched Project Athena, an ambitious initiative aimed at creating a distributed computing environment for students and researchers. But a major problem quickly emerged: how do you securely authenticate users across a growing network without exposing passwords over and over again?
A small team, including Steve Miller and Clifford Neuman, took on the challenge under the guidance of Jerome Saltzer. Inspired by the three-headed dog of Greek mythology, they developed Kerberos, a revolutionary authentication protocol. By using tickets and encryption, Kerberos allowed users to log in once (Single Sign-On) and securely access multiple systems without constantly re-entering credentials.
Originally built to solve MIT’s internal security concerns, Kerberos quickly gained widespread recognition for its robust security and efficiency. By the late 1980s, it had been adopted by universities, enterprises, and eventually integrated into Microsoft Windows. Like its mythological namesake, Kerberos became the guardian of modern authentication, protecting networks from intruders.
Now, Let’s Get Real
Alright, history lesson aside; FIRST, let’s imagine a day without Kerberos from the perspective of an organization or an enterprise.
Here’s what life without Kerberos would look like. Buckle up.
Morning: Logging into Your Computer
You come into the office and boot up your computer. The first thing you do is type in your username and password to log in (like the first login screen you get when you boot your machine... You get that? ). Sounds simple, right? But here’s the catch:
First Task: Checking Email
You click on your email client (like say MS Outlook). But guess what? The email server has no idea who you are. It pops up a login screen:
Username: [Enter manually]
Password: [Type it again]
By now, you’re already thinking, “Did I type the password wrong?” because the keyboard is a little sticky. After a couple of failed attempts, you finally get in.
Second Task: Accessing Shared Files
Your manager needs you to grab a file from the shared drive. You open your file explorer and navigate to the shared folder. Boom!!! a new login prompt appears:
This shared drive is on a different server, so your computer treats it as a completely separate system. It doesn’t care that you already logged in earlier. Frustrated, you re-enter your credentials, trying to avoid typos. By now, you’ve wasted a few minutes just getting access to basic resources.
Third Task: Printing a Document
You need to print the file you downloaded from the shared drive. But here’s the kicker; the printer is also on the network, which means another login prompt:
If you accidentally mix up passwords, you might get locked out, and now you have to call IT. They’ll reset your account, and you’ll need to create a new password. Oh, and let’s not forget:
Printing something as simple as one file feels like climbing a bureaucratic mountain.
Midday: Intranet Applications
Your company uses an internal website (intranet) for announcements, policies, and HR tasks. You try to log in to check your vacation days, but—surprise! Another login prompt. The system doesn’t care that you already authenticated multiple times today.
By now, you’ve typed your credentials so many times that you’ve memorized every keystroke. Unfortunately, this muscle memory also increases the risk of making habitual mistakes:
Afternoon: IT Panic
Around 3 PM, IT sends out an urgent email: “Phishing Alert! Do NOT enter your credentials on fake login screens.” You realize this is a real problem because:
In this era, passwords are flying around everywhere. They’re sent across the network in plain text or weakly encrypted forms. This makes it ridiculously easy for hackers to intercept and steal them using basic tools like network sniffers.
Evening: Logging Out
At the end of the day, you close your computer, thinking your struggles are over. But wait, IT just announced that you need to change your password by tomorrow morning because of a potential security breach. You groan because:
Why Was This So Bad?
Without a system like Kerberos, authentication is a nightmare:
Enter the Realm of Kerberos: Now We Talking...
Kerberos was designed to fix all of these problems. With Kerberos:
Kerberos Analogy
Now, if this is still a bit hard to follow, let me make it even simpler (for dummies like me… yeah, yeah, I know).
Imagine a massive castle with multiple rooms, each containing valuable treasures. These treasures are only accessible to those with permission.
One fine day, there’s a grand event, and hundreds of people want to enter the castle and explore its rooms. But there’s a problem; the guards at the gate are extremely strict. They can’t allow strangers or imposters inside, but at the same time, they don’t want to waste time checking everyone’s identity every time they enter another room.
So, the castle uses a brilliant system: magic tickets.
So, how can you relate this scenario to Kerberos? (Don't worry about the technical key words, It will make sense as you read along)
NOW, LETS GET INTO THE MAIN STUFF...
What Is Kerberos? (Technically...)
Kerberos is like the ticket system in the castle; it’s a secure method of authenticating who you are in a network. It ensures that:
It’s like a bouncer for the digital world, designed to protect sensitive systems and services while making life easier for users.
Well... When Would You Use Kerberos?
Now imagine you’re in a company network (think of the castle). Each employee needs access to resources like email, shared files, printers, or servers. You don’t want employees to repeatedly enter their passwords every time they access a new service (Remember the struggles we went through during the life of an employee without Kerberos above somewhere? yess...).
Kerberos comes in handy when:
Think of Kerberos as a trusted mediator between you (the user) and the services you want to use.
AGAIN, PLS DO NOT CONFUSE THIS WITH FEDERATED SSOs. Kerberos is NOT the same as Federated SSO. It doesn’t handle web app authentication or cloud-based login systems. Kerberos is strictly for internal network environments (at least, to the best of my knowledge at the time of writing this article).
Where Does Kerberos Work?
Kerberos works best in environments like:
Kerberos is a common component in systems like Windows Active Directory, where it’s the backbone of authentication.
Why Kerberos?
Traditional authentication systems would require a user to enter their password every time they access a service. But this is:
Kerberos solves this by:
It’s like having a passport for your network; proving your identity without constantly showing private details.
Who Uses Kerberos, and Whom Does It Protect?
Who uses it?
领英推荐
Whom does it protect?
How Does Kerberos Work? (Simplified)
Let’s go back to the castle analogy:
The beauty? Once you get the initial ticket, the system takes care of the rest. No passwords are sent around after that.
"Aha! This Is When I Need Kerberos" - Moment
You’ll know you need Kerberos when:
Now that you have a fair idea about the little details, let’s dive a bit deeper into how things work behind the scenes. I’ll break it down step by step.
Let’s visualize a basic enterprise scenario; nothing too complex. Imagine a work PC connected to a central server that handles user authentication when logging into the machine. This central system is called Active Directory (AD).
Within AD, there are Kerberos components such as the Authentication Server (AS) and Ticket Granting Server (TGS), which manage secure authentication.
Important Note: AD runs thousands of services, and Kerberos is just one small part of the big picture. It plays a key role in authentication, but AD handles much more than just Kerberos.
And one more thing before we dive deep. "Kerberos" is not just one service or one component that doing all this work. To function properly, Kerberos has multiple players that work together like a team:
Now its time for a walk-through. Also, keep in mind, you might want to refer the above table to keep you in track if you get kinda lost in the Acronyms I mentioned below. That being said, lets try to understand the work flow of how Kerberos system works. So, we have a user getting ready for their day at the work place.
Step 1: The staff or employee sits in front of their work PC and start typing the credentials (Username and Password)
Step 2: User click "Enter" or "Login" button to send the credential to the server where KDC (refer the Kerberos components table above if you are getting lost) service is running. The client machine does not send the plaintext password to the AS. Instead, the client hashes the password and uses it to encrypt a timestamp (e.g., 2022-01-30T14:00:00). Now visualize the user credentials i.e. the username and encrypted timestamp (using the password-derived hash) passing through the wires towards the Active Directory server.
Message Sent to AS:
Username: Kimposhible
Encrypted Timestamp: {2022-01-30T14:00:00 encrypted with (Password Hash)}
Step 3: The AS checks AD to verify the username (Kimposhible) exists. AD does not store plaintext passwords instead, it stores a hash of Kimposhible’s password. Then the AS retrieves the password hash of the user from Active Directory. The AS uses this stored password hash to decrypt the timestamp. If decryption is successful, the AS gets a valid timestamp (i.e as mentioned before, 2022-01-30T14:00:00). If decryption fails, it means the user entered the wrong password because the encryption key was incorrect.
If the timestamp is within an acceptable range (e.g., ±5 minutes), the AS assumes:
If authentication succeeds, the AS creates a Ticket Granting Ticket (TGT). The TGT is encrypted with the KDC’s secret key (so only the TGS can read it). The AS sends the TGT back to Kimposhible’s computer.
Once Kimposhible's computer get the TGT, it then stores the TGT in main memory (RAM) in the Kerberos ticket cache.
Step 4: Now, that Kimposhible is logged into their machine, they are ready to start the day and address their day-to-day responsibilities. As they progress, for example the user might want to access a file server, print server, database, etc. for this to work, their computer sends the TGT + Authenticator to the Ticket Granting Server (TGS).
Why Does Kerberos Use Both the TGT and Authenticator?
Step 5: If the TGT is valid, the TGS creates a Service Ticket for the requested resource. The TGS uses the Service Principal Key (SPK) to encrypt the Service Ticket before sending it to the client.
Now the question comes, what is SPK? What is Service Ticket? How is they created? What does it contain? Well, if your curiosity hits, then lets dive into that...
Service Principal Key (SPK): Every Kerberos-enabled service (e.g., file servers, print servers, databases) must have a secret key to decrypt our fancy Service Tickets. This key is called the Service Principal Key (SPK) and is stored in the Keytab file on the service’s machine (both AD and Servers).
What happens here is that, whenever a File Server, Print Server, or Database joins the Active Directory domain, it receives a copy of its SPK. This SPK is then stored locally into the respective servers(like print server, file server etc.) so the service can decrypt the Service Tickets when the user's machine sends it.
On Windows systems perspective, the SPK is stored inside Active Directory and automatically retrieved by the service. On the other side, in the Linux environment the SPK is stored in /etc/krb5.keytab. The service (e.g., Samba, CUPS, PostgreSQL) reads this file to verify the kerberos Service Tickets.
Service Ticket (ST): It is a secure proof that the user is authenticated and allowed to access a service. It contains the username, service name, session key, timestamp, and more, and is encrypted so that only the service itself can read it. The Service Ticket prevents password reuse, ensuring secure, password-less access once authentication is completed. Well, I'll just show you what is inside the Service Ticket:
Step 6: Now that the user got the Service Ticket, they are ready to use this ticket to access services (eg: to print, or to access a file from the network drive). User's machine sends the Service Ticket + Authenticator (fresh one again, encrypted with the session key) to the resource server (e.g., print server or file server). The service in the server decrypts the ticket using its own secret key (remember the SPK from Step 5? Yup, that's the secret key), then uses the Session Key inside it to decrypt the Authenticator. If valid, the service grants access without needing the user’s password. The session key inside the Service Ticket allows encrypted communication between the client and service. The user can now interact with the service until the ticket expires.
THAT'S IT FOR TECHNICAL JARGON... BONUSSSS!! LET'S SEE AN EXAMPLE!!!!!
Scenario 1: User "Alice" Accessing a File Named a.txt from a File Server
Step 1: User Logs into Their Computer
Action:
Alice enters their username and password at the login screen.
The system needs to authenticate them using Kerberos.
Network Communication:
The client machine sends an authentication request to the Authentication Server (AS) inside the KDC (Active Directory).
The request contains: Username (e.g., Alice) Current timestamp (to prevent replay attacks) Encrypted challenge (random number encrypted using Alice’s password hash)
AS verifies the username and password against Active Directory.
If valid, the AS encrypts a Ticket Granting Ticket (TGT) and sends it back.
The response contains: TGT is stored in Alice's Computer's RAM (in the Kerberos Ticket Cache).
Step 2: User Requests Access to a.txt on the File Server
Action:
Alice tries to open a.txt from a shared network folder.
Network Communication:
The client sends a request to the Ticket Granting Server (TGS).
The request contains: TGT (proving Alice’s identity) Authenticator (A new timestamp encrypted with Alice’s session key)Requested Service (File Server \\fileserver1\share)
TGS validates: Is the TGT still valid? (i.e., not expired) Does Alice have permissions for the requested service?
If valid, TGS issues a Service Ticket for the File Server.
The response contains: Service Ticket (Encrypted with File Server’s key, so only the File Server can decrypt it) New Session Key for communication between Alice and the File Server and Ticket Expiry Time (e.g., 10 hours)
Step 3: User Accesses a.txt on the File Server
Action:
Alice’s machine sends a request directly to the File Server.
Network Communication:
The request contains: Service Ticket (Received from TGS, encrypted with File Server’s secret key) Authenticator (Fresh timestamp encrypted with new session key)
Requested Action: Read a.txt
File Server Response:
The File Server decrypts the Service Ticket using its secret key.
It validates: Is the ticket valid (not expired)? Does the Authenticator match the session key? Does Alice have permissions to access a.txt?
If everything checks out, the File Server grants access.
Final Data Transfer:
The File Server sends the contents of a.txt to Alice’s machine.
Data is encrypted using the Session Key to protect it from network sniffers.
?? Bonus Round! A Quick Visual Recap of the Kerberos Authentication Flow ??
Phew.... Thats it...