Guide 3 · Incident response
Emergency account compromise triage: the first 30 minutes
What to do in the first half hour after an email, Microsoft 365 or Google account is taken over: cut off sessions, remove forwarding and inbox rules, reset credentials, check sign-in methods, and report it.
Before you start
Stop Work from a clean device
If you think the computer you normally use is infected, do not sign in from it. Use another computer or your phone. Disconnect the suspect computer from the network, but do not wipe it yet; it may hold evidence of how the attacker got in.
The order matters. First cut the attacker off, then find what they changed, then limit the damage. Write down what you find and when; you will need it for your bank, your insurer or the police.
Minutes 0 to 10: cut the attacker off
Personal Microsoft account (Outlook.com, Hotmail)
- Change the password at
account.microsoft.com, under Security. - In the security settings, open Additional security options, find Sign out everywhere and confirm. Microsoft says this can take up to 24 hours to apply everywhere, and Xbox consoles must be signed out separately.
- Review the sign-in methods and recovery email and phone; remove anything you do not recognize.
Personal Google account (Gmail)
- Change the password at
myaccount.google.com. - Go to Security & sign-in, then Your devices, then Manage all devices. Open each device you do not recognize and choose Sign out.
- Review 2-Step Verification, recovery email and recovery phone.
Microsoft 365 (administrators)
Microsoft's documented order for a compromised mailbox is: disable the account (or reset its password), revoke access, review registered sign-in methods, review apps the user consented to, review administrative roles, then review forwarding and inbox rules. These commands use the Microsoft Graph PowerShell module:
Connect-MgGraph -Scopes 'User.ReadWrite.All', 'User.RevokeSessions.All', 'UserAuthenticationMethod.Read.All', 'Directory.Read.All'
Update-MgUser -UserId user@example.com -AccountEnabled:$false
Revoke-MgUserSignInSession -UserId user@example.comUpdate-MgUser ... -AccountEnabled:$falseblocks new sign-ins.- Check which account you are disabling. Do not disable the account you are signed in with, or the organization's only administrator account: that can lock you out of the organization. For a compromised administrator account, sign in with a second administrator account first; if there is none, reset its password and revoke its sessions instead of disabling it. Microsoft recommends keeping at least two emergency access accounts with the Global Administrator role so that an organization cannot lock itself out.
Revoke-MgUserSignInSessioninvalidates the user's refresh tokens and browser session cookies.
Warning Revoking is not instant everywhere
Access tokens that were already issued stay valid until they expire, about an hour by default, unless the app supports Continuous Access Evaluation. Disabling the account first stops new tokens from being issued while the old ones run out. The older Revoke-AzureADUserAllRefreshToken command belongs to the AzureAD module, which Microsoft stopped supporting in March 2025 and is retiring; use the Graph command.
Then reset the password in the Microsoft 365 admin center. Give the new password to the user by phone or in person, not by email. Leave the account disabled while you work through the checks below, then enable it again with Update-MgUser -UserId user@example.com -AccountEnabled:$true.
Google Workspace (administrators)
In the Admin console, open Directory, then Users, select the user, open Security, and use Sign-in cookies, then Reset. Reset the password from the same page. Google notes that resetting sign-in cookies does not sign the user out of apps such as Gmail and Google Drive for desktop, so check those separately.
Minutes 10 to 20: find what the attacker changed
Attackers who get into a mailbox usually set things up to keep access or to hide their tracks. Check each of these, and save a copy of anything suspicious before you delete it.
Forwarding and inbox rules
Gmail: in Settings, open See all settings, then:
- Forwarding and POP/IMAP: choose Disable forwarding if there is an address you did not add.
- Filters and Blocked Addresses: delete filters that forward, delete or archive mail you did not set up.
- Accounts and Import, under Grant access to your account: remove any delegate you do not recognize.
Outlook.com: in Settings, check Mail, then Forwarding and Rules.
Microsoft 365 (administrators), using the Exchange Online PowerShell module:
Connect-ExchangeOnline
Get-Mailbox -Identity user@example.com | Format-List Forwarding*Address, DeliverTo*
Get-InboxRule -Mailbox user@example.com -IncludeHidden |
Format-List Name, Enabled, From, SubjectContainsWords, ForwardTo, ForwardAsAttachmentTo, RedirectTo, MoveToFolder, DeleteMessage, MarkAsReadSave the rules as evidence, then remove forwarding and disable the bad rules:
Get-InboxRule -Mailbox user@example.com -IncludeHidden | Export-Clixml -Path .\inbox-rules-evidence.xml
Set-Mailbox -Identity user@example.com -ForwardingAddress $null -ForwardingSmtpAddress $null -DeliverToMailboxAndForward $false
Disable-InboxRule -Mailbox user@example.com -Identity 'RULE NAME'Warning Outlook client rules
Changing inbox rules with PowerShell removes any client-side rules the user created in Outlook. Tell the user before you do it.
-IncludeHidden matters: attackers sometimes create rules that do not show up in Outlook.
Who else has access to the mailbox
Get-EXOMailboxPermission -Identity user@example.com | Where-Object { $_.User -ne 'NT AUTHORITY\SELF' }
Get-EXORecipientPermission -Identity user@example.comThe first command lists full-access delegates; the second lists anyone allowed to send as the user.
Sign-in methods and connected apps
Get-MgUserAuthenticationMethod -UserId user@example.com |
Select-Object Id, @{ Name = 'Type'; Expression = { $_.AdditionalProperties['@odata.type'] } }
Get-MgUserOauth2PermissionGrant -UserId user@example.com | Select-Object ClientId, ConsentType, ScopeAn unfamiliar phone number or authenticator app means the attacker registered their own second factor; remove it in the Microsoft Entra admin center under the user's Authentication methods. For each permission grant you do not recognize, look up the app by its ClientId:
Get-MgServicePrincipal -ServicePrincipalId CLIENT_ID |
Select-Object DisplayName, AppId, AppOwnerOrganizationId, @{ Name = 'VerifiedPublisher'; Expression = { $_.VerifiedPublisher.DisplayName } }VerifiedPublisher shows a name only when the app's publisher is verified, and AppOwnerOrganizationId is the ID of the tenant where the app is registered.
For personal Google accounts, review Linked apps at myaccount.google.com/linkedapps and choose Remove access for anything unfamiliar.
What the attacker did
Search-UnifiedAuditLog -StartDate (Get-Date).AddDays(-7) -EndDate (Get-Date) -UserIds user@example.com -ResultSize 5000 |
Select-Object CreationDate, Operations, AuditData |
Export-Csv -Path .\audit-user.csv -NoTypeInformationSearch-UnifiedAuditLog still works, but Microsoft has announced its retirement on 15 October 2027 in favour of the Microsoft Graph audit log query API. In the mailbox itself, check Sent Items for messages you did not send and Deleted Items for security alerts the attacker removed.
Minutes 20 to 30: limit the damage
- Other accounts with the same password: change those too, starting with banking, your password manager and any account that uses this email address for password resets.
- People you email: attackers often send phishing or fake invoices from a taken-over mailbox. Warn your contacts, especially anyone who pays you.
- Payments: if an invoice, payroll or bank detail changed recently, call the bank or the other company on a number you already have, not one from an email.
- Second factor: once you are back in control, move the account to a phishing-resistant method such as a passkey or hardware security key. See Password managers and hardware keys.
Report it
In Canada:
- The Canadian Anti-Fraud Centre: 1-888-495-8501, weekdays 10 a.m. to 4:45 p.m. Eastern time.
- Online, through the RCMP's National Cybercrime and Fraud Reporting System at
reportcyberandfraud.canada.ca. The RCMP says it does not replace other reporting channels, so also report to your local police. - Businesses can contact the Canadian Centre for Cyber Security at 1-833-CYBER-88 (1-833-292-3788) or through
cyber.gc.ca.
In the United States: the FBI's Internet Crime Complaint Center at ic3.gov, and the Federal Trade Commission at reportfraud.ftc.gov.
Stop Fake recovery services
In July 2026 the FBI warned that scammers impersonate its complaint centre, using AI-generated voices and deepfake video. The real centre never asks for payment to recover lost money. Type the address into your browser yourself rather than following a link.
Checklist
- Working from a device I trust.
- Password changed; all sessions signed out or revoked.
- Forwarding addresses removed; suspicious rules saved, then disabled.
- Delegates, sign-in methods, recovery details and connected apps checked.
- Sent and deleted items reviewed; contacts warned.
- Other accounts sharing the password changed.
- Reported to the Canadian Anti-Fraud Centre or IC3.
Quick lookups
One-line checks and fixes for the ports, files and settings in this guide, one page each.
Sources
- Microsoft Learn: responding to a compromised email account
- Microsoft Learn: Revoke-MgUserSignInSession
- Microsoft Learn: revoke user access in Microsoft Entra ID
- Microsoft Learn: manage emergency access accounts in Microsoft Entra ID
- Microsoft Learn: Get-InboxRule
- Microsoft Learn: Remove-InboxRule
- Microsoft Learn: Get-MgUserAuthenticationMethod
- Microsoft Learn: Get-MgUserOauth2PermissionGrant
- Microsoft Learn: servicePrincipal resource type
- Office 365 for IT Pros: Search-UnifiedAuditLog retirement, October 2026
- Microsoft Support: sign out everywhere for a Microsoft account
- Google Account Help: see devices with account access
- Google Account Help: linked apps
- Gmail Help: automatic forwarding
- Gmail Help: filters
- Gmail Help: delegates
- Google Workspace: sign a user out of a managed Google account
- Canadian Anti-Fraud Centre: report fraud
- RCMP: National Cybercrime and Fraud Reporting System
- Canadian Centre for Cyber Security: contact
- FBI: scammers impersonating the IC3, 20 July 2026