Agent Foskett Academy • SOC Analyst Academy • Module 8 • Lesson 72 • Threat Hunting: Looking Beyond the Alerts

Lesson 72 — One Query Found the Same Technique on Twelve Devices

Yesterday's hunt found one suspicious behaviour.

Browser activity followed by PowerShell execution.

So the analyst widened the query across the environment.

The result came back.

Twelve devices.

For a moment, the SOC room became very quiet.

Twelve compromised devices?
Twelve users affected?
A widespread attack?

Agent Foskett looked at the result count and asked:

“Does the query say twelve devices are compromised — or does it say twelve devices matched the query?”

Environmental scoping finds where a behaviour occurred. Investigation determines what those matches mean.
Agent Foskett scoping a threat hunting technique across multiple devices
Twelve matches are twelve questions.

Group the behaviour, compare context, identify clusters and turn a large result set into defensible scope.

✓ Scope
✓ Group
✓ Compare
✓ Investigate

Case briefing

HUNT: Browser → PowerShell RESULT: 12 DEVICES MATCH QUESTION 1: 12 compromised devices? NO. QUESTION 2: 12 devices where the behaviour occurred? YES. NOW INVESTIGATE: Which devices? Which users? Which commands? Which time patterns? Which are expected? Which form a cluster? Which remain unexplained?

Investigation objective

Scope one behavioural hunting pattern across the environment, reduce duplicate noise, identify meaningful clusters and determine which matching devices require deeper investigation.

Investigator's rule

A query result is scope for analysis — not scope for compromise.

Stage 1 — count devices before counting incidents

01-scope-browser-powershell.kql
1234567891011
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where InitiatingProcessFileName in~ (
    "msedge.exe", "chrome.exe", "firefox.exe"
)
| summarize Events=count(),
            FirstSeen=min(Timestamp),
            LastSeen=max(Timestamp)
          by DeviceId, DeviceName
| order by Events desc

Why summarise by device?

Hundreds of matching process events can come from a small number of endpoints. Grouping first gives the analyst an environmental view before individual event rows dominate the investigation.

Preserve stable identifiers

Where available, keep DeviceId alongside DeviceName. Names can change or be reused; stable identifiers help preserve entity context during investigation.

Stage 2 — twelve devices do not mean twelve equal leads

GroupDevicesInitial context
Development4PowerShell frequently used as part of expected workflows.
IT administration3Support activity likely, but commands still need validation.
Finance workstations3Behaviour unusual for these users and devices.
Shared kiosk1Unexpected scripting activity.
Build server1Automation may explain repeated execution.

Context changes priority

The same technical behaviour can carry very different investigative weight on a developer workstation, an administrator device, a finance workstation or a kiosk.

Do not clear by job title alone

Administrators legitimately use PowerShell, but attackers do too. Context can lower or raise priority; it should not replace evidence.

Stage 3 — compare the command lines

02-compare-command-lines.kql
1234567891011
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where InitiatingProcessFileName in~ (
    "msedge.exe", "chrome.exe", "firefox.exe"
)
| summarize Events=count(),
            Devices=dcount(DeviceId)
          by ProcessCommandLine
| order by Devices desc, Events desc

Shared commands can reveal clusters

If the same unusual command line appears across several unrelated devices, the investigation changes. The analyst now has a possible common technique or source to explain.

Different commands can reveal benign diversity

If twelve devices match the broad parent-child pattern but each has an unrelated, explainable command, the initial result count may exaggerate the apparent commonality.

Stage 4 — a cluster appears

12 MATCHING DEVICES 4 DEVELOPMENT └─ Expected workflow 3 IT └─ Support activity 1 BUILD SERVER └─ Expected automation 1 SHARED KIOSK └─ Needs review 3 FINANCE ├─ FIN-WS-083 ├─ FIN-WS-091 └─ FIN-WS-104 │ └─ SAME UNUSUAL COMMAND PATTERN WITHIN 18 MINUTES NOW THE HUNT HAS A STRONGER LEAD.

Similarity plus timing matters

Three finance devices showing a similar unusual command pattern within a narrow period is more informative than three unrelated matches spread across a week.

Correlation is not yet causation

The cluster strengthens the lead, but the SOC still needs to determine whether a shared business process, software deployment or malicious activity explains it.

Stage 5 — examine the cluster as a timeline

03-finance-cluster-timeline.kql
123456789
DeviceProcessEvents
| where Timestamp > ago(7d)
| where DeviceName in~ (
    "FIN-WS-083", "FIN-WS-091", "FIN-WS-104"
)
| project Timestamp, DeviceName, AccountName,
          FileName, ProcessCommandLine,
          InitiatingProcessFileName
| order by Timestamp asc

Put the devices on one clock

A combined timeline can expose sequencing: one device first, another minutes later, then a third. That pattern may suggest common delivery, propagation or coordinated user activity.

Compare the users too

Ask whether the same account appears across devices, whether different users received the same content or whether a shared service or application links the events.

Stage 6 — pivot beyond the original behaviour

ORIGINAL HUNT: Browser → PowerShell CLUSTER: 3 finance devices NEXT PIVOTS: PROCESS What ran before and after? FILE Was the same file created? NETWORK Did the processes contact the same destination? IDENTITY Were the same accounts or sessions involved? MESSAGING Did users receive related content? CLOUD Did activity continue beyond endpoint? THE ORIGINAL QUERY OPENED THE DOOR. IT DOES NOT FINISH THE INVESTIGATION.

Do not stay trapped in one table

The behaviour was discovered in process telemetry, but scoping may require file, network, identity, messaging or cloud evidence. Follow the entities and timeline.

Look for a common cause

When multiple devices share a technique, ask what connects them: software, user action, campaign, administrative tooling, shared content or attacker infrastructure.

Stage 7 — separate environmental matches from incident scope

Device setClassificationAction
4 development devicesBehaviour explained by validated workflowDocument context; retain as baseline knowledge.
3 IT devicesValidated support activityDocument and consider safe hunt refinement.
1 build serverExpected automationRecord expected pattern.
1 shared kioskUnresolvedContinue investigation.
3 finance devicesCorrelated suspicious clusterEscalate into incident scoping.

The hunt population can be larger than incident scope

All twelve devices belong in the hunt results. Only evidence-supported affected entities belong in confirmed incident scope.

Keep unresolved separate

The kiosk should not be silently cleared because it does not fit the finance cluster. Record it as unresolved and give it an explicit next action.

Stage 8 — ask whether the hunt needs refinement

NOISY MATCHES: Known developer workflow Known IT support activity Known build automation POSSIBLE REFINEMENT: Exclude only validated, well-understood patterns. BUT ASK: Will this exclusion hide future malicious use? Can the exclusion be made specific enough? Is the reason documented? Would another analyst understand it?

Refinement should reduce known noise

Good exclusions remove repeatable, validated behaviour while preserving visibility into similar activity outside that context.

Never create blind spots casually

A broad exclusion such as “ignore all PowerShell from administrator devices” could remove exactly the activity an attacker wants you to miss.

Stage 9 — write a defensible scope statement

HUNT FINDING: The behavioural query identified matches on 12 devices during the seven-day hunt period. 8 devices were associated with validated expected workflows. 3 finance devices formed a correlated suspicious cluster requiring incident investigation. 1 kiosk remains unresolved and is assigned for further review. CONCLUSION: 12 MATCHES ≠ 12 COMPROMISED DEVICES

Numbers need definitions

If you report “twelve affected devices,” stakeholders may interpret that as confirmed compromise. Use language that distinguishes matching, suspicious, unresolved and confirmed entities.

Preserve the hunt period and logic

Scope statements should make clear when the query ran, what period it covered and what behaviour it actually searched for.

Stage 10 — the hunt creates the next hunt

HUNT 1: Browser → PowerShell FOUND: Finance cluster NEW QUESTIONS: Did the same technique occur without a browser parent? Did another script engine appear? Did the same users show related cloud or identity behaviour? Did the cluster exist before the seven-day window? Did the attacker change the execution chain? THREAT HUNTING IS ITERATIVE.

Do not stop at the first successful query

A useful hunt result often creates better hypotheses. The SOC can now hunt adjacent techniques, earlier activity, alternate execution paths and related entities.

Keep the question connected to risk

Expansion should be deliberate. Every new hunt should explain what uncertainty it is trying to reduce or what attacker behaviour it is trying to expose.

Lesson 72 key takeaways

  • A matching device is not automatically a compromised device.
  • Summarise behavioural results by entity before investigating every event.
  • Preserve useful stable identifiers such as DeviceId alongside device names.
  • Context helps prioritise matching behaviour but does not replace evidence.
  • Compare command lines, users and timestamps to identify clusters.
  • Similarity plus temporal proximity can strengthen a hunting lead.
  • Pivot beyond the original telemetry source when the evidence requires it.
  • Separate expected, unresolved, suspicious and confirmed entities.
  • Refine known noise carefully without creating broad blind spots.
  • Write scope statements that define exactly what the numbers mean.
  • A successful environmental hunt often creates the next hypothesis.
  • Threat hunting is iterative, evidence-led scoping.

Module 8 — Threat Hunting: Looking Beyond the Alerts

Lesson 72 took one behavioural query and scoped it across the environment without confusing matches with compromise. Lesson 73 goes further: the alert queue may be quiet while proactive hunting uncovers related activity the alerts never surfaced.

Next: Lesson 73 — The Alert Was Quiet — The Hunt Wasn't

Continue your SOC Analyst training

Module 3 focuses on identity incidents, authentication, MFA, privilege, sessions and application access.

How do threat hunters scope suspicious behaviour across multiple devices?

Lesson 72 of the Agent Foskett SOC Analyst Academy teaches analysts how to use Microsoft Defender XDR Advanced Hunting and KQL to scope one behavioural technique across an environment, group results by device and identify meaningful clusters.

How do you distinguish threat hunting matches from compromised devices?

Learn how to separate matching behaviour from confirmed incident scope, compare commands and timelines, validate expected workflows, investigate unresolved devices and write defensible environmental scope statements.