Chapter 09

Identity Containment

In most modern intrusions, the attacker's most valuable asset is not a malware implant — it is a set of valid credentials. Network isolation and host containment do not touch credentials. Identity containment does.

Scenario

An IR team fully isolates 47 compromised hosts over a 4-hour period. EDR containment is working. Network segmentation is in place. The IR lead marks containment complete and moves to eradication planning. Six hours later, new alerts fire: the attacker is back, on fresh hosts they haven't touched before, authenticated as a service account the IR team never identified as compromised. The post-incident investigation reveals what happened: the attacker had harvested 23 sets of credentials from the initial compromised hosts. The IR team identified and rotated 17. The other 6 — service accounts, application accounts, accounts that didn't appear in the process telemetry — were missed. The attacker waited out the initial containment, then used the overlooked credentials to re-enter. Hosts were contained. Credentials were not. The attacker didn't need the hosts.

Comprehensive Compromised Credential Identification

The most common identity containment failure is incomplete scope: the IR team identifies some compromised credentials, rotates them, and misses others. Every credential left unrotated is a potential re-entry path. Finding all compromised credentials is the hard part of identity containment.

  Credential Compromise Sources — Where to Look
  ══════════════════════════════════════════════════════════════════════

  PROCESS MEMORY ON COMPROMISED HOSTS
  ─────────────────────────────────────────────────────────────────
  LSASS (Local Security Authority Subsystem Service) holds password
  hashes and Kerberos tickets for all accounts that have authenticated
  on the system. Mimikatz and similar tools dump these.
  Look for: Sysmon Event ID 10 (process access to LSASS) or EDR
  LSASS read events on any confirmed compromised host.
  Every account that authenticated on a confirmed compromised host
  should be treated as potentially compromised.

  EDR CREDENTIAL ACCESS TELEMETRY
  ─────────────────────────────────────────────────────────────────
  CrowdStrike/Defender/S1 detect credential dumping attempts with
  high reliability. Search EDR for: credential dump alerts on any
  host in the compromised environment (not just confirmed hosts —
  the attacker may have pivoted to hosts not yet in your confirmed list).
  Look beyond the confirmed compromised host list when searching
  EDR telemetry for credential access.

  AUTHENTICATION LOGS — ALL HOSTS THAT RECEIVED AUTH FROM COMPROMISED HOSTS
  ─────────────────────────────────────────────────────────────────
  Lateral movement leaves authentication artifacts. Event ID 4624
  (logon success) on target hosts shows which accounts the attacker
  used for lateral movement. Query: "Show me all accounts that logged
  into systems from the confirmed compromised hosts."
  These accounts were used for lateral movement → compromised.

  COMPROMISED HOST FILE SYSTEM
  ─────────────────────────────────────────────────────────────────
  Attackers often leave credential lists, password files, or output
  from credential dumping tools on disk or in temp directories.
  Collection of these files directly reveals which credentials were
  harvested.

  KNOWN ATTACKER TTPs
  ─────────────────────────────────────────────────────────────────
  If the threat actor is identified, their known credential targeting
  behavior guides scope. APT29 (Cozy Bear) specifically targets
  email accounts and service accounts. Criminal ransomware groups
  typically target domain admin for wide deployment. Knowing the
  actor's behavior tells you which credential categories to prioritize.

Account Rotation Order

The sequencing of credential rotation matters for the same reason that EDR isolation timing matters: rotate the wrong accounts first and the attacker knows which accounts you've identified, giving them time to pivot to accounts you haven't reached yet. The correct sequence is: complete identification first, then rotate simultaneously by tier.

  Credential Rotation Sequence
  ══════════════════════════════════════════════════════════════════════

  PHASE 1: Complete identification (do not rotate anything yet)
  ─────────────────────────────────────────────────────────────────
  Build the full list of potentially compromised accounts before
  touching any of them. This may take hours. It is worth the time.
  Rotating one account tells the attacker which accounts you know about.

  PHASE 2: Privileged accounts — rotate simultaneously
  ─────────────────────────────────────────────────────────────────
  Domain Admin accounts
  Enterprise Admin accounts
  Schema Admin accounts
  Built-in Administrator (local, on all compromised hosts)
  Service accounts with domain privileges
  Cloud IAM roles/accounts with broad permissions

  These get rotated first because an attacker using any of these
  can undo everything else you do. Rotation of other accounts while
  a DA credential remains active is mostly futile — the attacker
  can reset passwords using the DA account.

  PHASE 3: Service accounts — rotate simultaneously
  ─────────────────────────────────────────────────────────────────
  Service accounts for: SQL Server, IIS application pools, scheduled
  tasks, backup agents, monitoring agents, RPA bots.
  These are frequently overlooked because they don't belong to a
  person. They often have high privileges and rarely trigger alerts.

  PHASE 4: Standard user accounts — rotate simultaneously
  ─────────────────────────────────────────────────────────────────
  All user accounts that authenticated on confirmed compromised hosts.
  Note: for large incidents this may be hundreds of accounts.
  Batch rotation via forced password change at next logon or direct
  admin reset via Active Directory Users and Computers (or PowerShell
  bulk reset) is appropriate at scale.

  PHASE 5: Force re-authentication (not just password reset)
  ─────────────────────────────────────────────────────────────────
  Password reset invalidates future authentication but not existing
  sessions. Existing sessions must be terminated separately.
  See: Kerberos ticket invalidation, cloud token revocation below.

Active Directory Tiering and Lateral Movement Prevention

Active Directory tiering (Microsoft's "Tiered Administration Model" and the modern "Enterprise Access Model") is an architecture concept where administrative accounts are categorized by what they can access and are physically prevented from crossing tier boundaries. Understanding this model helps IR teams prioritize which account compromises are most dangerous and where the blast radius of a specific credential compromise extends.

TierWhat it managesExample accountsWhy compromise is severe
Tier 0 (Control Plane) Identity infrastructure: domain controllers, AD CS, AAD Connect, PAM solutions Domain Admin, Enterprise Admin, AD CS admin, KRBTGT account Compromise gives attacker control of the entire directory. Can create arbitrary accounts, forge Kerberos tickets, push GPOs to all machines.
Tier 1 (Management Plane) Servers and applications: file servers, database servers, application servers Server local admins, application service accounts, backup admin accounts Compromise gives access to all servers in scope. Can access databases, file shares, application data.
Tier 2 (User Devices) Workstations and end-user devices Local admin accounts on workstations, helpdesk accounts with local admin Compromise enables lateral movement to other workstations. Helpdesk accounts used for workstation management are frequently targeted as a lateral movement path to privileged accounts.
Why service accounts are the most commonly missed credential category

Service accounts are accounts used by applications and services, not by people. They do not appear in helpdesk tickets, HR systems, or user provisioning workflows the same way employee accounts do. They are often created by application teams and not tracked in the identity management system. They frequently have elevated privileges (SQL Server service accounts often have local admin; IIS application pools often have network access to file shares). And they rarely change passwords, meaning that if their credentials are stolen, the attacker can use them indefinitely without triggering anomalous authentication patterns. During IR, finding all service accounts that potentially had their credentials exposed requires: reviewing the process list on each compromised host for services running as domain accounts, querying Active Directory for accounts configured as service accounts (SPNs set), checking application configuration files for hardcoded credentials, and reviewing scheduled task definitions for "Run As" account settings. This work is tedious and non-glamorous, but an unrotated service account is the most common reason for re-intrusion after containment.

Golden Ticket: Detection and Containment

A golden ticket is a forged Kerberos ticket-granting ticket (TGT) created using the NTLM hash of the KRBTGT account. The KRBTGT account is used by the Key Distribution Center (KDC) — the component of Active Directory that issues Kerberos tickets — to sign all TGTs. If an attacker obtains the KRBTGT hash, they can create their own TGTs with any identity, any group membership, and any ticket lifetime they choose — without ever authenticating with Active Directory.

  Golden Ticket: How It Works and How to Contain It
  ══════════════════════════════════════════════════════════════════════

  HOW LEGITIMATE KERBEROS WORKS:
  User authenticates to DC → DC verifies credentials → DC issues TGT
  signed with KRBTGT hash → User presents TGT to request service tickets
  → DC validates TGT signature using KRBTGT hash → issues service ticket

  HOW GOLDEN TICKET BYPASSES THIS:
  Attacker obtains KRBTGT hash (via DCSync, DC compromise, Mimikatz)
  → Attacker uses KRBTGT hash to sign a forged TGT with arbitrary content
  (any username, any group membership — e.g., Domain Admins) →
  Attacker presents the forged TGT to any DC to request service tickets →
  DC validates KRBTGT signature — it's valid, because it was signed with
  the real KRBTGT hash → DC issues service tickets for the fake identity →
  Attacker has Domain Admin access to anything in the domain

  HOW TO DETECT:
  ─────────────────────────────────────────────────────────────────
  Event ID 4769 (Kerberos service ticket request): ticket encryption
  type RC4 (0x17) from accounts that should use AES — older Mimikatz
  golden tickets default to RC4; modern tools use AES but this is
  still a detection signal in environments that have enforced AES.

  Event ID 4672 (Special privileges assigned to new logon) for
  accounts that were not expected to log in with DA privileges.

  KRBTGT hash change audit: if KRBTGT password changes appear in
  event logs at a time that doesn't match your own reset activity,
  the attacker may have reset it to a known hash.

  HOW TO CONTAIN:
  ─────────────────────────────────────────────────────────────────
  KRBTGT password must be reset TWICE.

  First reset: changes the KRBTGT hash. All NEW tickets issued after
  the reset are signed with the new hash. OLD forged tickets still work
  because DCs keep the previous KRBTGT hash in memory to validate
  tickets issued during the current ticket lifetime window.

  Second reset: changes the KRBTGT hash again. DCs no longer have
  the old (attacker-used) hash in memory. Forged tickets signed with
  the original attacker-used hash are now invalid.

  Timing: wait 10 hours between resets (default max TGT lifetime)
  OR reset twice in close succession to force all DCs to cycle through
  their cached hash state. The 10-hour wait is safer for operational
  continuity; rapid double-reset is appropriate when the incident
  is severe and operational disruption is acceptable.

  IMPORTANT: a single KRBTGT reset is insufficient. This is the
  single most common AD containment mistake in IR.

MFA vs Password Reset: Which Matters More

During an incident where credentials are compromised, the question often arises: is it sufficient to reset the password, or is MFA also required? The answer depends on what was compromised and what authentication methods the attacker has access to.

ScenarioPassword reset sufficient?MFA action needed?
Attacker harvested NTLM password hashYes, if a new strong password is set (invalidates the old hash)Not specifically for the hash — but MFA prevents future use of any compromised password
Attacker harvested plaintext passwordYes — password reset invalidates the plaintext credentialSame as above
Attacker has active OAuth token / cookie sessionNo — password reset does NOT invalidate existing OAuth tokens or browser sessions by defaultMust revoke sessions explicitly (Entra ID: Revoke Sessions; Azure AD: Revoke refresh tokens)
Attacker has MFA push notification access (compromised device or phone number)Password reset alone is useless — attacker can approve MFA promptsMFA re-enrollment required: revoke existing MFA methods, require re-registration on a new device
Attacker performed pass-the-hash (using hash without cracking)Yes — resetting the password changes the NTLM hashN/A for this specific technique
Attacker has Kerberos TGT (passed-the-ticket)No — password reset does not invalidate existing Kerberos tickets (valid until lifetime expires, default 10 hours)KRBTGT reset required if golden ticket; account-specific ticket purge on DC if pass-the-ticket on a service account

Azure AD / Entra ID Token Revocation

Modern cloud identity is built on OAuth tokens: short-lived access tokens and long-lived refresh tokens. Resetting a password in Entra ID does not immediately revoke all existing tokens — the user's active sessions continue to function until the token lifetime expires. During IR, explicit session revocation is required.

  Azure AD / Entra ID Token Revocation Steps
  ══════════════════════════════════════════════════════════════════════

  REVOKE VIA ENTRA ID PORTAL:
  ─────────────────────────────────────────────────────────────────
  Users → [User] → Revoke Sessions
  Effect: invalidates all refresh tokens for that user immediately.
  Active access tokens (15–90 min lifetime) continue to work until
  they expire. Cannot be immediately revoked without changing
  Conditional Access policies.

  REVOKE VIA POWERSHELL (GRAPH API):
  ─────────────────────────────────────────────────────────────────
  Revoke-MgUserSignInSession -UserId 
  Effect: same as portal action — invalidates refresh tokens.

  FORCE IMMEDIATE RE-AUTHENTICATION:
  ─────────────────────────────────────────────────────────────────
  To force re-authentication before next access token expires,
  create a Conditional Access policy requiring re-authentication
  for the specific user or group during the incident window.
  This causes the next token refresh attempt to require interactive
  authentication — effectively ending the attacker's session within
  the access token lifetime.

  SERVICE PRINCIPAL CREDENTIAL ROTATION:
  ─────────────────────────────────────────────────────────────────
  If the compromised identity is a service principal (app registration),
  delete the existing client secrets and certificates, then rotate
  to new credentials. Existing tokens issued to the old credentials
  continue to function until expiry — the Conditional Access approach
  above does not apply to service principals. Plan for an expiry window
  when implementing service principal credential rotation.

  PRIVILEGED IDENTITY MANAGEMENT (PIM):
  ─────────────────────────────────────────────────────────────────
  If PIM is deployed, privileged role activations can be removed
  immediately from the PIM console without waiting for expiry.
  PIM is the fastest revocation path for Azure privileged access.

Service Account Rotation Challenges

Rotating a service account password is straightforward in principle: change the password in Active Directory. The operational complexity is that many services configured to use the service account will break when the password changes — they have the old password cached in their service configuration. Every application that uses the service account must have its stored credential updated simultaneously or within a short window after the password change.

Service typeWhere credential is storedHow to update after rotation
Windows ServicesService Control Manager (SCM) credential storeServices → Properties → Log On tab → update password; service must be restarted
Scheduled TasksTask Scheduler credential store per taskTask Scheduler → Properties → update "Run as" credential
IIS Application PoolsIIS configuration (applicationHost.config)IIS Manager → Application Pools → Advanced Settings → Identity
SQL Server service accountsSQL Server Configuration ManagerSQL Server Configuration Manager → Properties → update account password; SQL Server service restart required
Application config filesweb.config, app.config, custom config files (often hardcoded)Find all configuration files containing the service account name; update each; application restart required
Group Managed Service Accounts (gMSA)Password managed automatically by AD; no manual rotation neededgMSA passwords rotate automatically on the configured interval; no action needed during IR
Rotating service accounts without documenting all dependencies first causes self-inflicted outages

A poorly-managed service account rotation during an IR engagement caused a production application to go offline for 6 hours. The IR team rotated the application service account password in AD without knowing that it was also used as the "Run As" credential for 14 scheduled tasks across 6 servers. The application came back online within minutes when the IIS application pool was updated. But the scheduled tasks — which included data synchronization, report generation, and alerting jobs — all failed silently for the next 6 hours until the next monitoring cycle caught the failures. The fix: before rotating any service account, query AD for all locations where the account is configured as a service logon account, check scheduled task definitions across the domain for that account, and search configuration files for the account name. Then coordinate the rotation with application teams who own those services. During an IR, this coordination must happen quickly — but "quickly" is not "without coordination."

Q & A

How do you identify which user accounts authenticated on compromised hosts?

There are two primary sources. First, Windows Event Log on the compromised host: Event ID 4624 (Successful Logon) records every interactive and network logon to the host. Query these logs for the time window of the compromise. Each 4624 event contains the account name, account domain, and logon type (interactive=2, network=3, remote interactive/RDP=10). Second, the DC's Security event log: Event ID 4769 (Kerberos service ticket requested) records which accounts requested tickets for which services on which hosts — this shows remote authentication to the compromised host from other systems, revealing which accounts the attacker used to authenticate to the host from outside. The combination of local logon events (who logged into the compromised host) and remote logon events (which accounts were used to authenticate from the compromised host to other systems) provides the full scope of compromised credential paths.

Should you force password resets for all users in the domain, or only users confirmed to have authenticated on compromised hosts?

It depends on the scope and depth of the compromise. If the attacker had DC access or ran DCSync (which replicates all NTLM hashes from the domain), then all accounts in the domain should be treated as potentially compromised — a domain-wide password reset is appropriate. If the attacker's access was limited to specific hosts and credential dumping only affected hosts they compromised, then resetting accounts that authenticated on those specific hosts is sufficient. The domain-wide reset is operationally severe — it affects all employees simultaneously and requires significant IT coordination — but it provides a clean starting point for the domain's credential material. For organizations that have confirmed DC-level compromise, a domain-wide reset is the standard recommendation. The alternative is accepting the ongoing risk that the attacker's credential material covers accounts you didn't identify as part of the targeted dump.

What is a silver ticket attack and how does identity containment address it?

A silver ticket is a forged Kerberos service ticket (TGS), created using the NTLM hash of a service account rather than the KRBTGT hash. Where a golden ticket gives access to the entire domain by forging a TGT, a silver ticket gives access to a specific service by forging a service ticket for that service. If the attacker obtains the NTLM hash of the MSSQL service account for a specific server, they can forge service tickets for that SQL Server without communicating with a DC. Silver tickets are detected by DC-side ticket validation because the DC does not issue them — they are forged and presented directly to the service. Silver ticket forgery is contained by rotating the compromised service account's credentials, because the forged ticket was signed with the old NTLM hash and becomes invalid when the service account password changes. Unlike golden tickets, silver ticket containment does not require KRBTGT rotation — it requires rotation of the specific service account whose hash was used to forge the ticket.

In an environment without MFA, what priority should MFA deployment get during IR recovery?

MFA deployment during active IR recovery is high priority — but not at the cost of slowing credential rotation or extending attacker access. The sequence: complete credential rotation first (rotating to new passwords), then layer MFA deployment on top as the environment stabilizes. The operational challenge of emergency MFA deployment is enrollment: MFA requires each user to register a second factor, which requires helpdesk coordination and user communication. In a 5,000-person organization, this cannot be completed in 24 hours. A practical approach: deploy MFA immediately for all privileged accounts (Domain Admins, IT admins, service desk) — this is a small population that can be enrolled quickly. Extend to all remote access accounts (VPN, Citrix, cloud SSO) next, as these are the most common external attacker entry paths. Then roll out broadly to all users over days to weeks as part of the incident recovery. MFA for privileged accounts is the highest-value deployment and should happen during the incident response timeline, not after.

After completing identity containment, how do you verify that no compromised credentials remain active?

Verification is done through monitoring, not exhaustive checking. After rotating all identified compromised credentials: enable alerting for any authentication event using the old credentials (if your SIEM supports it — create a watch list of old credential hashes or the specific accounts, and alert on any successful authentication using those). Monitor for anomalous authentication patterns from accounts that were just rotated — if a newly-rotated account immediately authenticates from an unusual location or time, the attacker may be using a backup credential you missed. Query EDR for credential access events (new LSASS reads, new credential dump artifacts) after rotation is complete — if the attacker is still present on a host and tries to dump credentials again, the EDR will detect it. Watch for new account creation events in Active Directory (Event ID 4720) — attacker fallback to creating new accounts when their harvested accounts are rotated. The goal is not absolute certainty (which is impossible) but a monitored environment where re-intrusion via identity would be quickly detected.