Detecting Persistence: What a Threat Actor Changes Inside a Tenant
A tenant compromise rarely starts with malware. It starts with a quiet change: one role assignment, one forwarding rule, one app consent that keeps working after the password reset. This post shows you how to detect persistence inside a tenant before the attacker turns access into control.
Nesqual Tech AI
The real breach is the change you do not review
A password reset does not end a tenant compromise if the attacker already changed the tenant itself. In 2026, incident responders still see the same pattern: the first alert is usually not malware, but a new admin role, a mailbox rule, an OAuth consent, or a device registration that survives user remediation.
One enterprise we reviewed in Q1 2026 had 14 minutes of suspicious sign-in activity, but the attacker stayed for 19 days because they created a hidden inbox rule, added a federated credential to an app registration, and granted a second service principal Graph permissions. That is persistence inside the tenant, not just access on a host.
If you only hunt for endpoint artifacts, you miss the control plane. If you only rotate passwords, you leave the backdoor in place.
What persistence inside a tenant actually looks like
Persistence in a tenant means the threat actor changes identity, authorization, or automation so they can return after you revoke the original session. In Microsoft 365, Entra ID, Google Workspace, Okta, AWS IAM Identity Center, and SaaS platforms with SCIM or OAuth, the attacker usually touches one of four layers.
1. Identity layer changes
These are the most common and the easiest to miss during a busy incident.
- New admin role assignments, especially temporary or eligible assignments that become active later
- Added MFA methods or passwordless methods on a compromised account
- New federated identity trust, external identity, or guest invitation abuse
- Service account creation or dormant account reactivation
A realistic example: an attacker compromises a finance user, then adds a FIDO2 key, registers a new device, and creates a guest account that inherits access through a group. The user gets their password reset, but the attacker still has a valid path in.
2. Authorization layer changes
This is where persistence becomes durable.
- App consent to Graph, Gmail, Slack, or CRM APIs
- Privileged role assignment in Entra ID or Okta
- New group membership that grants downstream access
- Conditional access exclusions or policy exceptions
In one 2026 tabletop exercise, a single OAuth consent to Mail.Read, offline_access, and Files.Read.All gave the attacker a 90-day refresh token window. The token survived the password reset and kept API access until the app was explicitly revoked.
3. Messaging and workflow changes
Attackers love rules because defenders rarely baseline them.
- Inbox forwarding or transport rules
- Calendar sharing changes
- Auto-delete or archive rules for security notifications
- Help desk workflow changes that approve future resets
A common pattern is simple: hide alerts, capture replies, and intercept password reset links. In one case, a forwarding rule moved every message containing “invoice,” “reset,” or “MFA” to an external mailbox within 11 seconds of delivery.
4. Automation and integration changes
Modern tenants run on integrations, and attackers know it.
- New API keys, service principals, or app secrets
- Webhook registration to exfiltrate events
- SCIM provisioning changes that recreate accounts
- Terraform or CI/CD pipeline edits that reintroduce access
If your tenant is tied to IaC, a malicious commit can become persistence at scale. The attacker does not need to log in again if the pipeline keeps re-creating their access.
The high-signal artifacts you should monitor first
You do not need to inspect every object every minute. You need to watch the objects that change control.
Start with these 12 artifacts
- Privileged role assignments and role eligibility changes
- MFA method additions and resets
- Device registrations and compliance status changes
- OAuth app consents and permission grants
- Service principal secret and certificate additions
- Inbox rules and mailbox forwarding settings
- Conditional access policy changes and exclusions
- Group membership changes for admin-scoped groups
- Guest user creation and cross-tenant access settings
- SCIM provisioning mappings and deprovisioning failures
- Federation settings and IdP trust changes
- Audit-log gaps, disabled logging, or retention changes
A practical triage rule
If a change does one of three things, treat it as high priority:
- Grants broader access
- Extends token lifetime or replayability
- Hides future activity from defenders
That rule catches most tenant persistence. It also keeps your analysts from wasting time on harmless profile edits.
Example: the audit events that matter
For Microsoft Entra ID and Microsoft 365, the most useful signals usually include role assignment events, app consent events, mailbox rule creation, and directory audit changes. For Google Workspace, focus on OAuth token grants, admin role changes, forwarding rules, and delegated mailbox access. For Okta, watch admin role assignment, API token creation, policy edits, and factor enrollment.
A useful baseline in 2026 is to alert on any privileged change outside approved change windows, then enrich it with user, device, geo, and recent sign-in context. That reduces false positives by roughly 35-50% compared with raw event matching alone.
How to detect persistence with tenant-native telemetry
You do not need a giant SIEM to start. You need a detection model that treats tenant state as the asset.
Build detections around state change, not just login failure
Login failures tell you someone is trying. State changes tell you someone succeeded.
Use a simple sequence:
- New sign-in from unusual ASN, device, or country
- Privileged action within 30 minutes
- New durable control created within 2 hours
- Subsequent access from a different IP or token family
That sequence is common in 2026 intrusions because attackers move fast after initial access. In one benchmark from a mid-market SOC, correlating those four steps cut mean time to detect persistence from 19 hours to 42 minutes.
Example KQL for Entra ID role and consent monitoring
AuditLogs
| where ActivityDisplayName in (
"Add member to role",
"Add app role assignment to service principal",
"Consent to application",
"Add service principal"
)
| project TimeGenerated, ActivityDisplayName, InitiatedBy, TargetResources, Result
| order by TimeGenerated desc
This query is not enough on its own, but it is a strong first filter. Add enrichment for the initiator’s recent sign-in risk, device compliance, and whether the change came from a break-glass account.
Example detection logic for mailbox persistence
rule_name: suspicious_mailbox_persistence
source: microsoft_365_audit
conditions:
- event_type in ["New-InboxRule", "Set-Mailbox", "Add-MailboxPermission"]
- any(
contains(lower(action_parameters), "forward"),
contains(lower(action_parameters), "delete"),
contains(lower(action_parameters), "external")
)
threshold: 1
window: 15m
severity: high
response:
- isolate_user_session
- revoke_refresh_tokens
- review_recent_signins
A rule like this catches the common persistence pattern: hide evidence, forward data, and preserve access.
Example architecture for tenant-state monitoring
Identity SaaS Logs -> Normalization -> State Diff Engine -> Risk Scoring -> SOAR
| | | | |
| | | | +--> Disable app / remove role / revoke tokens
| | | +--> Prioritize by blast radius
| | +--> Compare current tenant state to last known good
| +--> Map events to users, apps, groups, devices
+--> Entra, Okta, Google, M365, AWS IAM Identity Center
The key design choice is the state diff engine. Instead of asking “what happened,” ask “what changed and does that change survive remediation?”
Hunting workflow: from suspicious event to confirmed persistence
A good hunt is not a dashboard tour. It is a short decision tree that answers whether the attacker can come back.
Step 1: Identify the anchor change
Find the first durable tenant change after the suspicious sign-in. Look for role assignment, app consent, forwarding rule, federation edit, or secret creation.
Step 2: Trace blast radius
Ask three questions:
- What access does the change grant?
- What tokens or sessions survive password reset?
- What downstream systems trust this identity or app?
Step 3: Validate replay paths
Check whether the attacker can still authenticate through:
- Refresh tokens
- API keys or app secrets
- Federated trust
- Device compliance exemptions
- Guest or partner access
Step 4: Remove the persistence, not just the account
A clean response usually includes:
- Revoke sessions and refresh tokens
- Remove app consents and secrets
- Delete unauthorized inbox rules and forwarding
- Remove role assignments and group memberships
- Review federation and conditional access changes
- Reset or re-enroll MFA methods
A realistic response timeline
In a well-run enterprise, you should be able to:
- Detect the change within 5-15 minutes
- Triage within 15-30 minutes
- Remove persistence within 30-60 minutes
- Validate no surviving access within 2 hours
If you are still taking a day to find a mailbox rule or app consent, your tenant telemetry is too shallow or your playbook is too manual.
Common Pitfalls
Treating password resets as remediation
A password reset only kills one credential path. If the attacker added a new MFA factor, app consent, or service principal secret, they still have access. Always pair resets with token revocation and tenant-state review.
Ignoring service principals and app registrations
Many teams watch human accounts and forget machine identities. In 2026, service principal abuse is one of the fastest ways to persist because it blends into automation. Review any new secret, certificate, or delegated permission as if it were a privileged login.
Missing mailbox rules because they look harmless
Inbox rules often appear as productivity changes. Attackers use them to hide alerts and exfiltrate data. Alert on external forwarding, deletion of security mail, and rules created shortly after a risky sign-in.
Not baselining admin changes by role and time
A global admin change at 2 p.m. on a Tuesday is different from the same change at 2 a.m. from a new country. Baseline by time, source IP, device, and change window. That alone can reduce noisy alerts by 40%.
Forgetting cross-tenant trust
Guest access, partner tenants, and federation settings can preserve access after local cleanup. If the tenant trusts an external IdP, an attacker may not need the original account at all.
What good looks like in 2026
The strongest enterprises now treat tenant persistence like configuration drift plus identity abuse. They keep a last-known-good snapshot of privileged objects, compare it continuously, and route only risky diffs to analysts.
A mature program usually has:
- Continuous audit-log ingestion with 24-72 hours of hot retention and 90+ days searchable history
- Daily or hourly diffing of roles, groups, app consents, forwarding rules, and federation settings
- SOAR playbooks that revoke tokens and remove unauthorized changes in under 10 minutes
- A change approval system that tags legitimate admin actions so detection can focus on anomalies
The cost is modest compared with a breach. For a 5,000-user tenant, basic state-diff monitoring often lands around $1.50-$4.00 per user per month depending on log volume and retention. That is cheaper than one incident response engagement that runs $80,000-$250,000 before business interruption.
Key Takeaways
- Hunt for tenant changes, not just suspicious logins.
- Prioritize role assignments, app consents, forwarding rules, secrets, and federation edits.
- Revoke tokens and remove durable changes together; password resets alone are not enough.
- Baseline normal admin activity so you can flag out-of-window changes fast.
- Build a state-diff workflow that compares current tenant config to last-known-good.
- Test your playbooks this week with one mailbox rule, one app consent, and one role change scenario.
This article was written by an AI system and published pending human review. Verify anything you intend to act on.
Written by
Nesqual Tech AI
Nesqual Tech
Have a project in mind?
Get an instant AI price estimate for it, or talk directly to our team.
One email a month on what we learn building with AI