Cheat sheet

Active Directory

The vocabulary and authentication mechanisms to know to understand a Windows domain and read its logs.

CJCADefence

Vocabulary

TermDefinition
DomainA set of objects (users, machines, groups) sharing a directory database.
Domain controller (DC)Server that hosts the directory and authenticates users.
ForestOne or more domains sharing a schema and a global catalog.
TrustRelationship allowing accounts of one domain to access resources of another.
OUOrganizational unit: a container to organise objects and apply GPOs.
GPOGroup Policy Object: settings applied to users and machines.
NTDS.ditThe directory database on each domain controller.
SYSVOLShare replicated across DCs, holding scripts and GPOs.
SPNService Principal Name: a service's identifier for Kerberos.
krbtgtThe account whose key encrypts and signs every TGT in the domain.
SIDUnique security identifier of each object.
ACL / ACEAn object's access control list, made of entries (ACEs) that grant rights.

Sensitive groups

GroupPower
Domain AdminsAdministrators of the whole domain.
Enterprise AdminsAdministrators of the whole forest (root domain).
Schema AdminsCan modify the forest schema.
AdministratorsLocal administrators of the domain controllers.
Backup OperatorsCan back up sensitive files from the DCs.
DnsAdminsManage the DNS service of the domain controllers.
To monitorAny addition to these groups (Event IDs 4728, 4732, 4756) should trigger an alert.

Kerberos authentication

  1. AS-REQ / AS-REPThe client proves its identity to the KDC and receives a TGT (4768).
  2. TGS-REQ / TGS-REPWith its TGT, it requests a ticket for a specific service (4769).
  3. AP-REQIt presents that service ticket to the target server.
  • The KDC (Key Distribution Center) runs on the domain controllers, port 88.
  • Pre-authentication requires the client to encrypt a timestamp with its key before getting a TGT.
  • Kerberos is time-sensitive: a clock skew of more than 5 minutes (default) makes authentication fail.

NTLM

  • An older challenge-response protocol, used when Kerberos is not possible (access by IP address, machine outside the domain).
  • Three messages: negotiation, server challenge, response computed from the password hash.
  • Validation logged by event 4776.
  • Good practice: restrict or disable NTLM, enforce SMB and LDAP signing.

Common attacks and their traces

AttackTrace in the logs
KerberoastingMany 4769 with RC4 encryption (0x17) to service accounts.
AS-REP roasting4768 for accounts without pre-authentication.
Password sprayingMany 4625 or 4771, one password tried on many accounts.
DCSync4662 with replication rights, from a machine that is not a DC.
Golden TicketTickets with abnormal lifetimes or attributes; the only real fix: reset the krbtgt account twice.

For the investigation process, see Windows logs and Sysmon.