Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Kerberoasting and how to stop it

After this lesson: I can find a kerberoastable account, confirm it safely, and fix it with AES and a strong password.

65 min lesson10 commandsActive Directory security lab: a Samba domain controller to audit and harden on one private Ubuntu VM

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

A ticket anyone can ask for

Any signed-in user may ask the directory for a service ticket to any service account. The ticket is locked with a key made from that account's password.

So a service account with a weak password and the old RC4 cipher is at risk. An attacker asks for its ticket, takes it away, and guesses the password offline. That is kerberoasting. You will find the weak one, prove it safely, and fix it.

The one rule

Warning

This is your own lab directory. Requesting service tickets to crack them elsewhere needs written permission. In the UK, without it, it can break the Computer Misuse Act 1990. Here you never crack anything: you confirm the weak password with a short list of the lab's own planted guesses.

Quick check: the rule

Have a go

Quick check: the rule

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

By the end of this lesson

Note

I can find a kerberoastable account, confirm it safely, and fix it with AES and a strong password.

Key words

WordWhat it meansExample
SPNservice principal name: the label that makes an account a serviceMSSQLSvc/db01...
Kerberoastinggetting a service ticket and cracking its password offline
RC4the old cipher (arcfour-hmac) a weak service account still allows
gMSAgroup managed service account: a long random password the directory rotates
Offlineon the attacker's own machine, where no one can see the guessing

The cells students fill in are left blank in this preview.

Starter

Have a go

Starter

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Find the service accounts

Lesson 1's filter finds every user account with an SPN, leaving out krbtgt. There is one, svc-sql, with an SPN for a database service. An account with an SPN is one anybody can request a ticket for.

Find user accounts with an SPN

Command
sudo ldbsearch -H /var/lib/samba/private/sam.ldb '(&(servicePrincipalName=*)(objectCategory=person)(!(sAMAccountName=krbtgt)))' sAMAccountName servicePrincipalName

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Request its ticket and read the cipher

Sign in (as any user; here the administrator), then kvno asks the directory for a service ticket to svc-sql's SPN. klist -e then shows that ticket's cipher.

Read the Etype. The session key is aes256, but the ticket itself is DEPRECATED:arcfour-hmac, RC4. That ticket is what an attacker would crack.

Sign in

Command
echo Lab-Admin-2026 | kinit [email protected]

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Request the service ticket

Command
kvno MSSQLSvc/db01.ad.college.lab:1433

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Read the ticket's cipher

Command
klist -e | grep -A1 MSSQLSvc

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Confirm the weak password, safely

An attacker would crack the ticket offline. As the auditor, you do the least intrusive thing instead. Try the account's password against a short list of likely guesses, here a single planted one.

If kinit accepts Summer2025, the password is weak and the finding is proven, with no ticket cracked and nothing taken off the machine.

Test one planted guess

Command
echo Summer2025 | kinit [email protected] && echo 'that password is one of our short list of planted guesses'

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

A common mistake

Warning

People think the fix is only a longer password. A long password helps, but if the account still allows RC4 and never rotates, it is one leaked backup away from trouble. Fix the cipher and the password together, and prefer a managed account that rotates its own.

Fix it: strong password and AES only

Two changes. Give the account a long random password, the kind a group managed service account (gMSA) would set and rotate for you. Then tell it to use AES only, so it can no longer hand out an RC4 ticket.

After both, request the ticket again: it comes back aes256, and the short password list no longer opens it.

Set a long random password

Command
sudo samba-tool user setpassword svc-sql --newpassword="$(openssl rand -base64 30)"

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Allow AES only

Command
printf 'dn: CN=svc-sql,CN=Users,DC=ad,DC=college,DC=lab\nchangetype: modify\nreplace: msDS-SupportedEncryptionTypes\nmsDS-SupportedEncryptionTypes: 24\n' | sudo ldbmodify -H /var/lib/samba/private/sam.ldb

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Sign in again

Command
echo Lab-Admin-2026 | kinit [email protected]

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Request the ticket again

Command
kvno MSSQLSvc/db01.ad.college.lab:1433

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Read the new cipher

Command
klist -e | grep -A1 MSSQLSvc

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

What you fixed

The ticket is AES now, and the password is long and random, so a captured ticket is useless. In lesson 6 you will see the log event, a service ticket requested with RC4, that flags a roasting attempt before anyone cracks anything.

First, the assignment: an auditor's report of which accounts are roastable.

Assignment: list the roastable accounts

An audit reads the directory into a list of accounts. Each account is a dictionary with three keys: name (a string), spn (a string, empty if the account has no service name) and kind (either "user" or "computer").

Write roastable(accounts). It returns a sorted list of the names of the accounts that could be kerberoasted: those that have a service name (spn is not empty), are a user and not a computer, and are not the built-in krbtgt. If none qualify, return an empty list.

Code: python
def roastable(accounts):
    return []

Make a free account to save your work and track your progress.

Exit quiz

Have a go

Exit quiz

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.