Defensive methodology

Threat hunting

Actively searching for an attacker who has not triggered any alert. You assume the compromise may already have happened, and you check it methodically.

DefensiveHypothesesMITRE ATT&CKPyramid of Pain

The hunting loop

  1. HypothesisA testable assumption, based on a realistic threat.
  2. DataWhich sources can confirm it? Are they available?
  3. InvestigationQueries, grouping, looking for rare values.
  4. OutcomeConfirmed: move to incident response. Refuted: document it.
  5. ImprovementTurn the hunt into an automatic detection rule.

Writing a good hypothesis

A useful hypothesis is precise, relies on a known technique and says where to look.

Too vague

“There may be an attacker on the network.”

Actionable

“An attacker may have set up persistence through a scheduled task (T1053.005) on the servers. We look for 4698 events created outside maintenance windows.”

Where hypotheses come from

  • Threat intelligence: reports on the groups targeting your sector.
  • MITRE ATT&CK: techniques poorly covered by current detections.
  • Past incidents and lessons learned.
  • Knowledge of the environment: critical assets, sensitive access.

Analysis techniques

TechniquePrinciple
Stacking (counting)Group and count: what shows up only once or twice across the estate deserves a look.
BaselineCompare current activity with usual behaviour.
PivotingStart from an indicator (IP, hash, account) and follow its links.
TimelinePlace events in time around a suspicious point.

IOC, IOA and the Pyramid of Pain

An IOC (indicator of compromise) is a trace left behind: hash, IP, domain. An IOA (indicator of attack) describes a behaviour. The higher up the pyramid you detect, the more work the attacker must do to evade you.

LevelExampleCost to the attacker
TTPsBehaviour: accessing lsass memoryVery high
ToolsA specific toolHigh
Network / host artefactsUser-Agent, registry key, pipe nameMedium
Domain namesThe C2 server's domainLow
IP addressesThe C2 server's IPVery low
HashesA file's SHA-256Trivial

Hunt ideas

  • Processes launched from temporary or user-profile folders
  • Legitimate Windows binaries used in unusual ways (LOLBins)
  • Regular outgoing connections to a rare destination (beacons)
  • Recently created services and scheduled tasks
  • Accounts logging on to an abnormal number of machines
  • DNS queries to very new or high-entropy domains
  • Logons outside usual hours