Skip to content

Threat hunting

noun · also Hunting, Cyber threat hunting · MITRE ATT&CK

The proactive search for attackers who are already inside the environment but have not triggered any alert, usually starting from a hypothesis.

Alerts only catch what someone already wrote a rule for. Threat hunting assumes that a capable attacker may have slipped past those rules, and goes looking for them. Instead of waiting for an alert, the hunter starts from a hypothesis, often inspired by threat intelligence or by a technique in MITRE ATT&CK, and searches the data for evidence that supports or disproves it.

A hunt has three possible outcomes: you find malicious activity and open an incident, you find a gap in your logging or detections and fix it, or you confirm the activity is not present. All three are useful.

Where hypotheses come from

  • Threat intelligence. A report describes a group that persists with scheduled tasks or abuses a specific tool. Do we see it? See threat intelligence.
  • MITRE ATT&CK. Pick a technique relevant to your environment and check whether it happens, and whether you would detect it. See MITRE ATT&CK.
  • Recent incidents. If an attacker used a technique once, hunt for it everywhere else.
  • Changes in the environment. A new VPN, a migration, a new SaaS app: new places where an attacker could hide.
  • Anomalies. Rare processes, unusual logon types, accounts active at odd hours. These start as statistics and become hypotheses once you can explain why they would matter.

How a hunt works

  1. State the hypothesis in one sentence: "an attacker has used encoded PowerShell on our servers in the last 30 days".
  2. Identify the data that would show it, and check it is actually collected. A hunt without the right logs proves nothing.
  3. Query broadly, then narrow. Start with everything that matches, then remove known-good activity with explicit, documented exclusions.
  4. Investigate what remains. Read command lines, process trees and context for each result.
  5. Record the outcome: what you looked for, where, the query, what you found and what you excluded.
  6. Turn it into something lasting: an incident, a new detection rule, a logging fix, or a scheduled re-run of the hunt.

Example

A threat report describes attackers who create scheduled tasks to keep access to compromised servers. The hypothesis: "an attacker has created a scheduled task on one of our servers in the last 30 days". The hunter queries endpoint data for task creation events, filters out tasks created by known software deployment tools, and reviews the handful that remain.

hunt-scheduled-tasks.kql
DeviceProcessEvents
| where Timestamp > ago(30d)
| where FileName =~ "schtasks.exe" and ProcessCommandLine has "/create"
| where InitiatingProcessFileName !in~ ("ccmexec.exe", "msiexec.exe")
| summarize Count = count(), Devices = dcount(DeviceName),
    Examples = make_set(ProcessCommandLine, 5) by InitiatingProcessFileName, AccountName
| sort by Devices asc

Sorting by the number of devices puts the rare cases first: a task created by an unusual parent on one or two servers is far more interesting than a management tool doing the same on every machine. Adjust the exclusions to the deployment tools your environment actually uses.

Hunting and detection

Hunting and detection rules feed each other. Rules catch the known; hunting explores the unknown. When a hunting query finds something real, or proves that a pattern is rare enough to alert on, it should become a scheduled rule, as shown in your first Sentinel analytics rule. When it finds nothing, the query can still run on a schedule as a safety net.

Common mistakes

  • Hunting without a hypothesis: scrolling through data in the hope that something stands out rarely works.
  • Ignoring data gaps: no results from a source you do not collect is not a clean result.
  • Exclusions without notes: an exclusion nobody can explain later is how attackers end up hidden by your own filters.
  • Not writing it down: an undocumented hunt cannot be repeated, reviewed or turned into a rule.

Why it matters for a SOC analyst

Hunting is where analysts move from reacting to alerts to understanding how attackers really operate. It is also where many new detections are born. In Microsoft environments, most hunting is done with KQL in Defender XDR advanced hunting or Microsoft Sentinel; the PowerShell hunting tutorial is a good first hunt to practice.

Articles that use this term

  1. Tools · · 4 min read

    SIEM, XDR and SOAR: what each one does in a SOC

    SIEM, XDR and SOAR explained for people new to security operations: what each tool collects, what it decides, where they overlap and how they fit together.

  2. Certifications · · 3 min read

    SC-200 study plan for SOC beginners

    A six-week plan to prepare for Microsoft's Security Operations Analyst exam: what to study each week, how to practice for free, and the KQL you need to know.

  • Threat intelligence

    Information about threats and threat actors, collected and analyzed so that an organization can make better security decisions.

  • Tactics, techniques and procedures

    How an attacker operates: the goal of each step (tactic), the method used to reach it (technique) and the specific way it is carried out (procedure).

  • MITRE ATT&CK

    A free, public knowledge base of adversary tactics and techniques based on real-world observations, used as a common language for attack and defense.

  • KQL

    The read-only query language used by Microsoft Sentinel, Defender XDR advanced hunting, Azure Monitor and Azure Data Explorer.