Open-set detection of training-time unseen attacks in encrypted traffic based on a multi-granularity pre-trained transformer and prototype contrastive learning
- 1School of Electrical & Electronic Engineering, Nanyang Technological University, Singapore, Singapore.
Abstract
With the widespread use of encrypted communication protocols, payload-based inspection is increasingly constrained, making it difficult to identify command-and-control communication, malicious downloads, scanning, lateral movement, and other attacks hidden in encrypted channels. Existing encrypted-traffic classifiers achieve high accuracy on known categories but usually rely on a closed-set assumption and may therefore force previously unseen traffic into known classes. This study proposes MGPT-PCL-OSD, an open-set detector for training-time unseen attack classes, which are used as a reproducible proxy for zero-day behavior rather than as evidence of previously undisclosed real-world exploits. The method represents traffic at byte-fragment, packet, flow, session, and interaction-graph levels, learns cross-granularity context through multi-task self-supervised pre-training, and uses prototype contrastive learning to compact known-class distributions and enlarge inter-class margins. Open-set rejection jointly considers nearest sub-prototype distance, class radius, classification confidence, energy, and predictive uncertainty; rejected traffic can then be clustered and incorporated through analyst-confirmed, replay-assisted prototype updates. Across five class-level holdout splits and three random seeds per split, MGPT-PCL-OSD achieves 94.1 ± 0.3% Accuracy, 93.5 ± 0.4% Macro-F1, 93.7 ± 0.6% open-set AUROC, and 86.8 ± 0.7% OSCR. The improvements over the strongest MIETT-like baseline are significant after adjustment (p < 0.001). On a matched CICIDS2017 S1 comparison, the proposed method reaches 93.8% AUROC and 14.7% FPR@95TPR, outperforming MSP, Energy, OpenMax, Mahalanobis, ARPL, and two traffic-specific open-set baselines under the same input/backbone control. The unknown-discovery stage achieves ARI 0.82 ± 0.05 and NMI 0.85 ± 0.04, and end-to-end single-flow latency is 11.0 ms on an RTX 3090. These results support open-set detection of training-time unseen attacks under controlled benchmark protocols; they should be interpreted as a zero-day proxy rather than direct evidence of detecting undisclosed real-world exploits.
Related
- MGTF-Net: a Multi-Granularity Transformer Fusion Network for cross-fruit disease detection in mango and custard apple
- ProtoGTX: Prototype-Aligned Graph Transformer for Explainable Whole-Slide Image Analysis
- MSPRP: multi-granularity symptom-aware probabilistic representation prompting for target-domain-free plant disease detection
- Online unsupervised industrial anomaly detection with adaptive resonance patch prototype memory and multi-level views
- Mitigating regional bias in Vietnamese hate speech detection via contrastive learning with adversarial fairness
BibTeX
@article{gao2026openset,
title = {{Open-set detection of training-time unseen attacks in encrypted traffic based on a multi-granularity pre-trained transformer and prototype contrastive learning}},
author = {Siyan Gao},
journal = {PLOS One},
year = {2026},
month = nov,
doi = {10.1371/journal.pone.0359792},
url = {https://doi.org/10.1371/journal.pone.0359792},
note = {CC BY},
}
RIS
TY - JOUR
TI - Open-set detection of training-time unseen attacks in encrypted traffic based on a multi-granularity pre-trained transformer and prototype contrastive learning
AU - Siyan Gao
PY - 2026
DA - 2026/11/24
JO - PLOS One
DO - 10.1371/journal.pone.0359792
UR - https://doi.org/10.1371/journal.pone.0359792
AB - With the widespread use of encrypted communication protocols, payload-based inspection is increasingly constrained, making it difficult to identify command-and-control communication, malicious downloads, scanning, lateral movement, and other attacks hidden in encrypted channels. Existing encrypted-traffic classifiers achieve high accuracy on known categories but usually rely on a closed-set assumption and may therefore force previously unseen traffic into known classes. This study proposes MGPT-PCL-OSD, an open-set detector for training-time unseen attack classes, which are used as a reproducible proxy for zero-day behavior rather than as evidence of previously undisclosed real-world exploits. The method represents traffic at byte-fragment, packet, flow, session, and interaction-graph levels, learns cross-granularity context through multi-task self-supervised pre-training, and uses prototype contrastive learning to compact known-class distributions and enlarge inter-class margins. Open-set rejection jointly considers nearest sub-prototype distance, class radius, classification confidence, energy, and predictive uncertainty; rejected traffic can then be clustered and incorporated through analyst-confirmed, replay-assisted prototype updates. Across five class-level holdout splits and three random seeds per split, MGPT-PCL-OSD achieves 94.1 ± 0.3% Accuracy, 93.5 ± 0.4% Macro-F1, 93.7 ± 0.6% open-set AUROC, and 86.8 ± 0.7% OSCR. The improvements over the strongest MIETT-like baseline are significant after adjustment (p < 0.001). On a matched CICIDS2017 S1 comparison, the proposed method reaches 93.8% AUROC and 14.7% FPR@95TPR, outperforming MSP, Energy, OpenMax, Mahalanobis, ARPL, and two traffic-specific open-set baselines under the same input/backbone control. The unknown-discovery stage achieves ARI 0.82 ± 0.05 and NMI 0.85 ± 0.04, and end-to-end single-flow latency is 11.0 ms on an RTX 3090. These results support open-set detection of training-time unseen attacks under controlled benchmark protocols; they should be interpreted as a zero-day proxy rather than direct evidence of detecting undisclosed real-world exploits.
SN - 1932-6203
ER -