Facing Unknown: Open-World Encrypted Traffic Classification Based on Contrastive Pre-Training

Xiang Li, Beibei Feng, Tianning Zang, Shuyuan Zhao, Jingrun Ma · DOI

Abstract

Modern network traffic is predominantly encrypted, complicating identification and security management. Traditional Encrypted Traffic Classification (ETC) models typically operate under a "closed-world" assumption, failing to account for the continuous emergence of new applications. This paper introduces OWCP (Open-World Contrastive Pre-training), a framework that leverages contrastive learning and GAN-based synthesis to identify unknown traffic while maintaining high accuracy for known classes. Experimental results demonstrate that OWCP significantly outperforms existing state-of-the-art models in open-world scenarios.

Introduction

The rapid growth of mobile applications and the widespread adoption of encryption protocols like TLS have made network traffic management increasingly difficult. Traditional ETC methods rely on a "closed-world" assumption, where all applications encountered during deployment are assumed to have been present in the training set. However, in real-world "open-world" environments, thousands of new applications appear daily. When these models encounter unseen traffic, they often "hallucinate," incorrectly assigning it to a known category.

Furthermore, many applications exhibit "homogeneous" behavior due to the shared use of Third-Party Libraries (TPLs) for ads or analytics, further blurring the lines between distinct apps. Addressing these challenges requires a model capable of both precise classification of known apps and reliable detection of unknown ones.

The OWCP Framework

The proposed OWCP framework addresses the open-world classification problem through a four-stage pipeline designed to create robust feature representations and explicitly model the "unknown" class.

The OWCP framework architecture, illustrating the contrastive pre-training, unknown flow synthesis via GANs, and the final open-world classification stage.

1. Feature Representation

OWCP extracts features from two primary data streams: the initial non-plaintext payload bytes and the sequence of packet lengths. This dual-stream approach captures both the content characteristics and the temporal "rhythm" of the traffic.

2. Traffic Contrastive Pre-training

Using a multi-headed attention encoder, the model undergoes contrastive pre-training. This process pulls traffic samples from the same application closer together in the feature space while pushing samples from different applications apart. This stage establishes a highly discriminative foundation for classification.

3. Synthesis of Unknown Flows

To prepare the model for unseen traffic, OWCP identifies "marginal flows"—data points residing at the boundaries of known application clusters. A Generative Adversarial Network (GAN) is then employed to synthesize "unknown" traffic that mimics these boundary characteristics without overlapping with known classes.

4. Open-World Classification

Unlike threshold-based methods, OWCP incorporates a dedicated "Unknown" node in its final Softmax layer. This node is trained using the GAN-generated synthetic flows, teaching the model to explicitly recognize and reject traffic that does not match known patterns.

Experimental Evaluation

The framework was evaluated on three benchmark datasets: CrossPlatform (215 Android apps), ISCX17 (VPN vs. non-VPN), and USTC-TFC (benign vs. malicious). In testing, 80% of classes were treated as "known," with the remaining 20% serving as "unknown" intruders.

Key Results

OWCP demonstrated superior performance in both closed and open environments:

  • Closed-World Accuracy: On the CrossPlatform dataset, OWCP achieved 98.88% accuracy, surpassing state-of-the-art models like FlowPrint.
  • Open-World Performance: In the open-world scenario, OWCP reached an F1-score of 94.62% on CrossPlatform, representing a 14.58% improvement over previous benchmarks.
  • Stability: The model maintained high performance even as the complexity of the environment increased, showing minimal degradation when transitioning from closed to open testing.
Performance comparison of OWCP across varying percentages of unknown classes in both (a) Closed-World and (b) Open-World scenarios.

Discussion and Limitations

A critical innovation in OWCP is "Background Similarity Filtering," which removes common background traffic (e.g., CDNs, ad trackers) that can cause homogeneity issues. By focusing on unique application fingerprints, the model achieves higher precision.

However, the study identified that performance begins to decline if the proportion of unknown classes in the environment exceeds 30%. Additionally, the use of GANs and contrastive pre-training increases the computational cost of the training phase, and the final classification threshold requires careful calibration.

Conclusion

OWCP represents a significant step forward in encrypted traffic classification by moving beyond the closed-world assumption. By combining contrastive pre-training with synthetic data generation, it provides a robust solution for identifying both known and novel applications in dynamic network environments.

Summary updated

BibTeX
@misc{li2023facing,
  author = {Xiang Li and Beibei Feng and Tianning Zang and Shuyuan Zhao and Jingrun Ma},
  title = {{Facing Unknown: Open-World Encrypted Traffic Classification Based on Contrastive Pre-Training}},
  year = {2023},
  eprint = {2308.16861},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.16861},
}
Figure