Backing Up and Recovering Active Directory
Ransomware operators who reach Domain Admins don't stop at encrypting file servers. They encrypt or wipe the domain controllers, delete the backups they can reach, and leave the organisation with no identity system at all: nobody can sign in to anything, including the backup console. At that point the only question is whether a clean, restorable copy of AD exists somewhere the attacker couldn't touch, and whether anyone has practised restoring it. Recovery is also the last step of every serious AD incident in this course: after a DCSync or a golden ticket you rebuild trust in the directory, sometimes from backup. This lesson covers what to back up, the rules that make a backup usable, how backups are attacked, and how a forest is recovered.
What to back up
- System state of at least two DCs per domain (it contains NTDS.dit, SYSVOL, the registry and the boot files), taken with Windows Server Backup (
wbadmin start systemstatebackup) or an AD-aware backup product. Since all writable DCs hold the same data, two per domain is enough for the directory; more helps only with site recovery. - AD CS: the CA database and, above all, the CA private key (with its password), stored offline. A restored AD without its PKI breaks smart cards, Wi-Fi and VPN.
- Configuration you can't regenerate: GPO backups (
Backup-GPO -All), DNS zones if not AD-integrated, Entra Connect configuration, documentation of trusts, sites and FSMO placement. - The DSRM password of each DC (Directory Services Restore Mode, needed for authoritative restores), managed by Windows LAPS or a vault.
The rules that make a backup usable
| Rule | Why |
|---|---|
younger than the tombstone lifetime (180 days by default for forests created since Windows Server 2003 SP1; check tombstoneLifetime on the Directory Service object) |
a DC restored from an older backup reintroduces objects the others already purged ("lingering objects") and is refused by replication |
| taken from a supported mechanism (system-state backup, or a VM snapshot only on hypervisors with VM-GenerationID support) | restoring a plain disk image without it causes USN rollback: the DC reuses update numbers and silently stops replicating correctly |
| offline or immutable copies exist | an attacker with Domain Admins or backup-console access deletes online backups first |
| known to be clean | a backup taken after the compromise restores the attacker's accounts, ACEs and persistence |
| tested by a restore into an isolated network | many organisations discover during the incident that their backups lacked SYSVOL or the CA key |
The program checks a synthetic backup catalogue against these rules for an incident whose earliest known compromise was on 2026-10-02.
import pandas as pd
today = pd.Timestamp("2026-11-15")
tombstone_days = 180
first_compromise = pd.Timestamp("2026-10-02") # earliest attacker activity found
backups = pd.DataFrame([
("DC01", "system state", "2026-11-14", "online", True),
("DC01", "system state", "2026-09-28", "immutable", True),
("DC02", "system state", "2026-09-20", "offline tape", True),
("DC01", "VM snapshot (no VM-GenID)", "2026-09-25", "online", False),
("DC02", "system state", "2026-04-01", "offline tape", True),
("CA01", "CA database + key", "2026-09-01", "offline", True),
], columns=["host", "kind", "taken", "storage", "supported"])
backups["taken"] = pd.to_datetime(backups["taken"])
backups["age"] = (today - backups["taken"]).dt.days
def verdict(b):
if not b.supported: return "UNUSABLE: snapshot without VM-GenerationID support (USN rollback risk)"
if b.age > tombstone_days: return f"UNUSABLE: {b.age} days old, beyond the {tombstone_days}-day tombstone lifetime"
if b.taken >= first_compromise: return "SUSPECT: taken after the first known compromise"
if b.storage == "online": return "usable but reachable by the attacker: verify integrity first"
return "CANDIDATE: before the compromise, protected storage"
backups["verdict"] = backups.apply(verdict, axis=1)
for b in backups.itertuples():
print(f"{b.host:5} {b.kind:27} {b.taken:%Y-%m-%d} {b.storage:13} {b.verdict}")
best = backups[backups.verdict.str.startswith("CANDIDATE") & backups.host.str.startswith("DC")].sort_values("taken").iloc[-1]
lost = (today - best.taken).days
print(f"\nrestore candidate: {best.host} from {best.taken:%Y-%m-%d}; "
f"{lost} days of directory changes must be re-applied or accepted as lost")DC01 system state 2026-11-14 online SUSPECT: taken after the first known compromise
DC01 system state 2026-09-28 immutable CANDIDATE: before the compromise, protected storage
DC02 system state 2026-09-20 offline tape CANDIDATE: before the compromise, protected storage
DC01 VM snapshot (no VM-GenID) 2026-09-25 online UNUSABLE: snapshot without VM-GenerationID support (USN rollback risk)
DC02 system state 2026-04-01 offline tape UNUSABLE: 228 days old, beyond the 180-day tombstone lifetime
CA01 CA database + key 2026-09-01 offline CANDIDATE: before the compromise, protected storage
restore candidate: DC01 from 2026-09-28; 48 days of directory changes must be re-applied or accepted as lost
Yesterday's backup is the newest and the most dangerous: it contains whatever the attacker changed since October. The September system-state backups predate the compromise and sit on protected storage, so they are the starting point. The snapshot is unusable whatever its date, and the April backup has passed the tombstone lifetime. The CA backup is a candidate too, but if the CA key may have been taken (the CA is Tier 0 and was reachable), a new CA hierarchy may be needed anyway.
How backups are attacked, and how that is detected
- Deleting or encrypting backups through the backup console with stolen admin credentials, or with
wbadmin delete/vssadmin delete shadowson servers: alert on 4688 for those commands, on backup-job failures and on mass deletions in the backup system's own log. - Stealing backups: a DC backup contains NTDS.dit, so whoever reads it has every key (offline DCSync). Backup servers and their storage are Tier 0; access to backup shares shows up as 5140/5145.
- Poisoning: an attacker who stays long enough makes every backup contain their persistence; hence the need to know when the compromise began and to keep older copies.
Restore types
- Non-authoritative restore of one DC: the DC comes back from backup and then accepts all newer changes from its partners. Used when a single DC failed.
- Authoritative restore (in DSRM,
ntdsutil→authoritative restore): restored objects get their version numbers raised so they win against the partners. Used to bring back deleted OUs or objects when the AD Recycle Bin (enable it: forest functional level 2008 R2 or later) can't. - Forest recovery: every DC is lost or untrusted. Microsoft's Active Directory Forest Recovery Guide describes it: restore one DC per domain from a clean backup in an isolated network, seize FSMO roles, clean metadata of all other DCs, reset
krbtgttwice, reset the computer account and trust passwords, raise the RID pool, then build new DCs by promotion (not by restore) and reconnect clients gradually. Practise it in a lab with the lab domain before you ever need it.
After an intrusion: the clean-up order
- Contain: isolate compromised hosts, disable the attacker's accounts and footholds.
- Decide: in-place remediation (enough when the compromise is understood and Tier 0 was not fully owned) or forest recovery (when DCs or backups can't be trusted).
- Remove persistence in the directory: unexpected admins, ACEs, SID history, delegation settings, GPO changes, AD CS templates and certificates, using the audit routines of Auditing ACLs and AD CS.
- Reset secrets:
krbtgttwice, Tier 0 and service accounts, computer accounts of compromised servers, trust keys; revoke certificates. - Rebuild trust: apply the hardening of this section, then monitor closely for the attacker's return.
Pitfalls
- Backups only online and domain-joined, administered by the same accounts the attacker now has.
- No recent restore test, or a test that never included SYSVOL, DNS and the CA.
- Restoring the newest backup without asking when the compromise started.
- Restoring DC snapshots on platforms without VM-GenerationID support.
Practice
1. Why is a system-state backup from 200 days ago unusable with the default tombstone lifetime?
Objects deleted more than 180 days ago have been purged from the other DCs; the old backup still contains them. A DC restored from it would reintroduce lingering objects, so the restore is unsupported and replication would reject it.
2. In the program, change first_compromise to 2026-09-15. What is the restore candidate now?
None of the DC backups qualifies: the 2026-09-20 and 2026-09-28 backups become "SUSPECT" and the April one is beyond the tombstone lifetime, so iloc[-1] fails on an empty selection. That is the forest-recovery worst case: rebuild without a clean backup, which is why keeping protected backups for longer than your likely detection time matters.
3. Which two steps of forest recovery make tickets forged with the old krbtgt key useless?
The two krbtgt resets (separated as described in Golden and Silver Tickets; during a forest recovery they are done on the single restored DC before other DCs exist).
Test yourself
What is the default tombstone lifetime for forests created on Windows Server 2003 SP1 or later?
- 30 days
- 60 days
- 180 days
- 1 year
Why are DC backups Tier 0?
- They are large
- They contain NTDS.dit with every account's keys, so reading one equals DCSync
- They contain only logs
- They are always encrypted
What is an authoritative restore used for?
- Restoring one failed DC
- Making restored objects (e.g. an accidentally deleted OU) win over the partners' newer state
- Changing FSMO roles
- Resetting krbtgt
In a forest recovery, how are the additional DCs created?
- Each restored from its own backup
- By promoting new DCs from the first restored, cleaned DC
- By copying VM snapshots
- They aren't needed