Abstract: Machine learning (ML) is increasingly applied to network security for automated threat detection. However, its practical success is often hindered by the "closed world" nature of network data, characterized by extreme class imbalance and the high operational cost of false positives. This paper presents a systematic evaluation of ML-based botnet detection, focusing on the impact of feature engineering, algorithm selection, and labeling precision. Using the CTU-13 dataset, the authors demonstrate that aggregating traffic statistics over short time windows and employing ensemble models like Random Forest and Gradient Boosting significantly outperforms traditional linear models. A critical finding is that "fine-grained" labeling—identifying specific malicious flows rather than labeling entire infected hosts—is a primary driver of model performance, enabling F1 scores as high as 0.98.
Introduction
The application of machine learning to cybersecurity is often viewed as a panacea for identifying complex threats. Yet, practitioners face significant hurdles: most network traffic is unlabeled, "normal" behavior is highly diverse, and the penalty for false positives is severe, as they consume limited analyst resources. Many existing ML-based security solutions are proprietary "black boxes" that lack transparent design principles. This research addresses these challenges by providing a principled framework for designing ML-based botnet detectors. The authors argue that the success of such models depends less on the specific algorithm and more on the nuances of feature representation and the precision of ground-truth labeling.
Methodology
The researchers developed a modular pipeline designed to process network logs and generate predictions. The system ingests raw logs (specifically Zeek/Bro logs) and passes them through a feature extraction layer before feeding them into various ML classifiers.
The study evaluated three distinct feature representations:
- Connection-level features: Raw data extracted directly from logs, such as IP addresses, ports, connection duration, and byte counts.
- Aggregated traffic statistics: Summary statistics (sum, min, max) calculated over fixed time windows for specific high-traffic ports (e.g., HTTP, DNS, SMTP).
- Temporal features: Statistics derived from the "inter-arrival time" between successive communications.
These features were tested against three common algorithms: Logistic Regression (a linear baseline), Random Forest, and Gradient Boosting (ensemble methods). The evaluation utilized the CTU-13 dataset, a public benchmark containing botnet traffic (e.g., Neris, Rbot) interspersed with legitimate campus traffic. To ensure realistic evaluation, the authors trained models on specific attack scenarios and tested them on independent, unseen scenarios.
Key Insights and Results
The research yielded several critical insights into the design of effective network classifiers:
- The Power of Aggregation: Raw connection logs are often too granular and noisy to reveal the underlying patterns of malicious activity. By aggregating traffic statistics over time windows (optimally 30–60 seconds), the models can better identify behavioral signatures, such as the rapid-fire scanning or spamming characteristic of botnets.
- Labeling Granularity: A common pitfall in security research is "coarse-grained" labeling, where every connection from an infected host is marked as malicious. The authors demonstrate that this approach introduces significant noise. By employing "fine-grained" labeling—isolating only the specific flows involved in the attack—model performance improves dramatically.
- Ensemble Methods and Class Imbalance: Malicious traffic typically constitutes a tiny fraction of total network volume (often a 1:400 ratio). Simple linear models like Logistic Regression struggle with this extreme imbalance. In contrast, ensemble methods like Gradient Boosting and Random Forest achieve superior results, with F1 scores reaching between 0.94 and 0.98.
- Temporal Sensitivity: The choice of the aggregation time window is a critical hyperparameter. Performance was found to peak at 30–60 seconds. When the window exceeds 120 seconds, the malicious signal becomes "diluted" by background noise, leading to a significant degradation in detection accuracy.
Conclusion
This study provides a much-needed "sanity check" for ML in cybersecurity. It highlights that while ensemble models are powerful, their effectiveness is heavily dependent on feature engineering and labeling precision. While fine-grained labeling is difficult to achieve in real-time production environments, it serves as a vital benchmark for model training. Future research should explore how to bridge the gap between these supervised methods and anomaly detection to better identify novel "zero-day" threats that lack historical labels.
Summary updated