Module 16: Active Directory Persistence

Keeping Domain Access

Domain Group Memberships

Built-in privileged security groups

Group Name
Description

Domain Admins

Grants full control of the domain, is a member of the built-in administrators group on all domain controllers in a domain, and are administrators on the domain-joined machines

Enterprise Admins

Grants full control of all domains in a forest and is a member of the built-in administrators group on all domain controllers in a forest

Administrators

Grants full control of all the domain controllers in a domain

Group scope definitions

Scope Name
Definition

Universal

Can be assigned in any domain in the same forest or trusting forests

Global

Can be assigned in any domain in the same forest or trusting domains or forests

Domain Local

Can only be assigned in the current domain

Listing account management audit policy settings

PS C:\Windows\system32> auditpol /get /category:"Account Management"
System audit policy
Category/Subcategory                      Setting
Account Management
  Computer Account Management             Success
  Security Group Management               Success
  Distribution Group Management           No Auditing
  Application Group Management            No Auditing
  Other Account Management Events         No Auditing
  User Account Management                 Success

There are three conditions that will trigger an alert from this audit policy:

  1. A security group is created, changed, or deleted

  2. A security group has a member added or removed

  3. A security group is changed to a distribution group or vice versa

Event IDs for group membership changes

Event ID
Description

4728

A member was added to a security-enabled global group

4729

A member was removed from a security-enabled global group

4732

A member was added to a security-enabled local group

4733

A member was removed from a security-enabled local group

4756

A member was added to a security-enabled universal group

4757

A member was removed from a security-enabled universal group

XPath XML filter for all security group changes

XPath XML filter for targeted security group changes

XPath filter for all security group changes for three named groups

Function to provide event descriptions

Complete output from the security group audit script

Domain User Modifications

Listing the account management sub-categories

XPath XML filter for user account management events

Function to provide user account management event descriptions

Running the user change audit script

Golden Tickets

Typical kerberos ticket

Function to retrieve key values from the GPOReport

Executing the Get-Kerberos Settings function

A cached golden ticket

Kerberos tickets are assigned to logon sessions, identified by logon IDs. Executing klistwithout any parameters only displays cached tickets for the current session

Running the klist command

Running the klist sessions command

Runnin the klist command with a targetd logon ID

Unfortunately, the klist command doesn't offer a method to retrieve cached tickets for every session on the computer in one go.

PowerShell one-liner to dump all cached tickets

Function to provide all logon IDs

Function to retrieve session tickets

Running the Get-LogonIds and Get-Tickets together

Retrieving ticket time values

Function to analyze ticket values

Running a golden ticket discovery chain

Logic to detect the RC4 encryption type value

Last updated