IT Pro Expert
Search
IT · 26 Sep 2025 · 24 min read

Microsoft 365 Tenant Compromised? How to Fix

The Dangers of a Microsoft 365 Breach A compromised Microsoft 365 account is more than a simple security incident. Once an attacker gains initial access, they can establish persistent backdoors,…

Microsoft 365 Tenant Compromised How to Fix 1

A compromised Microsoft 365 account is more than a simple security incident. Once attackers get in, they plant backdoors that survive a password reset and give them silent, long-term access to your email, files and wider infrastructure. This guide explains how breaches happen now that attackers use AI, gives you a full persistence checklist, and ends with a prompt you can paste into your own AI assistant to work through the checks with you.

Understanding Microsoft 365 Hacks and How to Lock The Hackers Out

A non Global Administrator account requires a full scan of related access but if the compromised account has Global Administrator access, you must work through a significant amount of checks to make sure the tenant is fully recovered and secured as most investigators are now missing the many ways an attacker (often AI assisted) can leave secret access that does not show up in log files or other common areas. Changing the password on its own is not enough: an attacker with admin rights can create apps, forwarding, sign-in methods and trust relationships that keep working long after the password has changed.

How attackers get into Microsoft 365 tenants

Most corporate Microsoft 365 breaches start with one of four routes.

Weak or reused passwords

Weak, reused or previously breached passwords are still the most common way in. Without multi-factor authentication (MFA), a stolen password gives immediate access to email, files and internal communications.

Phishing that steals MFA too

Phishing emails lead to fake Microsoft 365 sign-in pages. Modern adversary-in-the-middle kits relay the real Microsoft page, so the attacker captures your password, your MFA code and your signed-in session in one go.

Session and token theft

Malware, infostealers and malicious browser extensions steal the session cookies and tokens that keep you signed in. Attackers replay them to bypass both your password and MFA, often for days or weeks.

Consent and device code phishing

Instead of stealing a password, attackers trick users into approving a malicious app, or into entering a code on Microsoft's genuine device sign-in page. Either way, the attacker receives tokens that survive a password change.

Once inside, attackers may operate quietly for months, or deploy Remote Access Trojans (RATs) that give them complete control of the victim's computer, including its camera and microphone.

How AI has changed Microsoft 365 attacks

AI has not replaced the attacks above. It has made them faster, more convincing and harder to spot, and it has created new places for attackers to hide.

  • Flawless phishing at scale: AI writes personalised, error-free lures in any language, based on your public information and stolen email threads. Spotting spelling mistakes is no longer a reliable defence.
  • Deepfake voices and fake helpdesks: attackers clone the voice of a director, or call staff on Teams pretending to be IT support, to get MFA reset, a sign-in prompt approved or a remote access tool installed.
  • AI apps and agents as backdoors: AI assistants, meeting note-takers and email tools are connected to Microsoft 365 through OAuth consent, often with full access to mail and files. A malicious or compromised one keeps that access after every password reset. Copilot Studio agents and connected AI tools add new identities, connections and permissions that must be checked.
  • Copilot works for the attacker too: once inside an account, an attacker can ask Copilot to find passwords, contracts, payment details and anything else the user can reach. Overshared SharePoint and OneDrive content becomes instant exposure.
  • Prompt injection: emails and documents can carry hidden instructions aimed at AI assistants that read them. Security researchers have shown this can be used to make assistants leak data, so any AI tool that reads your mail is part of your attack surface.
  • Faster attacks: automated tooling means the gap between first access and planted backdoors can be minutes, not days. Containment has to start immediately.

What happens after a successful Microsoft 365 breach

The consequences range from covert surveillance to complete lockout.

  • Silent espionage: attackers monitor communications, exfiltrate sensitive data and study your operations for months, waiting for the right moment to strike, often to redirect a large payment.
  • Account lockout and data destruction: in a more aggressive attack, they change your passwords and lock you out of your own environment, giving them unrestricted time to steal or permanently delete data from SharePoint, OneDrive and email.
  • Launchpad for wider attacks: a compromised account is used to impersonate the user, defraud clients and colleagues, reset passwords for other services linked to the email address, and damage your company's reputation.

First steps when you suspect a Microsoft 365 compromise

Do these before working through the checklist, in this order.

  1. Work from a clean device

    Use a computer you trust and a known-good admin account, ideally a cloud-only emergency (break-glass) account protected by a passkey or FIDO2 key. If the victim's computer runs malware, anything you do on it can be watched.

  2. Preserve the evidence

    Export the Unified Audit Log and the Microsoft Entra sign-in and audit logs for the suspected period before you change anything. You will need them to find every backdoor, and they expire.

  3. Cut off the attacker

    Reset the affected passwords, then revoke all sessions (Revoke sessions in the Entra admin centre, or Revoke-MgUserSignInSession in PowerShell). A password reset alone does not end a stolen session. Remove any MFA methods the user does not recognise.

  4. Hunt for persistence

    Work through the checklist below, then revoke sessions again once every backdoor is removed, as some backdoors can issue fresh tokens.

Microsoft 365 tenant compromise persistence checklist

If attackers have gained Global Administrator access to your Microsoft 365 tenant, they may have set up backdoors that survive standard steps like password changes. This checklist gives you a systematic way to find and remove common and advanced persistence. Azure AD is now called Microsoft Entra ID; both names are used in Microsoft's portals and documentation.

Section 1: identity and access management

User accounts, roles, sign-in methods and the policies that govern access.

  • 1. Global admins and privileged roles:
    • Audit every account holding Global Administrator and other high-privilege roles (Privileged Role Administrator, Exchange Administrator, SharePoint Administrator, Application Administrator, Cloud Application Administrator, Privileged Authentication Administrator).
    • Check eligible assignments in Privileged Identity Management (PIM) as well as active ones, plus role-assignable groups and administrative units. An eligible role is a dormant backdoor.
    • Remove any unfamiliar or non-essential accounts from these roles immediately.
  • 2. New, restored and re-enabled accounts:
    • Scrutinise all recently created user accounts, and any that were restored from deleted users or re-enabled.
    • Verify they are legitimate and have not been given privileged roles.
  • 3. Guest, external and cross-tenant access:
    • Review every guest account in Microsoft Entra ID and remove unknown or unnecessary guests.
    • Check cross-tenant access settings and cross-tenant synchronisation for organisations you do not recognise.
  • 4. Registered sign-in methods:
    • For every admin and affected user, review authentication methods: authenticator apps, phone numbers, FIDO2 keys, passkeys, Windows Hello and Temporary Access Passes. Attackers often register their own method, which survives a password reset.
    • Search the audit log for "User registered security info" events during the incident.
  • 5. Multi-factor authentication configuration:
    • Confirm MFA is enforced through Conditional Access for all users, especially administrators.
    • Inspect policies for exclusions that could act as a bypass, such as trusted IP ranges or individual user exemptions.
  • 6. Conditional Access policies and named locations:
    • Audit every policy for suspicious changes, weak configurations, new exclusions, or policies switched to report-only or off.
    • Check named locations for IP ranges the attacker may have marked as trusted.
  • 7. Partner relationships:
    • In the Microsoft 365 admin centre, review partner relationships (delegated admin and GDAP). Remove any partner you do not recognise or no longer use.
  • 8. Password reset and helpdesk process:
    • Check self-service password reset settings and who holds helpdesk and authentication admin roles.
    • Make sure staff never reset passwords or MFA on the strength of a phone or Teams call alone, as voices can now be cloned.

Section 2: applications, service principals and AI agents

Attackers frequently abuse application permissions to create powerful, hard-to-detect backdoors. This is the closest Microsoft 365 has to a hidden remote login: an app with the right permissions can read every mailbox or change the directory without any user signing in.

  • 9. OAuth and enterprise applications:
    • Audit all enterprise applications in Microsoft Entra ID, paying close attention to recently added apps and those with high-level permissions.
    • Remove the default filter so you see every application type, and sort by date. Check all API access.
    • Investigate and revoke illicit or unnecessary API permissions and OAuth consents granted by users.
    • Restrict user consent to verified publishers and low-risk permissions, and turn on the admin consent workflow.
  • 10. App registrations, secrets and owners:
    • Open Certificates and secrets on every app registration, including legitimate ones, and look for credentials added recently or with very long lifetimes.
    • Review the owners of each app. Remove unknown owners, and turn on app instance property lock for multi-tenant apps you publish.
  • 11. Application permissions and roles:
    • Review which apps have powerful permissions such as Directory.ReadWrite.All, RoleManagement.ReadWrite.Directory, Application.ReadWrite.All, Mail.ReadWrite, Mail.Send, Files.Read.All, full_access_as_app or Exchange.ManageAsApp.
    • In Exchange Online, check service principals and RBAC for Applications role assignments.
    • Remove permissions the app does not genuinely need.
  • 12. Service principals and their credentials:
    • Inspect service principals for recently added or long-lived secrets and certificates. Credentials added directly to a service principal do not show on the app registrations page, so check with PowerShell or Microsoft Graph.
    • Revoke suspicious credentials and rotate legitimate ones as a precaution.
  • 13. AI tools, Copilot agents and connectors:
    • List every AI assistant, note-taker and email tool that users or admins have connected, and what mail, calendar and file access each one holds.
    • Review Copilot Studio agents, their owners, connections and authentication settings, plus Copilot and Graph connectors and any MCP servers linked to Microsoft 365 data. Remove anything unapproved, ownerless or created during the incident.
  • 14. Azure subscriptions, virtual machines and managed identities:
    • If the tenant has Azure subscriptions, check role assignments on subscriptions and management groups, new virtual machines, SSH keys, VM Run Command activity, Key Vault access and managed identities with Microsoft Graph permissions. This is where a literal SSH or RDP backdoor would live.

Section 3: mail flow and collaboration

Control over mail flow and data sharing is a primary target for data theft and invoice fraud. Several forwarding methods do not appear in the normal admin user view, so check each one.

  • 15. Inbox rules, including hidden ones:
    • Check every mailbox with Get-InboxRule -IncludeHidden, not just the rules visible in Outlook.
    • Look for rules that forward, redirect or delete mail, mark it as read, or move it to RSS Feeds, Archive or Conversation History, especially rules triggered by words like invoice, payment or bank.
    • Rules hidden by editing the mailbox directly through MAPI may not appear even then. MFCMAPI can find and delete them.
  • 16. Mailbox-level forwarding:
    • Check ForwardingSmtpAddress on every mailbox. Users can set this themselves in Outlook on the web, and it is easy to miss in the admin centre.
    • Also check ForwardingAddress and DeliverToMailboxAndForward. ForwardingAddress can point to a mail contact the attacker created, so review recently created mail contacts and mail users too.
  • 17. Mailbox and folder permissions:
    • Audit Send As, Full Access and Send on Behalf permissions, and remove any granted to attacker-controlled accounts.
    • Check folder-level permissions on the Inbox and Calendar, and calendar delegates.
  • 18. Transport rules and connectors:
    • Review tenant-wide mail flow rules in the Exchange admin centre for any that BCC or forward messages to external domains.
    • Check inbound and outbound connectors for any that route mail through a server you do not control.
  • 19. External auto-forwarding controls:
    • Set automatic forwarding to Off in the outbound anti-spam policy, which blocks external auto-forwarding across the tenant. Allow exceptions only where they are documented.
    • Check remote domain settings as a second layer, so automatic forwarding is disabled unless explicitly required.
  • 20. Mail protocols per mailbox:
    • Disable POP, IMAP, SMTP AUTH and EWS on mailboxes that do not need them. These are easy for attackers to script against.
  • 21. SharePoint, OneDrive and Teams:
    • Audit tenant-wide external sharing settings and recently created "Anyone" links.
    • Review site permissions and remove suspicious guests or external users with excessive access.
    • Restrict Teams external access, which attackers use to message staff while posing as IT support.

Section 4: tenant and directory configuration

Low-level configuration changes can compromise the security of the whole tenant.

  • 22. Federation and custom domains (critical):
    • Inspect federation settings. Make sure no unauthorised identity providers have been added and that the token-signing certificate is secure. A rogue federated domain lets an attacker sign in as anyone.
    • Verify the list of custom domains and remove any added or switched to federated by the attacker.
  • 23. Security defaults, legacy authentication and device code flow:
    • Confirm that security defaults or equivalent Conditional Access baseline policies are active.
    • Make sure legacy authentication protocols are blocked, as they do not support modern authentication methods like MFA.
    • Block device code sign-in with Conditional Access unless you have a specific need for it.
  • 24. Directory extensions and custom attributes:
    • Advanced attackers may modify the directory schema. Check for suspicious custom security attributes or schema extensions that could be used to hide information.
  • 25. Hybrid identity:
    • If you sync from on-premises Active Directory, treat the Entra Connect or Cloud Sync server as critical. Check it, the pass-through authentication agents and the Seamless SSO account, and assume on-premises AD may also be compromised.

Section 5: automation platforms

Automation tools can be turned into tools to steal data or run commands.

  • 26. Power Automate and Logic Apps:
    • Review all flows, in every environment, for routines that save attachments externally, forward emails based on keywords or call outside web addresses.
    • Check Power Platform connections and data loss prevention policies.
  • 27. Azure Automation and runbooks:
    • Inspect for unauthorised automation accounts, runbooks or schedules.
    • Review and rotate any credentials associated with automation accounts.

Section 6: auditing, devices and endpoints

Reviewing logs and device state is essential for a complete investigation.

  • 28. Unified Audit Log and mailbox auditing:
    • Make sure the Unified Audit Log is enabled and that no mailbox has been set to bypass auditing.
    • Review it for activities such as New-InboxRule, Set-InboxRule, Set-Mailbox, Add-MailboxPermission, Consent to application, Add service principal credentials, Add member to role and Set domain authentication.
  • 29. Microsoft Entra sign-in logs:
    • Analyse interactive, non-interactive and service principal sign-ins for suspicious IP addresses, hosting providers, impossible travel or unusual user agents.
    • One session used from several IP addresses is a strong sign of token theft. Also look for device code sign-ins you did not expect.
  • 30. Devices and Intune:
    • Review recently registered and joined devices in Microsoft Entra ID and Intune for any added by the attacker. A registered device can give an attacker long-lived sign-in tokens.
    • Audit compliance and enrolment policies, and check Intune scripts, remediations and apps, which an attacker could use to push malware to every device.
  • 31. The victim's computer:
    • Check the original user's device for infostealers, remote access tools and malicious browser extensions. If there is any doubt, rebuild it, or the attacker will simply steal fresh tokens.
  • 32. Defender alerts and security tools:
    • Review all alerts in Microsoft Defender XDR, Defender for Cloud Apps, Entra ID Protection and Sentinel from the suspected compromise period onwards.

Final recommendation: document your findings at each step. If you discover several deeply embedded persistence mechanisms, the integrity of the tenant may be compromised. In that case, consider engaging a specialist incident response team such as Microsoft's DART, or put the tenant in lockdown and plan a full Microsoft 365 tenant migration.

How to harden Microsoft 365 against future attacks

  • Use phishing-resistant MFA, ideally passkeys or FIDO2 keys, on every account, and make it mandatory for administrators. Codes and push approvals can be relayed by modern phishing kits.
  • Make every password unique to Microsoft 365, never used on any other website, and at least 12 characters long.
  • Never give Global Administrator rights to users, business owners or anyone who signs in daily. Use a separate admin-only account, and keep two emergency access accounts.
  • Block user consent to unverified apps, require admin approval for new apps, and review connected AI tools and agents regularly.
  • Block legacy authentication and device code sign-in, and turn off external auto-forwarding.
  • Fix oversharing in SharePoint and OneDrive before rolling out Copilot more widely, so a single compromised account cannot surface everything.
  • Agree a verification process for password, MFA and payment changes that never relies on a voice or video call alone.
  • Add Defender for Office 365 Plan 1 or Plan 2 for an extra layer of protection, or ideally use the ThreatDown Mail API Protection Module for AI-driven defence across the whole Microsoft 365 account in the cloud. It can even retract emails retrospectively if they are missed the first time.
  • Run proper anti-malware such as ThreatDown on every computer, rather than low-value consumer products.
  • Add network DNS protection such as NextDNS, with all its protection features turned on.
  • Install an IDS/IPS firewall, such as a UniFi gateway, for a clearer overview of network traffic.
  • Train staff every three months and test them, including on AI-generated phishing and fake helpdesk calls, as they tend to forget quickly.

Check your Microsoft 365 tenant with your own AI assistant

The prompt below turns an AI assistant such as Claude, ChatGPT or Microsoft Copilot into a step-by-step guide through every check on this page. It tells the AI to stay read-only until you approve changes, to give you PowerShell commands and portal steps to run yourself, and to analyse the output you paste back.

Use it with care. Run commands only from a clean, trusted computer, and only with an account you are entitled to use. Never paste passwords, secrets or tokens into an AI tool, prefer a business AI service that does not train on your data, and check every remediation step before you run it. AI assistants can be wrong, and a compromised tenant may contain text designed to mislead them.

Think your Microsoft 365 tenant is compromised?

Our engineers can contain the breach, remove every backdoor and lock the tenant down properly.

Call the cyber security helpline