The most expensive moment in many incidents is not the first compromise but the second one, when a system declared clean goes back on the network and the attacker walks straight back in. Reinfection usually comes from something nobody re-validated: a service account password left unchanged, a scheduled task on a host that was "only remediated", a backup that already held the implant, or a Kerberos key that still signs forged tickets. This guide sets out validation criteria an incident lead can apply before reconnecting systems after a compromise: when to rebuild instead of remediate, what evidence each criterion needs, how to reset human and non-human credentials in the right order, and how to reconnect in stages with a monitoring window. It is for incident response leads, infrastructure managers and the people who sign off recovery. No set of checks proves a system is clean; the aim is a documented, defensible decision that the residual risk is acceptable.
Key takeaways
- "Clean" is a risk decision, not a fact. Declare a system fit to reconnect against written criteria, with named sign-off and a monitoring window, never on the absence of alerts alone.
- Rebuild by default for anything privileged. Domain controllers, identity servers, hypervisors and management tools that the attacker touched should be rebuilt from trusted media, not cleaned in place.
- Credentials outlive malware. Every password, key, token and certificate the attacker could have read must be rotated, including service accounts and API keys, and the krbtgt password reset twice where Active Directory was in scope.
- Order matters. Rotate after the attacker is evicted and the identity source is trusted again; rotating earlier hands the new secrets to the same intruder.
- Reconnect in stages. Bring systems back in rings behind tightened network rules, with enhanced monitoring for a defined period, and a rollback trigger agreed in advance.
Why clean declarations fail
The NCSC's recovery guidance for disruptive attacks is blunt: if you are not sure the attacker has gone, proceeding with recovery carries a risk of the incident restarting. It advises assuming the attacker may have reached more than you have confirmed, treating backups as possibly targeted, and not assuming that backups or identity systems are trustworthy until assured. The common failure routes are:
- Scope too narrow: only the hosts with alerts are cleaned, while the attacker holds valid accounts (ATT&CK T1078 Valid Accounts) that work from anywhere.
- Persistence missed: web shells (T1505.003), scheduled tasks (T1053) or added credentials on accounts and applications (T1098 Account Manipulation) survive an antivirus clean.
- Credentials left unrotated: in the Cloudflare Thanksgiving breach, one service token and three service account credentials exposed in an earlier supplier breach were not rotated because they were believed to be unused, and an attacker used them. Cloudflare's remediation then rotated more than 5,000 production credentials and reimaged every machine in its global network. See the Incomplete rotation breaches page.
- Forged authentication survives: an attacker with the krbtgt hash can mint Kerberos tickets (T1558.001 Golden Ticket) until that key is changed twice.
- Infected backups: restores reintroduce the implant because nobody checked the restore point. See the Last Clean Restore Point Guide.
- Pressure to restore: the business needs systems back, so the criteria are relaxed quietly instead of formally accepting the risk.
Rebuild vs remediate
Remediation in place (removing artefacts and patching) is faster but relies on knowing every change the attacker made. Rebuilding from trusted media removes unknown persistence on that host but does nothing about stolen credentials or other hosts. CISA's ransomware response checklist advises rebuilding systems in order of critical services, using pre-configured standard images where possible, and taking care not to reinfect clean systems during recovery.
| System type | Default approach | When the alternative is acceptable |
|---|---|---|
| Domain controllers, identity providers, PKI servers | Rebuild, or forest recovery from a validated backup | Rarely; only with high confidence the system was never reached and logs cover the whole dwell time |
| Hypervisors, backup servers, management and deployment tools | Rebuild from vendor media and reapply hardened configuration | Never where the attacker held administrative access to them |
| Servers with confirmed implant or attacker tooling | Rebuild from a golden image and redeploy the application from source control | Remediate only where forensic analysis has a complete timeline and the host is low privilege |
| Workstations | Reimage | Remediate where only commodity malware was found with no hands-on activity |
| Cloud workloads and containers | Redeploy from pipeline with new images and new identities | Rarely sensible to clean a running instance |
| SaaS tenants | Cannot rebuild: review configuration, apps, consents and admin roles against a baseline | Not applicable |
Decision guidance: a small organisation with one site may find a full rebuild of everything faster than an investigation. A large estate usually rebuilds tier 0 and confirmed hosts, remediates the rest on evidence, and accepts a longer monitoring window. Where the dwell time is unknown or logs do not cover it, lean to rebuild. For recovery in a separate environment, see the Cloud Recovery and Clean Room Guide; for the differences between stages see Containment vs Eradication.
Validation criteria
Apply the criteria per system or per system group. Each one needs evidence that a reviewer other than the person doing the work can check.
| Criterion | What must be true | Evidence to keep |
|---|---|---|
| Scope confirmed | Investigation has identified initial access, accounts used and systems reached, and the investigation lead advises the risk is low enough to proceed | Timeline, list of affected identities and hosts, investigation lead's written advice |
| Trusted build source | Rebuilt systems come from a golden image or vendor media verified by hash, held offline or in a protected repository | Image ID, hash, build record |
| Restore point validated | Backup predates the earliest attacker activity and has been scanned and tested in isolation | Restore point date, scan results, test restore record |
| IOC sweep clean | All known indicators (hashes, domains, IPs, file paths, registry keys, scheduled tasks, services) swept across the whole estate, not only the rebuilt host | Sweep query, coverage percentage, results |
| Persistence review | Autoruns, services, scheduled tasks, web roots, startup scripts, Group Policy objects, cloud functions and OAuth apps compared with a baseline | Diff against baseline, reviewer sign-off |
| Initial access closed | The vulnerability, misconfiguration or exposed credential used to get in is fixed and verified | Patch record or configuration change, rescan |
| Credentials rotated | Every credential in scope rotated in the order set out below, including non-human identities | Rotation register with times and owners |
| Hardening applied | Build meets the current baseline, with local admin, remote access and logging settings as required | Configuration scan result |
| Logging and detection live | Endpoint detection agent installed and reporting, logs forwarded, new detections for this attacker's behaviour deployed | Agent health report, sample events in the SIEM |
| Rollback ready | Isolation procedure tested for each ring before reconnection | Test record |
An IOC sweep only finds what is already known. Add a time-boxed hunt for the attacker's techniques rather than artefacts; see the Compromise Assessment Guide and the Identity Threat Hunting Guide. For rebuild baselines see the Server Build and Golden Image Hardening Guide.
Identity and credential reset before reconnection
The NCSC advises re-establishing a trusted identity source first, because everything else depends on it, and resetting credentials where required, including privileged accounts. Rotation is wasted if the attacker still has a foothold, so sequence it after eviction and before reconnection.
- Secure the identity tier. Rebuild or recover domain controllers and the identity provider, remove attacker-created accounts, federation trusts, application credentials and role assignments.
- Reset krbtgt twice. Microsoft's forest recovery guidance says to reset the krbtgt password twice and wait 10 hours between resets, because 10 hours is the default maximum user and service ticket lifetime; if those policies are longer, wait longer than the configured value. The account keeps a password history of two, so the second reset clears the old key. The procedure applies to writable domain controllers; read-only domain controllers have their own krbtgt_<number> accounts. See the krbtgt account guide.
- Privileged human accounts. Reset administrator passwords, remove and re-register MFA methods, and revoke sessions. In Microsoft Entra ID, Revoke-MgUserSignInSession revokes refresh tokens, but issued access tokens remain valid until expiry (one hour by default), and application session cookies must be revoked by each application. Microsoft notes that resetting an on-premises password twice mitigates pass-the-hash risk where replication is delayed.
- Non-human identities. Rotate service account passwords, API keys, cloud access keys, OAuth client secrets, SSH keys, signing keys and certificates that were stored on or reachable from affected systems. Check vaults, CI/CD variables, configuration files and scripts. Unknown owners are not a reason to skip a credential: an unused credential should be disabled.
- Standard users. Force password changes and session revocation for affected populations, at minimum.
- Third parties. Rotate credentials shared with suppliers and ask them to rotate theirs where they connect to you.
Expect breakage: rotated service account passwords stop applications that hard-code them. Plan rotation windows with application owners and use the Credential Rotation at Scale and Workload Identity Compromise Response Playbook pages. For the human side, see the Identity Incident Response Playbook.
Staged reconnection and monitoring
The NCSC advises balancing the pace of restoration against the assurance needed, bringing core functions back in a controlled manner, and notes that third parties may require evidence of remediation before restoring connectivity. A practical sequence:
- Ring 0, isolated validation: rebuilt identity and management systems run in a segregated network with only the connections they need. Confirm logging and detection work.
- Ring 1, critical services: reconnect the systems behind the organisation's minimum viable operations, with egress restricted to known destinations and new detections live. See the Minimum Viable Company and Critical Service Recovery Order Guide.
- Ring 2, wider internal estate: reconnect remaining servers and workstations in batches, each checked against the criteria table.
- Ring 3, external connectivity: restore partner, supplier and remote access links last, with fresh credentials and any evidence partners require.
Monitoring window: set an enhanced monitoring period before closing the incident, sized to the attacker's observed dwell time and the length of any tokens or tickets that might still be valid (our recommendation is at least 30 days for hands-on intrusions). Watch for sign-ins with rotated or disabled accounts, beaconing to known infrastructure, new persistence on rebuilt hosts and use of old API keys. Agree the rollback trigger in advance: any confirmed indicator on a reconnected host returns that ring to isolation.
| Metric | Target |
|---|---|
| Systems reconnected with all criteria evidenced | 100% (exceptions risk-accepted in writing) |
| In-scope credentials rotated or disabled, human and non-human | 100% before ring 1 |
| Endpoint and log coverage on reconnected systems | 100% reporting within 24 hours of reconnection |
| Failed authentications using rotated or disabled credentials | Every event investigated; a rising trend triggers review |
| Reinfection events during the monitoring window | Zero; any event reopens the incident |
Sign-off and evidence
CISA's checklist says the designated IT or security authority declares the incident over based on established criteria, and NIST CSF 2.0 outcome RC.RP-06 calls for the end of recovery to be declared based on criteria with documentation completed. Write the criteria before the incident and record decisions against them.
| Role | Signs off |
|---|---|
| Investigation lead | Scope, eviction confidence and residual unknowns |
| System owner | Rebuild or remediation complete, functional testing passed |
| Identity owner | Identity tier trusted, credential rotation register complete |
| Security operations lead | Detection and logging live, monitoring window plan |
| Incident lead | Each reconnection ring, against the criteria |
| Senior risk owner | Any criterion not met, accepted in writing with an expiry date |
Keep the evidence pack with the incident record: criteria table per system group, rotation register, sweep and hunt results, reconnection log and the risk acceptances. Wording matters: record "no evidence of continued attacker activity based on the checks listed" rather than "system is clean". Feed findings into the Post-Incident Review and Root Cause Analysis Template.
| Activity | NIST CSF 2.0 | NIST SP 800-53 Rev. 5 | CIS Controls v8.1 |
|---|---|---|---|
| Eradication and persistence removal | RS.MI-02 | IR-4 | Control 17 |
| Restore point and image validation | RC.RP-03 | CP-10, SI-7 | Control 11 |
| Credential rotation | RS.MI-02 | IA-5 | Control 5 |
| Verify restored assets and confirm status | RC.RP-05 | CP-10 | Control 11 |
| Monitoring window | DE.CM-01 | SI-4 | Control 13 |
| Declare end of recovery | RC.RP-06 | IR-4 | Control 17 |
Practitioner checklist
- Write reconnection criteria and sign-off roles into the incident response plan before an incident.
- Get the investigation lead's written advice on eviction confidence before any reconnection.
- Rebuild identity, management, backup and virtualisation systems the attacker reached; do not clean them in place.
- Validate golden images and restore points by hash, date and isolated scan before use.
- Sweep the whole estate for indicators and run a technique-based hunt, not only the rebuilt hosts.
- Reset krbtgt twice with the ticket lifetime wait between resets where Active Directory was in scope.
- Rotate or disable every in-scope credential, including service accounts, API keys, OAuth secrets and certificates, and keep a register.
- Reconnect in rings with restricted egress, new detections and a tested rollback.
- Hold an enhanced monitoring window and reopen the incident on any reinfection signal.
- Record decisions as risk statements with evidence, never as a guarantee that systems are clean.
Standards and references
- NIST: SP 800-61 Rev. 3 Incident Response Recommendations and Considerations for Cybersecurity Risk Management
- NCSC: Recovery during ongoing investigations
- NCSC: Rebuild
- CISA: #StopRansomware Guide
- Microsoft Learn: AD Forest Recovery, Reset the krbtgt password
- Microsoft Learn: Revoke user access in Microsoft Entra ID
- NCSC: Mitigating malware and ransomware attacks
Related NHI Mgmt Group resources: Active Directory Forest Recovery Runbook Template · Identity Recovery Guide · Secret Rotation vs Revocation · MITRE D3FEND Credential Eviction Implementation Guide