Low-Quality Training Data Only? A Robust Framework for Detecting Encrypted Malicious Network Traffic

Yuqi Qing, Qilei Yin, Xinhao Deng, Yihao Chen, Zhuotao Liu, Kun Sun, Ke Xu, Jia Zhang, Qi Li

Abstract

Machine learning (ML) is promising in accurately detecting malicious flows in encrypted network traffic; however, it is challenging to collect a training dataset that contains a sufficient amount of encrypted malicious data with correct labels. When ML models are trained with low-quality training data, they suffer degraded performance. In this paper, we aim at addressing a real-world low-quality training dataset problem, namely, detecting encrypted malicious traffic generated by continuously evolving malware. We develop RAPIER that fully utilizes different distributions of normal and malicious traffic data in the feature space, where normal data is tightly distributed in a certain area and the malicious data is scattered over the entire feature space to augment training data for model training. RAPIER includes two pre-processing modules to convert traffic into feature vectors and correct label noises. We evaluate our system on two public datasets and one combined dataset. With 1000 samples and 45% noises from each dataset, our system achieves the F1 scores of 0.770, 0.776, and 0.855, respectively, achieving average improvements of 352.6%, 284.3%, and 214.9% over the existing methods, respectively. Furthermore, We evaluate RAPIER with a real-world dataset obtained from a security enterprise. RAPIER effectively achieves encrypted malicious traffic detection with the best F1 score of 0.773 and improves the F1 score of existing methods by an average of 272.5%.

Introduction

As network traffic increasingly shifts toward encryption (e.g., HTTPS, TLS 1.3), traditional deep packet inspection (DPI) methods are becoming obsolete. Machine learning (ML) has emerged as a powerful alternative for identifying malicious flows. However, ML models are notoriously sensitive to data quality. In real-world network security, high-quality training data is a luxury. Label noise is rampant due to inconsistent automated labeling services like VirusTotal, and data scarcity is common as new malware variants evolve faster than they can be manually labeled. This "garbage in, garbage out" scenario often leads to significant performance degradation in standard detection models.

The RAPIER Framework

To address these challenges, we propose RAPIER (Robust FrAmework for Detecting Encrypted Malicious Traffic). RAPIER is designed to operate effectively even when training data is small and heavily mislabeled. The framework consists of four integrated modules that transform raw traffic into a high-quality training set for a robust detector.

The four-stage RAPIER framework: Feature Extraction, Label Correction, Data Augmentation, and ML-based Detection.
  1. Unsupervised Feature Extraction (GRU-AE): RAPIER utilizes a Bi-directional Gated Recurrent Unit Auto-Encoder to learn the underlying structure of packet length sequences. By using an unsupervised approach, the feature learning process remains untainted by potentially incorrect labels.
  2. Distribution-Aware Label Correction: This module leverages the core observation that benign traffic is "dense" and predictable, while malicious traffic is "sparse" and scattered. It uses a generative model (MADE) to estimate data density and automatically relabel samples.
  3. Strategic Data Augmentation (Improved GAN): To combat data scarcity and malware evolution, RAPIER uses a Generative Adversarial Network (GAN) with three specialized generators. These generators synthesize traffic in "boundary regions" and "zero-day regions" to prepare the model for future threats.
  4. Robust Detection: The final stage employs a Co-teaching approach, where two neural networks filter out likely noisy samples for each other, ensuring the final classifier is trained on the cleanest possible data.

Distribution-Aware Label Correction

The "secret sauce" of RAPIER is its ability to identify truth through data density. Benign traffic typically follows strict protocols and user habits, causing it to cluster tightly in the feature space. In contrast, malicious traffic is diverse and lacks a singular pattern, appearing scattered.

Visualization of how RAPIER identifies label noise by mapping feature space to sample density.

By treating label correction as a density estimation problem, RAPIER can identify "label noise"—such as a malicious label appearing in a high-density benign cluster—and correct it without requiring a clean initial dataset. This allows the system to reduce label noise ratios significantly, for example, from 45% down to less than 4.3% in real-world enterprise tests.

Experimental Results

We evaluated RAPIER across several benchmarks, including DoHBrw2020 (DNS-over-HTTPS), CSE-CIC-IDS2018, and a real-world enterprise dataset containing over 3.6 million flows.

Key findings include:

  • Extreme Noise Resilience: Even with a training set of only 1,000 samples and a 45% noise ratio, RAPIER achieved F1 scores between 0.77 and 0.85.
  • Superior Performance: RAPIER outperformed state-of-the-art methods like FS-Net and ETA by an average of 214% to 352% in high-noise scenarios.
  • Real-World Efficacy: On enterprise data, RAPIER achieved a peak F1 score of 0.773, representing a 272.5% improvement over existing robust detection methods.

Conclusion

RAPIER demonstrates that high-quality detection is possible even with low-quality data. By shifting the focus from simple classification to distribution-aware density estimation and strategic augmentation, RAPIER provides a robust defense against evolving, encrypted threats. Future work will focus on countering adversarial mimicry, where attackers attempt to replicate the dense distribution patterns of benign protocols to evade detection.

Summary updated

BibTeX
@inproceedings{qing2024low,
  author = {Yuqi Qing and Qilei Yin and Xinhao Deng and Yihao Chen and Zhuotao Liu and Kun Sun and Ke Xu and Jia Zhang and Qi Li},
  title = {{Low-Quality Training Data Only? A Robust Framework for Detecting Encrypted Malicious Network Traffic}},
  booktitle = {NDSS},
  year = {2024},
  url = {https://openreview.net/forum?id=ToPzF89aMP},
}
Figure