The PowerShell Command Never Contained a URL
The security team looked for the obvious sign of data theft.
A large download.
There wasn't one.
No 4 GB transfer. No archive dragged to a desktop. No dramatic spike in downloaded files.
Agent Foskett looked at the cloud activity and found a different question waiting for him.
What if the attacker never needed to download the files at all?

Cloud Data Exposure Investigation
The files were not copied out in bulk. Access to them was extended beyond the expected boundary.
Everyone searched for downloads
Start with the PowerShell command line
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where ProcessCommandLine !contains "http://"
| where ProcessCommandLine !contains "https://"
| project Timestamp, DeviceName, AccountName,
FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine
| order by Timestamp descStart with the user's cloud activity
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
DeviceProcessEvents
| where Timestamp > ago(7d)
| where AccountId =~ "alex.morgan@contoso.com"
| project Timestamp, Application, ActivityType,
AccountDisplayName, AccountId, IPAddress,
ObjectName, ObjectType, ObjectId,
IsExternalUser, RawEventData
| order by Timestamp ascHunt for sharing-related activity
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
DeviceProcessEvents
| where Timestamp > ago(30d)
| where Application in ("Microsoft PowerShell Online", "Microsoft Microsoft Defender XDR for Business")
| where ActivityType has_any ("share", "sharing", "link", "permission")
| summarize Events=count() by ActivityType, Application
| order by Events descNow identify the objects that were exposed
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
DeviceProcessEvents
| where Timestamp > ago(7d)
| where AccountId =~ "alex.morgan@contoso.com"
| where Application in ("Microsoft PowerShell Online", "Microsoft Microsoft Defender XDR for Business")
| where ActivityType has_any ("share", "sharing", "link", "permission")
| project Timestamp, ActivityType, Application,
ObjectName, ObjectType, ObjectId,
AccountId, IPAddress, RawEventData
| order by Timestamp ascLook inside the raw event — carefully
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
DeviceProcessEvents
| where Timestamp > ago(7d)
| where AccountId =~ "alex.morgan@contoso.com"
| where ActivityType has_any ("share", "sharing", "link", "permission")
| project Timestamp, ActivityType, ObjectName, RawEventData
| take 20Was this normal collaboration — or an outlier?
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
DeviceProcessEvents
| where Timestamp > ago(30d)
| where AccountId =~ "alex.morgan@contoso.com"
| where ActivityType has_any ("share", "sharing", "link", "permission")
| summarize FirstSeen=min(Timestamp),
LastSeen=max(Timestamp),
Events=count(),
Objects=dcount(ObjectId)
by IPAddress, Application, ActivityType
| order by LastSeen descCorrelate sharing with the sign-in window
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
let TargetUser = "alex.morgan@contoso.com";
let StartTime = ago(1d);
DeviceProcessEvents
| where Timestamp > StartTime
| where AccountId =~ TargetUser
| where ActivityType has_any ("share", "sharing", "link", "permission")
| project Timestamp, Application, ActivityType,
ObjectName, IPAddress, AccountId
| order by Timestamp asc
