DET-140 · human · confidence Medium
Short-Lived Grants and Tokens
Find OAuth grants or access tokens created, used heavily and removed within a few days.
Cover-up after data theft often means removing the app or token used. Joining grant and token creation with their removal, and with API volume in between, surfaces this pattern even when the current state looks clean.
Short grant windows are normal when people try apps, so focus on those with high API volume between grant and removal. Personal access tokens on code hosts show the same pattern when they are deleted right after a mass clone. Keep the grant history even after removal so investigators can see it.
- Data sources
- Microsoft Entra ID audit logsGoogle Workspace OAuth Token audit logGitHub audit log
- Platforms
- Microsoft 365Google WorkspaceSaaSIdentity
Logic
let grants = AuditLogs | where OperationName in ("Consent to application", "Add delegated permission grant") | project GrantTime = TimeGenerated, AppId = tostring(TargetResources[0].id), User = tostring(InitiatedBy.user.userPrincipalName);
let removals = AuditLogs | where OperationName in ("Remove delegated permission grant", "Remove service principal", "Delete application") | project RemoveTime = TimeGenerated, AppId = tostring(TargetResources[0].id);
grants | join removals on AppId | where RemoveTime - GrantTime < 7d
| join kind=leftouter (MicrosoftGraphActivityLogs | summarize Calls = count() by AppId) on AppIdFalse positives
Users trying an app and removing it when it does not fit.