Free Reference

DFIR Investigation Runbooks

13 incident types. Every step with its query or command.

Step-by-step runbooks for the incidents responders handle most often: what to do in the first 15 minutes, the steps in order with what to expect and what to decide, the evidence to keep, containment, verification and the handoff. No account needed.

13 runbooks for the incidents analysts and responders handle most often, from the first alert to the handoff. Each one is a sequence of steps with the exact query or command, what you should expect to see, and the decision it leads to, for Microsoft 365, Entra ID, Defender XDR, Active Directory, Azure, AWS and Linux. The decisions behind them, and the process around them, are in the Incident Response reference.

How to use a runbook

Read the first 15 minutes before running anything. Then work the steps in order: each one narrows the scope, and the decision at the end of a step tells you whether to continue, branch to another runbook, or close. Replace the example values (accounts, addresses, hosts, times) with yours. Every query sets its own time window; widen it if the first attacker activity is older.

SectionWhat it gives you
Starts withThe alerts or reports that should open this runbook.
First 15 minutesWhat to do before the first query: ownership, preservation, the one call that cannot wait.
StepsIn order. Each has a query or command, what you should expect to see, and the decision it leads to.
Evidence to secureWhat to keep, where it is, and how to collect it, before containment changes it.
ContainThe exact actions, and what each one does not do.
VerifyThe query that proves containment held.
Common mistakesWhat goes wrong most often on this incident type.
Hand offWhat the next team needs from you, in writing.

When to escalate

Escalate to the incident commander whenWhy
A privileged account (domain, cloud or Azure admin) is involvedThe scope is the whole estate, not one host
More than one account or host is confirmed compromisedIt is a campaign, and needs coordination
Data may have left, or personal data was readNotification clocks may have started; legal must know
Encryption, destruction or a payment is in progressBusiness decisions are needed now
You need to take a service offline to contain itThat is a business decision, not an analyst one

Evidence in brief

  • Capture before you contain: isolation ends running processes and connections, and purges remove the copies you need.
  • Keep a hash of every file you collect, and a record of who collected it, when and how.
  • Export cloud logs early; each source has its own retention limit.
  • Work on copies. Never analyze the only copy of an item.
  • The full chain-of-custody fields and legal hold are in the Incident Response reference.

The handoff template

Every runbook ends in a handoff. These are the fields to fill, whoever receives it.

FieldContents
SummaryWhat happened, in two sentences, and whether it is contained
ScopeAccounts, hosts, mailboxes, applications and cloud resources, each with how it was established
TimelineFirst attacker activity to containment, in UTC, each line with its source
IndicatorsAddresses, domains, hashes, session IDs, application IDs, access key IDs
Actions takenEach containment and eradication step, with the time and who did it
EvidenceEach item, where it is stored, and its hash
Open questionsWhat is not yet known, and what would answer it
RecommendationsThe control or detection gap that let it happen

Which runbook?

If you haveStart with
A risky sign-in, an impossible-travel or AiTM alert01 Identity compromise
Lockouts or failed sign-ins across many accounts02 Password spray
An application you do not recognize with mail or file access03 OAuth app
Changed bank details, or an invoice nobody sent04 Business email compromise
A reported message, or a malicious URL click05 Phishing campaign
An endpoint alert or antivirus detection06 Malware on an endpoint
Remote execution, PsExec, WMI, WinRM or RDP from an odd source07 Lateral movement
Kerberoasting, DCSync, or a privileged group change08 AD privilege escalation
Renamed or encrypted files, a ransom note, shadow copies deleted09 Ransomware
A large download, outside sharing, a departing employee10 Exfiltration and insider
An Azure role you did not grant, or compute you did not create11 Azure subscription
An exposed or misused AWS access key12 AWS access key
An alert on a Linux server, an unknown SSH login13 Linux server

The pivots the runbooks share

Most steps are a pivot from one indicator to the others. The same few pivots appear across the runbooks; learning them once makes every runbook faster.

IndicatorPivot toRunbooks that use it
IP addressSign-ins for every account; network events for every device; CloudTrail and AzureActivity callers01, 02, 06, 11, 12
Session IDEvery address the session was used from01
AccountIts sign-ins, mailbox changes, directory changes, device logons01, 04, 07, 08, 10
HostLogons to and from it, process tree, network connections, persistence06, 07, 09, 13
File hashEvery device where it was written or run, every message that carried it05, 06
Message IDEvery recipient and click04, 05
Application IDConsents, grants, its own sign-ins and activity03
Access key IDEvery API call, every resource it created12

The runbooks

#RunbookSeverity
01Identity compromise: AiTM phishing and token theftHigh
02Password spray and brute forceMedium
03Malicious OAuth app or consent grantHigh
04Business email compromise and payment fraudHigh
05Phishing campaign: scope, purge and containMedium
06Malware on an endpointHigh
07Lateral movementHigh
08Active Directory privilege escalation: Kerberoasting, DCSync, privileged groupsCritical
09Ransomware, before and after encryptionCritical
10Data exfiltration and insider casesHigh
11Azure subscription compromiseCritical
12AWS access key compromiseCritical
13Linux server compromise: SSH and web serverHigh
01Identity compromise: AiTM phishing and token theftHigh

Starts with: an Entra ID Protection risky sign-in, a Defender XDR "suspicious session" or AiTM alert, or a user reporting a login page that looked wrong.

T1557 Adversary-in-the-MiddleT1550.004 Web Session CookieT1078.004 Cloud Accounts

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • Name an owner and start the log with the alert time and the account.
  • Do not reset the password yet. Find out what else the attacker added first, or you will reset around it.
  • Note the suspicious sign-in's IP address, session ID and time; they are the pivots for every step below.
  • Ask the user, by phone, whether they signed in at that time and from where.

Steps

1Confirm the sign-in was not the user

Pull the account's successful sign-ins for the last 14 days and compare the suspicious one with the rest: address, country, device, browser and how MFA was satisfied.

// Successful sign-ins for one account, newest first let upn = "compromised.user@yourdomain.com"; SigninLogs | where TimeGenerated > ago(14d) | where UserPrincipalName =~ upn and ResultType == "0" | project TimeGenerated, IPAddress, Location, AppDisplayName, ClientAppUsed, DeviceDetail, AuthenticationRequirement, SessionId, RiskLevelDuringSignIn | sort by TimeGenerated desc

Expect: the attacker's sign-in from an address and device the user does not use, often minutes after a click on a phishing link, with MFA shown as satisfied.

Decide: one unfamiliar sign-in the user confirms was them (travel, a new phone): close as benign and record why. Otherwise treat the account as compromised and continue.

2Find every session the attacker used

AiTM phishing steals the session cookie, so the same SessionId appears from the attacker's address. Look for sessions used from more than one address or country.

let upn = "compromised.user@yourdomain.com"; SigninLogs | where TimeGenerated > ago(14d) | where UserPrincipalName =~ upn and isnotempty(SessionId) | summarize IPs = make_set(IPAddress, 20), Countries = dcount(Location), First = min(TimeGenerated), Last = max(TimeGenerated) by SessionId | where array_length(IPs) > 1

Expect: a session that starts at the user's address and continues from the attacker's.

Decide: if the attacker's address appears, pivot on it across all accounts in step 3.

3Pivot the attacker's address across the tenant

Phishing campaigns rarely catch one person. Every account with a successful sign-in from the same address is in scope.

let badIP = "203.0.113.42"; SigninLogs | where TimeGenerated > ago(14d) | where IPAddress == badIP and ResultType == "0" | summarize SignIns = count(), Apps = make_set(AppDisplayName, 10), First = min(TimeGenerated) by UserPrincipalName

Expect: one row per compromised account.

Decide: run this runbook for each account found, in parallel if there are several.

4List what the attacker added that survives a reset

MFA methods, consents, devices and role changes made by or for the account since the first bad sign-in.

let upn = "compromised.user@yourdomain.com"; let since = datetime(2026-03-14T08:00:00Z); // first attacker sign-in AuditLogs | where TimeGenerated > since | where tostring(InitiatedBy.user.userPrincipalName) =~ upn or tostring(TargetResources) has upn | project TimeGenerated, OperationName, Result, Target = tostring(TargetResources[0].displayName) | sort by TimeGenerated asc

Expect: entries such as "User registered security info", "Consent to application", or "Add registered owner to device".

Decide: each entry becomes an eradication item. A role or app change means escalating to runbook 3 or 11.

5Check the mailbox for rules and forwarding

Inbox rules and forwarding keep working after a password reset, and they are the usual first move after an AiTM sign-in.

let upn = "compromised.user@yourdomain.com"; OfficeActivity | where TimeGenerated > ago(14d) | where UserId =~ upn | where Operation in ("New-InboxRule", "Set-InboxRule", "UpdateInboxRules", "Set-Mailbox") | project TimeGenerated, Operation, ClientIP, Parameters

Expect: a rule that moves or deletes mail, or forwarding to an outside address.

Decide: any rule that hides mail about payments or invoices: also run runbook 4.

Evidence to secure

EvidenceWhere it isHow to collect it
Sign-in records for the accountEntra ID sign-in logs (30 days on P1 and P2)Export from the portal, or keep the query results
Audit records for the accountUnified audit logSearch-UnifiedAuditLog with a session ID, to CSV
Inbox rules and forwarding as foundExchange OnlineGet-InboxRule and Get-Mailbox, to CSV, before removing anything
The phishing messageThe user's mailboxOne copy as an .eml with headers
The attacker's registered methods and devicesEntra IDGet-MgUserAuthenticationMethod and Get-MgUserRegisteredDevice output

Contain

Disable the account, revoke its sessions and disable its devices. Access tokens already issued stay valid until they expire, one hour by default, unless the application supports Continuous Access Evaluation.

Connect-MgGraph -Scopes 'User.ReadWrite.All','Directory.AccessAsUser.All' $u = Get-MgUser -UserId 'compromised.user@yourdomain.com' Update-MgUser -UserId $u.Id -AccountEnabled:$false Revoke-MgUserSignInSession -UserId $u.Id Get-MgUserRegisteredDevice -UserId $u.Id -All | ForEach-Object { Update-MgDevice -DeviceId $_.Id -AccountEnabled:$false }

Then list the authentication methods and remove the ones the user did not register:

Get-MgUserAuthenticationMethod -UserId $u.Id | Select-Object Id, @{ n = 'Type'; e = { $_.AdditionalProperties['@odata.type'] } } Get-MgUserAuthenticationMicrosoftAuthenticatorMethod -UserId $u.Id | Select-Object Id, DisplayName, DeviceTag, CreatedDateTime Remove-MgUserAuthenticationMicrosoftAuthenticatorMethod -UserId $u.Id ` -MicrosoftAuthenticatorAuthenticationMethodId 'Id from the list'

Remove the inbox rules and consents found in steps 4 and 5, after exporting them. Then reset the password and re-enable the account with the user present to re-register MFA.

Verify

// Any successful sign-in after containment means it did not hold let upn = "compromised.user@yourdomain.com"; let containedAt = datetime(2026-03-15T09:30:00Z); SigninLogs | where TimeGenerated > containedAt | where UserPrincipalName =~ upn and ResultType == "0" | project TimeGenerated, IPAddress, AppDisplayName, ClientAppUsed

Re-run step 4 the next day: no new methods, consents or devices.

Common mistakes

  • Resetting the password and stopping. The stolen session and the attacker's MFA method both survive a reset.
  • Re-enabling before the persistence check in step 4.
  • Investigating only the account that alerted, when step 3 would have found the others.
  • Deleting the phishing message before keeping a copy.
Worked example

A risky sign-in alert fires for a finance user at 08:14. The user, called on their mobile, says they opened a DocuSign link at 08:12 and signed in, but has not used the account since. Step 1 shows the 08:14 sign-in from a hosting provider in another country with MFA satisfied; step 2 shows the same session ID used from the user's home address at 08:12 and the hosting address from 08:14. Step 3 finds two more accounts signed in from that address in the same hour. Step 4 finds a new authenticator app registered at 08:20; step 5 finds an inbox rule moving mail from the accounts payable team to RSS Feeds. Three accounts are contained together, the rule and the authenticator are removed after export, and runbook 4 opens for the finance mailbox.

Before you close

  • Do you know every account the attacker signed in to, and why you are sure there are no others?
  • Is every item the attacker added removed, and was each one exported first?
  • Has legal been told whether mail or files were read?

Hand off

  • Accounts in scope, with the first attacker sign-in time for each.
  • Attacker addresses and session IDs.
  • Every item removed (rules, methods, consents, devices), with the export file for each.
  • Whether mail or files were read: this decides the notification question for legal.
  • The gap that let it happen (no phishing-resistant MFA, no token protection) as a recommendation.
02Password spray and brute forceMedium

Starts with: a spray alert from Entra ID Protection or Defender for Identity, account lockouts across many users, or a SIEM rule on failed sign-ins.

T1110.003 Password SprayingT1110.001 Password Guessing

First 15 minutes

  • Find out whether any account succeeded. A spray with no success is a tuning and blocking job; a spray with a success is an identity compromise.
  • Note the source addresses and the time window.
  • Check whether lockouts are hurting the business; if so, tell the service desk what is happening.

Steps

1Size the spray in Entra ID

Error 50126 is a wrong username or password; 50053 is a locked account. Count accounts per source address.

SigninLogs | where TimeGenerated > ago(1d) | where ResultType in ("50126", "50053") | summarize Accounts = dcount(UserPrincipalName), Failures = count(), First = min(TimeGenerated), Last = max(TimeGenerated) by IPAddress, AppDisplayName, ClientAppUsed | where Accounts >= 10 | order by Accounts desc

Expect: a few addresses failing against many accounts, often through legacy protocols or a single application.

Decide: none above your threshold: probably a single user with a cached old password. Close.

2Find any success from the same addresses

This is the step that matters.

let spray = SigninLogs | where TimeGenerated > ago(1d) | where ResultType in ("50126", "50053") | summarize Accounts = dcount(UserPrincipalName) by IPAddress | where Accounts >= 10; SigninLogs | where TimeGenerated > ago(1d) | where ResultType == "0" | join kind=inner spray on IPAddress | project TimeGenerated, UserPrincipalName, IPAddress, AppDisplayName, AuthenticationRequirement

Expect: nothing, ideally. A success with AuthenticationRequirement singleFactorAuthentication is a password working alone.

Decide: any success: run runbook 1 for that account.

3Size the spray against on-premises AD

Defender for Identity sees authentication on domain controllers, where Entra ID logs do not reach.

IdentityLogonEvents | where Timestamp > ago(1d) | where ActionType == "LogonFailed" | summarize Accounts = dcount(AccountUpn), Failures = count() by IPAddress, DeviceName, Protocol | where Accounts >= 10

Expect: a workstation or server address failing against many accounts over NTLM or Kerberos.

Decide: an internal source is a compromised host: run runbook 6 on it.

4Find the internal source host and what is running the spray

For a domain controller's 4771 or 4776 failures, the source workstation is in the event. On that host, find the process making the connections.

let src = "ws-fin-042"; DeviceNetworkEvents | where Timestamp > ago(1d) | where DeviceName =~ src and RemotePort in (88, 389, 445, 636) | summarize Connections = count(), Targets = dcount(RemoteIP) by InitiatingProcessFileName, InitiatingProcessCommandLine | order by Connections desc

Expect: one process with thousands of connections to domain controllers.

Decide: contain the host (runbook 6).

Evidence to secure

EvidenceWhere it isHow to collect it
Failed and successful sign-ins for the windowEntra ID sign-in logsQuery results, exported
Domain controller failuresSecurity log on DCs (4771, 4776, 4625), Defender for IdentityIdentityLogonEvents query, or wevtutil epl on the DCs
The source host's process and network eventsDefender XDRInvestigation package if internal

Contain

Block the external addresses in Conditional Access (a named location set to block) or at the edge, if they are not shared infrastructure. Block legacy authentication if the spray used it.

For an internal source, isolate the host. For any account that succeeded, follow runbook 1.

Verify

Re-run step 1 an hour after blocking: the failures from those addresses should stop or show as blocked by Conditional Access.

Common mistakes

  • Watching only Entra ID when the spray targets on-premises AD, or the reverse.
  • Unlocking accounts in bulk while the spray is still running, so it can continue.
  • Stopping at "blocked" without checking for a success.
Worked example

Forty lockouts arrive at the service desk in an hour. Step 1 shows one address failing against 380 accounts through legacy authentication. Step 2 finds one success, a shared mailbox that had no MFA. Legacy authentication is blocked tenant-wide, the shared mailbox goes to runbook 1, and the 380 accounts are unlocked once the block is confirmed in step 1's rerun.

Before you close

  • Did any account succeed, and is each one in runbook 1?
  • Is the source blocked, and was the protocol it used closed?

Hand off

  • Source addresses and hosts, the number of accounts tried, and any that succeeded.
  • Blocks applied, and where.
  • Accounts that need a forced password change.
03Malicious OAuth app or consent grantHigh

Starts with: a consent alert from Defender for Cloud Apps or Entra ID, a user reporting a strange "permissions requested" prompt, or an unfamiliar application found during another investigation.

T1528 Steal Application Access TokenT1098.001 Additional Cloud Credentials

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • Identify the application: name, application ID, publisher, and whether the consent is for one user or the whole tenant.
  • Disable it before anything else if it holds mail or file permissions; disabling is reversible.
  • Keep the application, its consents and its audit trail as evidence: do not delete it.

Steps

1Find every consent in the window

Microsoft's app consent playbook starts from the "Consent to application" activity and the IsAdminConsent value: true means tenant-wide access.

AuditLogs | where TimeGenerated > ago(90d) | where OperationName == "Consent to application" | extend Props = tostring(TargetResources[0].modifiedProperties) | project TimeGenerated, Result, Actor = tostring(InitiatedBy.user.userPrincipalName), App = tostring(TargetResources[0].displayName), Props | sort by TimeGenerated desc

Expect: the consent, who granted it, and the scopes in the modified properties.

Decide: scopes rooted in Mail, Files, Contacts or MailboxSettings, or tenant-wide consent to a third-party app: treat as malicious until shown otherwise.

2List the grants the application holds

Delegated grants with ConsentType AllPrincipals cover every user.

$sp = Get-MgServicePrincipal -Filter "appId eq 'appId-from-the-audit-log'" Get-MgServicePrincipalOauth2PermissionGrant -ServicePrincipalId $sp.Id -All | Select-Object Id, ConsentType, PrincipalId, Scope $sp | Select-Object DisplayName, AppId, AppOwnerOrganizationId, ReplyUrls

Expect: the scopes, and whether the app is owned by another tenant.

Decide: reply URLs on unfamiliar or newly registered domains strengthen the case.

3See what the application did with its access

The application signs in as itself, and its activity shows in Defender for Cloud Apps against its OAuth app ID.

let appId = "00000000-0000-0000-0000-000000000000"; // the app's appId CloudAppEvents | where Timestamp > ago(30d) | where OAuthAppId == appId | summarize Events = count(), Accounts = dcount(AccountObjectId) by ActionType | order by Events desc

Expect: MailItemsAccessed or file access actions across the accounts that consented.

Decide: mail or files accessed: that is a data exposure for legal and the notification decision.

4Check for credentials added to apps you own

An attacker with an admin role can add a secret to an existing application instead of registering a new one.

AuditLogs | where TimeGenerated > ago(30d) | where OperationName has_any ("Add service principal credentials", "Certificates and secrets management") | project TimeGenerated, OperationName, Actor = tostring(InitiatedBy.user.userPrincipalName), App = tostring(TargetResources[0].displayName)

Expect: only credentials your administrators added, each matched to a change.

Decide: any unexplained one: remove it and treat the actor as compromised (runbook 1).

Evidence to secure

EvidenceWhere it isHow to collect it
Consent audit recordsEntra ID audit logQuery export
The application's properties and grantsEntra IDThe PowerShell output above, to file
The application's activityDefender for Cloud Apps, unified audit logCloudAppEvents query export

Contain

Disable the service principal. Microsoft's playbook prefers disabling to deleting, because a deleted app can come back when another user consents again; once disabled it cannot get tokens or be consented to.

Update-MgServicePrincipal -ServicePrincipalId $sp.Id -AccountEnabled:$false Remove-MgOauth2PermissionGrant -OAuth2PermissionGrantId 'Id from the grant list'

Revoke the sessions of the users who consented if they also entered credentials. Then restrict user consent to verified publishers and low-impact permissions, or require the admin consent workflow.

Verify

// The disabled app should not be signing in let appId = "00000000-0000-0000-0000-000000000000"; AADServicePrincipalSignInLogs | where TimeGenerated > ago(1d) | where AppId == appId and ResultType == "0" | project TimeGenerated, IPAddress, ResourceDisplayName

Common mistakes

  • Resetting the users' passwords and calling it done: the grant does not depend on the password.
  • Deleting the app instead of disabling it.
  • Missing tenant-wide consent because one user reported it.
Worked example

A user reports a prompt asking an application called "Document Viewer" to read their mail. Step 1 shows eleven consents in two days, all for Mail.Read and offline_access; step 2 shows the application is registered in an unfamiliar tenant with a reply URL on a domain registered last week. Step 3 shows MailItemsAccessed for nine of the eleven users. The service principal is disabled, the grants removed, user consent restricted to verified publishers, and the nine mailboxes go to legal.

Before you close

  • Is the app disabled, with its grants removed?
  • Do you know what data it reached?
  • Has user consent been restricted?

Hand off

  • The application ID, publisher tenant, scopes and consent type.
  • Users who consented, and data accessed.
  • Consent settings changed as a result.
04Business email compromise and payment fraudHigh

Starts with: finance reporting changed bank details, a supplier asking about an invoice they never sent, or an inbox rule alert.

T1114.003 Email Forwarding RuleT1564.008 Email Hiding RulesT1534 Internal Spearphishing

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • Ask finance immediately: has a payment been made, to which account, and when? Recall is time-critical and runs through the bank, not through you.
  • Find out whether the fraudulent messages came from your mailbox or a lookalike domain; the containment differs.
  • Start runbook 1 on the mailbox owner in parallel.

Steps

1Find the fraudulent messages

Pivot on the subject, the sender and the recipient from the finance report.

EmailEvents | where Timestamp > ago(30d) | where Subject has "invoice" or Subject has "bank details" | where SenderFromDomain != RecipientDomain or EmailDirection == "Outbound" | project Timestamp, SenderFromAddress, RecipientEmailAddress, Subject, EmailDirection, DeliveryAction, NetworkMessageId | sort by Timestamp asc

Expect: outbound messages from the compromised mailbox, or inbound ones from a domain one character away from a supplier's.

Decide: lookalike domain only: your mailbox may be clean; block the domain and warn finance. Messages from your own mailbox: the account is compromised.

2Find the rules that hid the conversation

The usual pattern moves replies from the supplier or finance to an RSS, Archive or Conversation History folder and marks them read.

OfficeActivity | where TimeGenerated > ago(30d) | where Operation in ("New-InboxRule", "Set-InboxRule") | where Parameters has_any ("MoveToFolder", "DeleteMessage", "MarkAsRead", "ForwardTo", "RedirectTo") | project TimeGenerated, UserId, ClientIP, Parameters

Expect: a rule created shortly after the attacker's first sign-in.

Decide: export, then remove after step 3.

3Work out what the attacker read

Mailbox audit records the items accessed. Read access to many messages in finance threads widens the notification question.

Connect-ExchangeOnline $upn = 'compromised.user@yourdomain.com' $end = Get-Date $start = $end.AddDays(-30) Search-UnifiedAuditLog -StartDate $start -EndDate $end -UserIds $upn ` -Operations MailItemsAccessed -ResultSize 5000 | Export-Csv .\mailitemsaccessed.csv -NoTypeInformation

Expect: access from the attacker's address to the threads with invoices and payments.

Decide: personal data in the threads: hand to legal for the notification decision.

4Find other mailboxes the attacker emailed from or into

BEC actors reply inside existing threads and sometimes pivot to the supplier's side.

let upn = "compromised.user@yourdomain.com"; EmailEvents | where Timestamp > ago(30d) | where SenderFromAddress =~ upn and EmailDirection == "Outbound" | summarize Messages = count(), Recipients = make_set(RecipientEmailAddress, 50) by bin(Timestamp, 1d)

Expect: a spike in outbound mail to suppliers or customers around the fraud.

Decide: warn each recipient by phone, using numbers you already had.

Evidence to secure

EvidenceWhere it isHow to collect it
The fraudulent messages with headersMailboxesOne .eml each
Payment instructions and bank detailsFinanceCopies, with the time each was received and actioned
Inbox rules as foundExchange OnlineGet-InboxRule to CSV
MailItemsAccessed recordsUnified audit log (Audit Premium for the longer window)The export above

Contain

Call finance and the bank about any payment in flight. Contain the mailbox owner's account as in runbook 1, remove the rules and forwarding, and block the lookalike domain at the mail gateway.

Verify

let upn = "compromised.user@yourdomain.com"; let containedAt = datetime(2026-03-15T09:30:00Z); OfficeActivity | where TimeGenerated > containedAt | where UserId =~ upn | where Operation in ("New-InboxRule", "Set-InboxRule", "Set-Mailbox")

Common mistakes

  • Treating it as an IT ticket while the money moves.
  • Replying to the fraudulent thread to warn people.
  • Missing that mail was read, which can be a personal data breach in its own right.
Worked example

A supplier calls asking why their invoice was paid to a new account. Step 1 finds the change request sent from the accounts payable manager's own mailbox; step 2 finds a rule moving the supplier's replies to Conversation History. Finance asks the bank to recall the payment within the hour. Step 3 shows the attacker read 140 messages in finance threads. The mailbox is contained, the rule removed, and every supplier in those threads is warned by phone.

Before you close

  • Is the payment status known, and the bank engaged?
  • Have suppliers and customers in the threads been warned by phone?
  • Has legal seen what was read?

Hand off

  • Payment status and bank reference, if any.
  • The attacker's rules, sign-ins and the threads read.
  • Suppliers and customers warned, by whom and when.
05Phishing campaign: scope, purge and containMedium

Starts with: a user reporting a message, a Defender for Office 365 alert, or a click on a malicious URL.

T1566.002 Spearphishing LinkT1566.001 Spearphishing Attachment

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • Keep one copy of the reported message before anything is purged.
  • Pull the indicators: sender, subject, URLs, attachment hashes.
  • Find out whether anyone entered credentials; those accounts go to runbook 1 straight away.

Steps

1Find every recipient and where each copy landed

Search by sender and subject, then by the URL or hash, which catch variants.

let sender = "invoice@lookalike-domain.example"; EmailEvents | where Timestamp > ago(14d) | where SenderFromAddress =~ sender or Subject has "Payment overdue" | summarize Recipients = dcount(RecipientEmailAddress), Delivered = countif(DeliveryAction == "Delivered"), Locations = make_set(DeliveryLocation) by NetworkMessageId, Subject

Expect: the campaign's size and how many copies reached inboxes.

Decide: more than a handful delivered: plan a purge.

2Find who clicked

Safe Links records each click; IsClickedThrough shows a user who reached the original URL.

let ids = EmailEvents | where Timestamp > ago(14d) | where SenderFromAddress =~ "invoice@lookalike-domain.example" | distinct NetworkMessageId; UrlClickEvents | where Timestamp > ago(14d) | where NetworkMessageId in (ids) | project Timestamp, AccountUpn, Url, ActionType, IsClickedThrough

Expect: a list of users, a few of whom clicked through.

Decide: everyone who clicked through: check for a sign-in from a new address in the next hour (runbook 1).

3Sweep endpoints for the attachment

If the lure carried a file, find every device where it was written or run.

let badHash = "replace-with-the-sha256-of-the-sample"; DeviceFileEvents | where Timestamp > ago(14d) | where SHA256 == badHash | summarize First = min(Timestamp), Paths = make_set(FolderPath) by DeviceName

Expect: devices where the file landed.

Decide: any device where it also ran: runbook 6.

4Purge the message

Search and purge in Security & Compliance PowerShell needs the Search And Purge role. Compare the search count with the hunting count before purging; purged items cannot be restored.

Connect-IPPSSession -EnableSearchOnlySession $q = '(From:invoice@lookalike-domain.example) AND (Subject:"Payment overdue")' New-ComplianceSearch -Name 'phish-0412' -ExchangeLocation All -ContentMatchQuery $q Start-ComplianceSearch -Identity 'phish-0412' Get-ComplianceSearch -Identity 'phish-0412' | Select-Object Status, Items New-ComplianceSearchAction -SearchName 'phish-0412' -Purge -PurgeType SoftDelete

Expect: the action completes; each run removes at most 10 items per mailbox.

Decide: Defender for Office 365 Plan 2: Microsoft points to email remediation in Threat Explorer instead.

Evidence to secure

EvidenceWhere it isHow to collect it
The message as a fileThe reporter's mailboxOne .eml with headers, hashed
Recipient and click listsDefender XDRQuery exports
URLs and attachment hashesThe message and EmailUrlInfo, EmailAttachmentInfoIn the case notes

Contain

Block the sender, domain and URLs. Purge the message. Contain anyone who entered credentials or ran the attachment.

Verify

Re-run the recipient query: DeliveryLocation for the purged copies no longer shows the inbox, and no new copies arrived after the block.

Common mistakes

  • Purging before keeping a copy.
  • A purge search broader than the campaign.
  • Forgetting the people who forwarded the message on.
Worked example

Three users report the same "payment overdue" message. Step 1 finds 212 recipients, 198 delivered to the inbox. Step 2 finds 14 clicks, two through the warning. Both get session revocation and runbook 1; the message is purged after one copy is kept, and the sender and URL domains are blocked.

Before you close

  • Is every copy purged, and every click accounted for?
  • Are the senders and URLs blocked?

Hand off

  • Indicators, recipient count, clicks, credential entries and devices.
  • Blocks and purges done, with counts.
06Malware on an endpointHigh

Starts with: a Defender for Endpoint alert, an antivirus detection that was not fully remediated, or a user reporting strange behavior.

T1204.002 Malicious FileT1059.001 PowerShellT1547.001 Registry Run Keys / Startup Folder

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • Collect the Defender investigation package from the device page, then isolate. Isolation ends the running state the package captures.
  • Note the account logged on and whether it is privileged; a privileged account turns one host into a domain problem.
  • Do not reboot, wipe or run a full scan that deletes files before collection.

Steps

1Read the process tree around the alert

The alert names one process. What launched it is usually the initial access; what it launched is the next stage.

let host = "ws-fin-042"; let t = datetime(2026-03-14T22:41:00Z); // alert time DeviceProcessEvents | where Timestamp between ((t - 10m) .. (t + 10m)) | where DeviceName =~ host | project Timestamp, InitiatingProcessParentFileName, InitiatingProcessFileName, FileName, ProcessCommandLine, AccountName, SHA256 | sort by Timestamp asc

Expect: a chain such as outlook.exe, then winword.exe, then powershell.exe with an encoded command.

Decide: note every binary hash and command line for the sweep in step 3.

2Find persistence on the host

Run keys, services and scheduled tasks written in the window.

let host = "ws-fin-042"; DeviceRegistryEvents | where Timestamp > ago(7d) | where DeviceName =~ host | where RegistryKey has_any (@"CurrentVersion\Run", @"\Services\") | where ActionType == "RegistryValueSet" | project Timestamp, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessFileName

Expect: a value pointing at a binary in a user-writable folder.

Decide: any persistence found: it goes on the eradication list for every host the sweep finds.

3Sweep the fleet for the file and its infrastructure

A hash or address from one host is a question about every host.

let badIPs = dynamic(["203.0.113.42"]); DeviceNetworkEvents | where Timestamp > ago(30d) | where RemoteIP in (badIPs) | summarize First = min(Timestamp), Connections = count(), Procs = make_set(InitiatingProcessFileName) by DeviceName

Expect: the same infrastructure contacted from other devices.

Decide: every device found enters this runbook.

4Check where the logged-on account went next

If the account logged on to other hosts after the infection, the scope has moved.

let acct = "j.smith"; let since = datetime(2026-03-14T22:41:00Z); DeviceLogonEvents | where Timestamp > since | where AccountName =~ acct and ActionType == "LogonSuccess" | summarize First = min(Timestamp), Types = make_set(LogonType) by DeviceName

Expect: only the user's own workstation.

Decide: network or RDP logons elsewhere: runbook 7.

5Live triage, if the host cannot be collected through Defender

Native commands, run from a trusted path, written to removable media or a share.

:: Processes with services, then connections with owning process IDs tasklist /svc netstat -anob :: Scheduled tasks in full, and who is logged on schtasks /query /fo LIST /v quser

Expect: a process with an outbound connection that you cannot account for.

Decide: keep the output with the case and hash it.

Evidence to secure

EvidenceWhere it isHow to collect it
Investigation packageDefender for Endpoint device pageCollect investigation package, before isolation
Memory imageThe hostLive response or a memory acquisition tool, if the case may need it
The sampleDefender quarantine or the file pathDownload through Defender, or copy and hash
Process, file and network timelineDefender XDRQuery exports for the window

Contain

Isolate in Defender for Endpoint (full isolation keeps the device talking to the Defender service). Contain the accounts that were logged on. Block the hash and the network indicators.

Rebuild when the attacker had administrative or SYSTEM control, or you cannot account for everything that ran; the rebuild or clean criteria are in the Incident Response reference.

Verify

// No further execution of the sample anywhere after containment let badHash = "replace-with-the-sha256-of-the-sample"; let containedAt = datetime(2026-03-15T09:30:00Z); DeviceProcessEvents | where Timestamp > containedAt | where SHA256 == badHash | project Timestamp, DeviceName, AccountName

Common mistakes

  • Isolating before collecting.
  • Closing it because antivirus quarantined the file while the dropper and the persistence remain.
  • Not checking where the account went next.
Worked example

Defender alerts on an encoded PowerShell command on a sales laptop. Step 1 shows outlook.exe, then winword.exe, then powershell.exe downloading a DLL; step 2 finds a Run key pointing at it in AppData. Step 3 finds the same download address contacted by two more laptops. The investigation packages are collected, all three are isolated, and step 4 shows the user's account went nowhere else.

Before you close

  • Is every host with the file or the infrastructure in scope?
  • Is there a rebuild or clean decision for each?

Hand off

  • Hosts affected, the sample hash, the parent chain, persistence found.
  • Accounts that were logged on.
  • Rebuild or clean decision for each host, with the reason.
07Lateral movementHigh

Starts with: an alert for PsExec-style execution, remote WMI or WinRM, unusual RDP, or an account logging on to many hosts.

T1021.002 SMB/Windows Admin SharesT1021.001 Remote Desktop ProtocolT1021.006 Windows Remote ManagementT1569.002 Service ExecutionT1550.002 Pass the Hash

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • Identify the source host and the account. Both are compromised until shown otherwise.
  • Map before you contain: containing one hop of a chain tells the attacker which hop you found.
  • Check whether the account is privileged; if it is a domain admin, open runbook 8 as well.

Steps

1Map logons from the source host

Network logons cover file shares, remote services and remote management; RemoteInteractive is RDP.

let srcIP = "10.0.4.17"; DeviceLogonEvents | where Timestamp > ago(14d) | where RemoteIP == srcIP and ActionType == "LogonSuccess" | where LogonType in ("Network", "RemoteInteractive") | summarize First = min(Timestamp), Accounts = make_set(AccountName), Types = make_set(LogonType) by DeviceName | sort by First asc

Expect: the hosts reached from the source, in order.

Decide: repeat from each host reached until no new hosts appear.

2Identify the execution method on each target

Remote services start under services.exe; WMI under WmiPrvSE.exe; PowerShell remoting under wsmprovhost.exe.

let targets = dynamic(["srv-file-01", "srv-app-02"]); DeviceProcessEvents | where Timestamp > ago(14d) | where DeviceName in~ (targets) | where InitiatingProcessFileName in~ ("services.exe", "wmiprvse.exe", "wsmprovhost.exe", "mmc.exe") | where FileName in~ ("cmd.exe", "powershell.exe", "rundll32.exe") or FolderPath has @"\Windows\Temp\" | project Timestamp, DeviceName, InitiatingProcessFileName, FileName, ProcessCommandLine, AccountName

Expect: a shell or a binary from Windows\Temp under one of those parents.

Decide: the method tells you what to remove (service, task, WMI subscription).

3Look for credential theft on the hosts reached

Lateral movement usually follows or feeds credential theft.

DeviceProcessEvents | where Timestamp > ago(14d) | where (FileName =~ "rundll32.exe" and ProcessCommandLine has "comsvcs" and ProcessCommandLine has "MiniDump") or FileName in~ ("procdump.exe", "procdump64.exe") or (FileName =~ "reg.exe" and ProcessCommandLine has "save") | project Timestamp, DeviceName, AccountName, ProcessCommandLine

Expect: nothing, or a dump on one of the hosts in the chain.

Decide: a dump: every account logged on to that host is compromised.

4Check for pass-the-hash

NewCredentials logons over NTLM from a process other than Windows itself are how pass-the-hash tools present a hash.

DeviceLogonEvents | where Timestamp > ago(14d) | where LogonType == "NewCredentials" and Protocol == "NTLM" | where InitiatingProcessFileName !in ("services.exe", "lsass.exe") | project Timestamp, DeviceName, AccountName, InitiatingProcessFileName

Expect: none.

Decide: any: the account whose hash was used is compromised wherever it is used.

Evidence to secure

EvidenceWhere it isHow to collect it
Logon events for every host in the chainDefender XDR, Security logsQuery exports; wevtutil epl on hosts without Defender
The services, tasks and binaries usedEach target hostInvestigation package per host
Memory from the host with credential theftThat hostBefore isolation

Contain

Contain in one window: isolate every host in the chain, disable the accounts used, and revoke their sessions. Reset the credentials of every account that was logged on to a host with credential theft.

Verify

let accounts = dynamic(["j.smith", "svc-backup"]); let containedAt = datetime(2026-03-15T09:30:00Z); DeviceLogonEvents | where Timestamp > containedAt | where AccountName in~ (accounts) and ActionType == "LogonSuccess"

Common mistakes

  • Containing the first host found and letting the attacker use the rest.
  • Resetting only the account that alerted, not the ones dumped from memory.
Worked example

An alert flags PsExec on a file server. Step 1, from the source workstation, shows network logons to four servers in 20 minutes; step 2 finds a service under services.exe running from Windows\Temp on each; step 3 finds a comsvcs MiniDump of LSASS on one of them, where a backup service account was logged on. All five hosts are isolated in one window, and the backup account is reset with the domain admin who used the workstation.

Before you close

  • Is the chain mapped to its end?
  • Is every exposed credential reset?

Hand off

  • The chain, host by host, with times and methods.
  • Accounts used and their privilege.
  • Hosts with credential theft, and the accounts exposed on each.
08Active Directory privilege escalation: Kerberoasting, DCSync, privileged groupsCritical

Starts with: a Defender for Identity alert (Kerberoasting, DCSync, suspicious group change), a 4769 RC4 spike, or a privileged group change nobody requested.

T1558.003 KerberoastingT1558.004 AS-REP RoastingT1003.006 DCSyncT1098 Account Manipulation

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • Assume the worst case until shown otherwise: if DCSync is confirmed, every domain credential, including krbtgt, is in the attacker's hands.
  • Move to out-of-band communication; mail and chat may be readable.
  • Do not reset krbtgt or mass-reset passwords yet. Eviction is planned and run in one window.

Steps

1Check for DCSync

A replication right used by an account that is not a domain controller.

let repl = dynamic(["1131f6aa-9c07-11d1-f79f-00c04fc2dcd2", "1131f6ad-9c07-11d1-f79f-00c04fc2dcd2", "89e95b76-444d-4c62-991a-0facbeda640c"]); SecurityEvent | where TimeGenerated > ago(30d) | where EventID == 4662 and Properties has_any (repl) | where not(SubjectUserName endswith "$") | project TimeGenerated, Computer, SubjectUserName, SubjectDomainName

Expect: nothing. Any row is an account pulling password hashes from a domain controller.

Decide: confirmed DCSync: plan full domain eviction, including krbtgt.

2Check for Kerberoasting and AS-REP roasting

RC4 service tickets for many user-account services, and TGTs issued without pre-authentication.

SecurityEvent | where TimeGenerated > ago(7d) | where EventID == 4769 | parse EventData with * 'TicketEncryptionType">' Enc '<' * | parse EventData with * 'ServiceName">' Svc '<' * | where Enc == "0x17" and not(Svc endswith "$") | summarize Services = dcount(Svc), Names = make_set(Svc, 20) by TargetUserName, IpAddress | where Services >= 5

Expect: the requesting account and source address, and the service accounts targeted.

Decide: every targeted service account is a password reset; long, random passwords make the stolen tickets useless.

3List privileged group changes

Additions to Domain Admins, Enterprise Admins, Schema Admins and Administrators.

SecurityEvent | where TimeGenerated > ago(30d) | where EventID in (4728, 4732, 4756) | where TargetUserName in ("Domain Admins", "Enterprise Admins", "Schema Admins", "Administrators") | project TimeGenerated, Computer, Group = TargetUserName, MemberName, AddedBy = SubjectUserName

Expect: only changes that match change records.

Decide: any other: the account that made it is compromised.

4Record the current state of privileged groups and krbtgt

This is the baseline you compare against after eviction.

'Domain Admins', 'Enterprise Admins', 'Schema Admins' | ForEach-Object { Get-ADGroupMember -Identity $_ -Recursive | Select-Object @{ n = 'Group'; e = { $_ } }, SamAccountName, ObjectClass } Get-ADUser -Identity krbtgt -Properties PasswordLastSet, msDS-KeyVersionNumber | Select-Object PasswordLastSet, msDS-KeyVersionNumber

Expect: the membership list and the date krbtgt was last reset.

Decide: krbtgt never reset since the domain was built: expect the cipher issue CISA warns of.

Evidence to secure

EvidenceWhere it isHow to collect it
Domain controller Security logsEvery DCwevtutil epl Security, hashed, before any change
Privileged group membershipActive DirectoryThe PowerShell output above, to file
Images of the admin workstations usedThose hostsInvestigation package and disk image

Contain

Disable the compromised admin accounts. Remove unauthorized group members. Reset targeted service accounts.

Reset krbtgt twice: Microsoft's forest recovery guide says to wait at least 10 hours between the resets (the default maximum ticket lifetime, longer if yours is longer); CISA adds that replication should be healthy before the first reset and replicated before the second.

:: Before and after each reset, read krbtgt's Password last set net user krbtgt /domain

Verify

let containedAt = datetime(2026-03-15T09:30:00Z); SecurityEvent | where TimeGenerated > containedAt | where EventID in (4728, 4732, 4756, 4662) | project TimeGenerated, Computer, EventID, SubjectUserName, TargetUserName

Common mistakes

  • Resetting krbtgt once, or twice in quick succession.
  • Resetting passwords while the attacker can still read them.
  • Rebuilding without finding how they got privileged access.
Worked example

Defender for Identity reports replication from a workstation. Step 1 confirms 4662 with DS-Replication-Get-Changes-All by a helpdesk account at 02:10. Every domain credential is now assumed stolen. The team moves to a phone bridge, rebuilds the admin workstations, and runs the eviction in one window: privileged accounts and service accounts reset, the helpdesk account disabled, and krbtgt reset twice with the wait between.

Before you close

  • Was krbtgt reset twice with the wait?
  • Is the initial access found and closed?

Hand off

  • Accounts with replication rights used, tickets requested, group changes.
  • krbtgt reset times.
  • The eviction plan, step by step, with owners.
09Ransomware, before and after encryptionCritical

Starts with: files being renamed or encrypted, a ransom note, shadow copy deletion, or an alert for ransomware behavior.

T1486 Data Encrypted for ImpactT1490 Inhibit System RecoveryT1489 Service StopT1567.002 Exfiltration to Cloud Storage

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • Isolate affected hosts now; whole subnets at the switch if several are hit. Power off only a host you cannot disconnect, because that loses memory (CISA's checklist).
  • Protect the backups first: take them offline or confirm they are immutable.
  • Move to out-of-band communication.
  • Tell legal and the executive sponsor; the ransom and notification questions start now.

Steps

1Is encryption still running, and where?

Mass renames by one process are the signal.

DeviceFileEvents | where Timestamp > ago(1d) | where ActionType == "FileRenamed" | summarize Renamed = count(), Last = max(Timestamp) by DeviceName, InitiatingProcessFileName, bin(Timestamp, 5m) | where Renamed >= 200 | order by Last desc

Expect: the devices and the process doing the renaming, with the latest time.

Decide: renames still increasing: isolate those devices before reading further.

2Find the recovery inhibition

Operators delete shadow copies and disable recovery shortly before encrypting.

DeviceProcessEvents | where Timestamp > ago(7d) | where (FileName =~ "vssadmin.exe" and ProcessCommandLine has "delete") or (FileName =~ "wmic.exe" and ProcessCommandLine has "shadowcopy") or (FileName =~ "wbadmin.exe" and ProcessCommandLine has "delete") or (FileName =~ "bcdedit.exe" and ProcessCommandLine has "recoveryenabled") | project Timestamp, DeviceName, AccountName, ProcessCommandLine

Expect: the account and host used to run them, often a domain admin from one host.

Decide: that account and host are the operator's: they lead to the initial access.

3Find the data theft before the encryption

Most operators take data first. Look for sync tools and large transfers in the days before.

DeviceProcessEvents | where Timestamp > ago(14d) | where FileName in~ ("rclone.exe", "megacmd.exe", "winscp.exe") or ProcessCommandLine has_any ("rclone copy", "rclone sync") | project Timestamp, DeviceName, AccountName, ProcessCommandLine

Expect: a sync tool on a file server in the days before encryption.

Decide: data taken: this is also a breach for legal.

4Check shadow copies that survive

On a host that is isolated but not yet rebuilt, list what is left.

vssadmin list shadows

Expect: none, usually.

Decide: any left: protect them, they may restore data without the attacker.

Evidence to secure

EvidenceWhere it isHow to collect it
A system image and memory from a sample of affected hostsThose hostsBefore rebuild (CISA lists these first)
The ransom note and samples of encrypted filesAffected hostsCopies, hashed
The payload binaryDefender, or the path from step 1Collected through Defender
Security logs from domain controllersEvery DCBefore eviction

Contain

Isolate, disable the accounts used, and disable VPN, remote access and single sign-on paths the operator could use. CISA advises resetting passwords only once the environment is cleaned and rebuilt, so an operator still holding the domain does not collect the new ones. Report to CISA, the FBI or IC3, and ask law enforcement about decryptors.

Recover from offline or immutable backups in the business order agreed beforehand, checking each restore for persistence before it reconnects. If the domain was compromised, follow runbook 8 for the eviction.

Verify

Re-run step 1 hourly until the rename counts stay at zero across the estate.

Common mistakes

  • Restoring onto infrastructure the operator still controls.
  • Wiping hosts before collecting evidence.
  • Missing the data theft because the encryption is louder.
Worked example

At 03:40 the monitoring shows hundreds of renames on two file servers. Step 1 shows one process renaming files on both; they are isolated within minutes. Step 2 shows vssadmin delete shadows run from a jump host at 03:31 by a domain admin account; step 3 finds rclone on one file server two days earlier. The backups are confirmed immutable, legal and the executive sponsor are told, the domain admin goes to runbook 8, and CISA and the FBI are informed.

Before you close

  • Is encryption stopped everywhere?
  • Is data theft ruled in or out, with evidence?
  • Are restores checked for persistence before reconnection?

Hand off

  • Hosts affected and encryption timeline.
  • Initial access and the operator's accounts.
  • Data taken, if any.
  • Backup status and restore plan.
  • Reports made to law enforcement.
10Data exfiltration and insider casesHigh

Starts with: a DLP alert, a large or unusual download, a departing employee report, or a sharing link created to outside parties.

T1567.002 Exfiltration to Cloud StorageT1567 Exfiltration Over Web ServiceT1213.002 SharepointT1052.001 Exfiltration over USB

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • For an insider case: confirm HR and legal authorized the investigation, and work within that scope.
  • Do not contact the person or change their access until legal agrees; tip-off destroys evidence.
  • Set a legal hold on the person's mailbox and OneDrive if counsel asks.

Steps

1Measure what was downloaded or synced

Count distinct files per hour, not events.

let upn = "departing.user@yourdomain.com"; OfficeActivity | where TimeGenerated > ago(30d) | where UserId =~ upn | where Operation in ("FileDownloaded", "FileSyncDownloadedFull", "FileCopied") | summarize Files = dcount(SourceFileName), Sites = make_set(Site_Url, 10) by bin(TimeGenerated, 1h) | where Files > 50

Expect: a spike well above the person's normal week.

Decide: name the sites and libraries for the data owner.

2Find sharing to outside parties

Anonymous links and invitations to external addresses.

let upn = "departing.user@yourdomain.com"; OfficeActivity | where TimeGenerated > ago(30d) | where UserId =~ upn | where Operation in ("AnonymousLinkCreated", "SharingInvitationCreated", "AddedToSecureLink") | project TimeGenerated, Operation, SourceFileName, TargetUserOrGroupName

Expect: links to personal addresses or anonymous links on sensitive files.

Decide: remove the links once evidence is kept.

3Check the endpoint for removable media and upload tools

USB writes and personal cloud clients.

let host = "ws-sales-017"; DeviceEvents | where Timestamp > ago(30d) | where DeviceName =~ host | where ActionType in ("UsbDriveMounted", "PnpDeviceConnected") | project Timestamp, ActionType, AdditionalFields

Expect: drives mounted around the time of the downloads.

Decide: pair with file events on the drive letter.

4Check mail sent to personal addresses

Mail to the person's own personal address is a common route.

let upn = "departing.user@yourdomain.com"; EmailEvents | where Timestamp > ago(30d) | where SenderFromAddress =~ upn and EmailDirection == "Outbound" | where RecipientDomain in~ ("gmail.com", "outlook.com", "yahoo.com", "proton.me", "icloud.com") | project Timestamp, RecipientEmailAddress, Subject, AttachmentCount

Expect: messages with attachments to personal domains.

Decide: list the attachments for the data owner.

Evidence to secure

EvidenceWhere it isHow to collect it
Audit records of access, download and sharingUnified audit logSearch-UnifiedAuditLog export
Mailbox and OneDrive contentMicrosoft 365Legal hold, set before any change
Endpoint file and device eventsDefender XDRQuery exports
DLP alertsMicrosoft PurviewAlert export

Contain

Remove sharing links and external access, and block the destination, at the moment legal and HR agree. For a departure, remove access at the time of leaving, and recover company devices.

Verify

Re-run steps 1 and 2 after the access change: no further downloads or new links.

Common mistakes

  • Confronting the person before evidence is preserved.
  • Estimating the volume instead of measuring it.
  • Leaving legal out until the end.
Worked example

HR reports a resignation from a sales lead going to a competitor. With legal's authorization, step 1 shows 1,800 files downloaded from the CRM export library in the last week, against fewer than 50 in a normal week; step 4 shows four messages with attachments to a personal address. Legal decides the timing; access is removed at the exit meeting and the findings go to counsel.

Before you close

  • Is the volume measured, not estimated?
  • Has counsel the list of data affected?

Hand off

  • Data affected, how much, through which channel, and whether any is personal or regulated.
  • Who authorized the investigation and its scope.
  • Actions taken and when.
11Azure subscription compromiseCritical

Starts with: a Defender for Cloud alert, an unexpected role assignment, a resource you did not create (often compute for mining), or a deleted diagnostic setting.

T1098.003 Additional Cloud RolesT1651 Cloud Administration CommandT1685.002 Disable or Modify Cloud LogT1496 Resource Hijacking

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • Find out which identity is acting: a user, a service principal or a managed identity. Contain that identity in Entra ID first; Azure access follows it.
  • Export the Azure activity log for the subscription before changing anything.
  • Check that diagnostic settings still send logs to your workspace; if they were deleted, that is part of the incident.

Steps

1List control-plane writes by the suspect identity

Every create, update, delete and action on resources is in AzureActivity.

let caller = "attacker@yourdomain.com"; // or a service principal ID AzureActivity | where TimeGenerated > ago(30d) | where Caller =~ caller | where OperationNameValue endswith "/WRITE" or OperationNameValue endswith "/DELETE" or OperationNameValue endswith "/ACTION" | summarize Count = count(), First = min(TimeGenerated) by OperationNameValue, ResourceGroup | order by First asc

Expect: the sequence of what was changed, starting with the first write.

Decide: role assignments, run commands or diagnostic setting deletes: follow steps 2 to 4.

2Find role assignments made during the window

Owner or User Access Administrator on a subscription is control of everything in it.

AzureActivity | where TimeGenerated > ago(30d) | where OperationNameValue =~ "MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITE" | where ActivityStatusValue in ("Success", "Succeeded") | project TimeGenerated, Caller, CallerIpAddress, _ResourceId, Properties

Expect: assignments that match change records only.

Decide: any other: remove it after recording it.

3Find commands run on virtual machines

Run Command executes a script on the VM through the control plane.

AzureActivity | where TimeGenerated > ago(30d) | where OperationNameValue has "RUNCOMMAND" | project TimeGenerated, Caller, CallerIpAddress, _ResourceId, ActivityStatusValue

Expect: none, or ones you can explain.

Decide: any VM a command ran on: treat it as compromised (runbook 6 or 13).

4Check whether logging was tampered with

Deleted diagnostic settings blind every rule that reads resource logs.

AzureActivity | where TimeGenerated > ago(30d) | where OperationNameValue has "DIAGNOSTICSETTINGS" | project TimeGenerated, Caller, OperationNameValue, _ResourceId

Expect: only your own deployments.

Decide: a delete: restore the setting and note the gap in coverage.

Evidence to secure

EvidenceWhere it isHow to collect it
Azure activity log for the subscriptionAzure MonitorExport, or the AzureActivity query results
Resource logs (Key Vault, storage)Log Analytics, if diagnostic settings were onQuery exports
VM disks for any VM a command ran onAzureSnapshot the disk before rebuild

Contain

Disable the user or service principal in Entra ID and revoke its sessions (runbook 1 or 3). Remove the role assignments the attacker made. Stop and snapshot, then delete, resources they created. Restore diagnostic settings.

Verify

let caller = "attacker@yourdomain.com"; let containedAt = datetime(2026-03-15T09:30:00Z); AzureActivity | where TimeGenerated > containedAt | where Caller =~ caller

Common mistakes

  • Removing the resources and leaving the role assignment that created them.
  • Containing the user but not the service principal they added a secret to.
  • Not checking for a gap in logging during the attack.
Worked example

Defender for Cloud alerts on a cryptocurrency miner. Step 1 shows a developer's account created 60 virtual machines across three Regions in an hour; step 2 shows it granted itself Owner on the subscription the day before; step 4 shows a diagnostic setting deleted first. The account is contained in Entra ID, the role assignment removed, the machines snapshotted and deleted, and the diagnostic setting restored.

Before you close

  • Is every identity the attacker used contained?
  • Is logging restored, and the gap recorded?

Hand off

  • The acting identities, role assignments, resources created and VMs touched.
  • Logging gaps, with times.
  • Cost impact, for the business.
12AWS access key compromiseCritical

Starts with: a GuardDuty finding, an AWS abuse notice about an exposed key, CloudTrail activity from an unfamiliar address, or an unexpected bill.

T1078.004 Cloud AccountsT1098.001 Additional Cloud CredentialsT1580 Cloud Infrastructure DiscoveryT1496 Resource Hijacking

The decisions behind this runbook are in the Incident Response reference playbook.

First 15 minutes

  • Identify the key ID and the IAM user or role it belongs to.
  • Check how the key was used before deactivating it: the investigation needs its last-used information, which deleting removes.
  • Check every Region: attackers launch resources where you do not normally look.

Steps

1Read what the key did

Group by source address and user agent to separate the owner's use from the attacker's.

let keyId = "AKIAIOSFODNN7EXAMPLE"; AWSCloudTrail | where TimeGenerated > ago(30d) | where UserIdentityAccessKeyId == keyId | summarize First = min(TimeGenerated), Calls = count(), Events = make_set(EventName, 50) by SourceIpAddress, UserAgent | sort by First asc

Expect: the owner's normal pattern and a second address with enumeration and identity calls.

Decide: identity changes (step 2) or launches (step 3) decide the eradication scope.

2Find persistence the attacker created

New users, keys, login profiles, policies and roles.

AWSCloudTrail | where TimeGenerated > ago(30d) | where EventName in ("CreateUser", "CreateAccessKey", "CreateLoginProfile", "UpdateLoginProfile", "AttachUserPolicy", "PutUserPolicy", "CreateRole", "UpdateAssumeRolePolicy") | project TimeGenerated, EventName, UserIdentityArn, SourceIpAddress, RequestParameters

Expect: none outside your provisioning.

Decide: each one is an eradication item.

3Find resources launched

Compute launched in bulk, often in unused Regions, is the mining pattern.

let keyId = "AKIAIOSFODNN7EXAMPLE"; AWSCloudTrail | where TimeGenerated > ago(30d) | where UserIdentityAccessKeyId == keyId | where EventName in ("RunInstances", "CreateFunction20150331", "CreateBucket", "ModifySnapshotAttribute") | project TimeGenerated, EventName, AWSRegion, RequestParameters

Expect: the Regions and resources to remove.

Decide: snapshot sharing: data has left; tell legal.

4Confirm from the CLI

From a trusted session, list the user's keys and when each was last used.

aws iam list-access-keys --user-name the-key-owner aws iam get-access-key-last-used --access-key-id AKIAIOSFODNN7EXAMPLE aws cloudtrail lookup-events --lookup-attributes \ AttributeKey=AccessKeyId,AttributeValue=AKIAIOSFODNN7EXAMPLE

Expect: the key's last service and Region.

Decide: proceed to containment.

Evidence to secure

EvidenceWhere it isHow to collect it
CloudTrail events for the keyCloudTrail (and your trail in S3)Query export; lookup-events output
IAM state: users, keys, policiesIAMCLI output to file
Snapshots of any compromised instanceEC2Snapshot before terminating

Contain

AWS's guidance: create a replacement key, deactivate the original, confirm the applications work, then delete it. Deactivation is reversible.

aws iam update-access-key --access-key-id AKIAIOSFODNN7EXAMPLE \ --status Inactive --user-name the-key-owner # Stop the user acting at all while you investigate aws iam attach-user-policy --user-name the-key-owner \ --policy-arn arn:aws:iam::aws:policy/AWSDenyAll

Delete the users, keys, roles and policies the attacker created, and the resources in every Region, after keeping what the investigation needs. Enable MFA on the root user.

Verify

let keyId = "AKIAIOSFODNN7EXAMPLE"; let containedAt = datetime(2026-03-15T09:30:00Z); AWSCloudTrail | where TimeGenerated > containedAt | where UserIdentityAccessKeyId == keyId and isempty(ErrorCode)

Common mistakes

  • Deleting the key before reading its activity.
  • Checking only your usual Region.
  • Missing a second key or login profile the attacker created.
Worked example

AWS sends an abuse notice: a key was found in a public repository. Step 1 shows the key used from an unfamiliar address for ListBuckets and DescribeInstances; step 2 shows CreateUser and CreateAccessKey for a new user; step 3 shows RunInstances in a Region the company does not use. The key is deactivated, the new user and its key deleted, the instances snapshotted and terminated, and the repository history cleaned.

Before you close

  • Is the key deactivated and every attacker-created identity removed?
  • Have all Regions been checked?

Hand off

  • Key ID, owner, first and last malicious use.
  • Identity changes and resources created, by Region.
  • Data shared out, if any.
13Linux server compromise: SSH and web serverHigh

Starts with: an EDR or Defender for Endpoint Linux alert, unexpected outbound connections, a web shell alert, or an SSH login from an unknown address.

T1021.004 SSHT1505.003 Web ShellT1053.003 CronT1098.004 SSH Authorized Keys

First 15 minutes

  • Collect volatile state before anything else: processes, connections, logged-in users.
  • Do not reboot; a running process may exist only in memory, its binary deleted from disk.
  • Work from a trusted shell, and write output to another host or to removable media.

Steps

1Capture processes, connections and sessions

The process tree, listening and established sockets with their processes, and who is logged in.

ps -eo pid,ppid,user,lstart,cmd --forest ss -tanp ss -uanp last -F -x

Expect: a shell or interpreter under the web server user, or a connection out to an address you do not recognize.

Decide: note each suspicious PID for step 2.

2Keep the binary of a suspicious process

A process's executable stays readable through /proc while it runs, even if deleted from disk.

ls -l /proc/4242/exe sha256sum /proc/4242/exe cp /proc/4242/exe /mnt/evidence/pid4242.bin

Expect: a path, or a path marked (deleted).

Decide: a deleted binary that is still running is a strong indicator.

3Read SSH authentication

OpenSSH logs accepted logins at the default log level with the method and key fingerprint.

journalctl -u ssh --since "2026-03-13" --no-pager | grep -E "Accepted" grep -E "Accepted|Invalid user" /var/log/auth.log

Expect: the attacker's address with "Accepted publickey" or "Accepted password".

Decide: publickey from an unknown address: check authorized_keys in step 4.

4Find persistence

Keys, cron, systemd units and timers, and recently changed executables.

cat /root/.ssh/authorized_keys crontab -l -u www-data systemctl list-timers --all find / -xdev -type f -newermt "2026-03-13" -perm -u+x

Expect: a key or cron entry you did not add, a new unit, or executables written in the window.

Decide: each item goes on the eradication list.

5Check the web root for shells

Files written by the web server user in the window are the web shells.

find /var/www -type f -newermt "2026-03-13" -name "*.php"

Expect: a file the deployment process did not write.

Decide: keep it, then find the request that wrote it in the access log.

Evidence to secure

EvidenceWhere it isHow to collect it
Volatile output from step 1The hostSaved to another host, hashed
Running binaries/proc/<pid>/exeCopied and hashed as in step 2
Authentication logsjournald and /var/log/auth.log (or /var/log/secure)Copied with the journal files
Web server access logs/var/log/nginx or /var/log/apache2Copied for the window
Memory, if the case needs itThe hostAVML or LiME (see the Linux forensic artifacts reference)

Contain

Block the attacker's address at the host firewall or the cloud security group, lock the accounts used, and remove unauthorized keys, after keeping copies.

iptables -I INPUT -s 203.0.113.42 -j DROP usermod -L compromised passwd -l compromised

Rebuild a server where the attacker had root; cleaning a root compromise relies on finding everything.

Verify

Re-run step 3 and step 1 after containment: no new logins from the address, no connection to it.

Common mistakes

  • Rebooting before capturing volatile state.
  • Trusting binaries on a host where the attacker had root; use static tools from removable media.
  • Removing the web shell without finding the vulnerability that let it be written.
Worked example

Outbound connections from a web server to an unknown address on port 4444 trigger an alert. Step 1 shows /bin/sh under the web server user with a connection to that address; step 2 shows its binary marked deleted; step 5 finds a PHP file written to an upload folder an hour earlier. The process binary and logs are kept, the address is blocked, and the server is rebuilt from its image with the upload vulnerability fixed.

Before you close

  • Is the access method found and fixed?
  • Was the server rebuilt, or is cleaning justified?

Hand off

  • Access method, accounts, addresses, persistence found.
  • Binaries kept, with hashes.
  • Rebuild decision and the vulnerability to fix.

From running a runbook to leading the investigation

Microsoft Cloud Incident Response takes these incidents through a full investigation across Microsoft 365, Entra ID and Sentinel: scoping, forensic analysis, containment, notification and the post-incident review.

Read the first module free →

Weekly security engineering insights

Detection techniques, architecture patterns, and operational judgment, every Tuesday.

No spam. Unsubscribe anytime.