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

Free lesson

Admin tiers and detection

After this lesson: I can find over-powered accounts, apply admin tiering, and turn on logging that catches these attacks.

65 min lesson4 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

Who really holds the keys

Every weakness so far ends in the same place: an account powerful enough to own the directory. The last job is to know who those accounts are, keep them away from ordinary machines, and watch what everyone does.

You will find an everyday account that should not be a domain admin. Then you will learn how to keep the powerful accounts safe, and turn on the logging that catches the earlier attacks.

The one rule

Warning

Read your own lab directory's members and logs. Reading another organisation's admin groups or authentication logs needs written permission; in the UK, without it, it can break the Computer Misuse Act 1990.

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 over-powered accounts, apply admin tiering, and turn on logging that catches these attacks.

Key words

WordWhat it meansExample
Tieringkeeping admin accounts off ordinary machines, by level
Tier 0the accounts and machines that control the whole directory
Protected Usersa group that hardens its members' sign-ins
Audit logthe record of who signed in, how and whether it worked
Event 4624the logon event, with the method usedNTLMSSP or Kerberos

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

Who is a domain admin

List the members of Domain Admins. There should be as few as possible, and each should be an account used only for admin work, never for email or browsing.

You find two: the built-in Administrator, and t0admin, an everyday account. One of those is one too many.

List the domain admins

Command
sudo samba-tool group listmembers 'Domain Admins'

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

Admin tiering

The defence is tiering. Tier 0 is the accounts and machines that control the directory. A tier-0 account never signs in to an ordinary laptop, because a hacked laptop could steal its ticket. That is the delegation risk from lesson 5.

Protected Users

Put the powerful accounts in the Protected Users group. It forbids them weak ciphers and NTLM and shortens their tickets. Give each admin a separate everyday account for mail and browsing.

The fix for t0admin is to move its daily use to an ordinary account, and keep the admin one for admin work only.

Turn on the logging that catches all this

A fix you cannot see fail is a fix you cannot trust. Turn on the domain controller's authentication audit. It writes one JSON record per sign-in: who, how (NTLM or Kerberos) and whether it worked.

Make one NTLM sign-in, then read the last record. It is event 4624 with NTLMSSP as the method. That is the exact thing to alert on while you phase NTLM out. Alert too on an RC4 service ticket (lesson 4) and a tier-0 logon to an ordinary host.

Turn on authentication audit logging

Command
sudo sed -i '/^\[global\]/a log level = 0 auth_json_audit:3' /etc/samba/smb.conf && sudo smbcontrol all reload-config

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

Make one NTLM sign-in

Command
smbclient -L DC01 -U svc-sql%Summer2025 --option=clientusekerberos=no

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

Read the logged event

Command
grep '"type": "Authentication"' /var/log/samba/log.smbd | tail -1 | python3 -c 'import sys,json; a=json.load(sys.stdin)["Authentication"]; print("event", a["eventId"], "|", a["authDescription"], "|", a["clientAccount"], "|", a["status"])'

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

A common mistake

Warning

Teams turn on logging and never decide what to alert on, so the records pile up unread. A log is only a detection if something watches it. Name the handful of events worth an alert, NTLM logons, RC4 service tickets, tier-0 logons off tier 0, and start there.

What you built

You found an over-powered account and learned to tier and protect the powerful ones. You turned on the log that shows NTLM, RC4 and admin misuse as they happen. That closes the loop from every earlier lesson.

The assignment turns the raw log into the two reports a defender actually reads.

Assignment: read the audit log

Turn an audit log into two reports.

ntlm_accounts(events) takes a list of logon events. Each is a dictionary with account (a string) and method (a string, "NTLMSSP" for NTLM or "Kerberos"). Return a sorted list of the distinct account names that signed in with NTLM. Each name appears once.

tier0_offences(sessions) takes a list of sessions. Each is a dictionary with account, is_tier0 (True if it is a tier-0 admin account) and host_is_dc (True if the machine is a domain controller). Return a sorted list of the distinct tier-0 account names that signed in to a machine that is not a domain controller.

Code: python
def ntlm_accounts(events):
    return []


def tier0_offences(sessions):
    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.