Skip to content

Instantly share code, notes, and snippets.

@WesSec
WesSec / gist:b393789b993ebd79024ea5cbb66a3139
Last active January 7, 2025 14:11
Detect roadrunner/ AD Graph via Company Portal app
AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(30d)
// Filter for Company portal
| where AppId == "9ba1a5c7-f17a-4de9-a1f1-6178c8d51223"
// Filter for the Windows Azure AD api
| where ResourceIdentity == "00000002-0000-0000-c000-000000000000"
| extend parseddevice = parse_json(DeviceDetail)
// Filter for devices without DeviceID (those are non joined devices, likely an attacker)
| where isempty(parseddevice.deviceId)
// Filter operating systems or devices in the enviroment which are known non joined
@WesSec
WesSec / gist:c8d8a65038633bfbccbe5a79d632e59b
Last active September 7, 2022 11:24
Advanced hunting: Only return columns that contain values
<Query>
| extend values = pack_all()
| mv-apply values on
(
mv-expand kind = array values
| where isnotempty(values[1])
| summarize EmptyValuesRemoved = make_bag(pack(tostring(values[0]), values[1]))
)
| project EmptyValuesRemoved
| evaluate bag_unpack(EmptyValuesRemoved)