Query Details
id: 7b8c9d10-aaaa-4001-8001-00000000000A
name: HUNT - Token session hijack indicators on Intune resources
description: |
Looks for non-interactive sign-ins to Intune / Device Management / Graph where the
same session id is seen from two different countries or two different user agents
within a short window — indicator of refresh-token / session-cookie replay.
requiredDataConnectors:
- connectorId: AzureActiveDirectory
dataTypes:
- AADNonInteractiveUserSignInLogs
tactics:
- CredentialAccess
- LateralMovement
relevantTechniques:
- T1528
- T1550.001
query: |
let NetworkAllowlist = _GetWatchlist('NetworkAllowlist') | project IPRange = tostring(SearchKey);
let AllowedRanges = toscalar(NetworkAllowlist | summarize make_list(IPRange));
AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(1d) and ResultType == 0
| where ResourceDisplayName has_any ("Microsoft Intune","Device Management","Microsoft Graph","Windows 365")
| where not(ipv4_is_in_any_range(tostring(IPAddress), AllowedRanges))
| extend Country = tostring(parse_json(tostring(LocationDetails)).countryOrRegion),
SessionId = tostring(SessionLifetimePolicies)
| summarize Countries = dcount(Country), UAs = dcount(UserAgent),
IPs = make_set(IPAddress, 10),
CountryList = make_set(Country, 5),
UAList = make_set(UserAgent, 5),
Events = count()
by UserPrincipalName, bin(TimeGenerated, 30m)
| where Countries > 1 or UAs > 2
| order by TimeGenerated desc
version: 1.0.0
This query is designed to detect potential security threats related to session hijacking on Intune resources. Here's a simple breakdown of what it does:
Purpose: The query aims to identify suspicious non-interactive sign-ins to Intune, Device Management, or Microsoft Graph services. It looks for instances where the same session ID is used from different countries or with different user agents within a short time frame, which could indicate a session hijack.
Data Source: It uses data from Azure Active Directory's non-interactive user sign-in logs.
Detection Logic:
Output: The query orders the results by the time of the event, showing the most recent events first.
Security Context: This query is part of a hunting strategy to detect credential access and lateral movement tactics, specifically targeting techniques related to session hijacking (T1528 and T1550.001).
Overall, this query helps security teams identify and investigate potential unauthorized access attempts that may involve session token or cookie replay attacks.

David Alonso
Released: April 22, 2026
Tables
Keywords
Operators