Unsupervised learning analyzes unlabeled data to find hidden structure: similar records can be grouped, and unusual records can stand apart, without being told which records are benign or malicious. In threat hunting, it shifts the starting point from a fixed indicator or threshold to patterns present in the data. section 8.1 section 8.1.8
Use it after understanding and preparing the data, not as a replacement for that work. Extract useful features from raw events, encode non-numeric values appropriately, inspect correlations, and remove highly correlated fields before applying an algorithm. Data preprocessing can determine whether resulting clusters are meaningful. section 8.1.2 section 8.1.8 section 8.8
A practical unsupervised threat-hunting workflow is:
- Collect connection events from a data store or file, retaining fields that may describe behavior. section 8.1.2
- Calculate behavioral features such as connection timing, counts, variance, and inbound-versus-outbound byte differences. section 8.1.2
- Apply a clustering algorithm such as k-means to group data points, then examine small or unusual clusters for anomalies. section 8.0 section 8.3.2
- Investigate cluster members, excluding known normal traffic carefully rather than treating cluster assignment as a verdict. section 8.3.2 section 8.8
Finding jittered command-and-control traffic
A hunt can start with a hypothesis that compromised internal hosts beacon to a command-and-control server with an unknown interval, jitter level, port, or destination. After k-means assigns connection records to four clusters, inspecting two small clusters can expose malicious beaconing without setting a standard-deviation threshold first. Clustering remains imperfect: malicious connections may span multiple clusters. section 8.1.8 section 8.3.2
Figure 8.1 Threat hunting with unsupervised machine process
Follow the end-to-end threat-hunting process from unlabeled event data through preparation, modeling, and anomaly investigation. section 8.1
Treat outputs as leads, not proof. Algorithms have different rules and tunable parameters; compare approaches when needed, seek specialist help for deeper mathematical questions, and use findings to help create labeled data for later supervised learning. section 8.8



















