Malicious Traffic Identification with Self-Supervised Contrastive Learning
Abstract
:1. Introduction
- A malicious-traffic-identification method based on contrastive learning is proposed. Our method has shown superiority for malicious traffic identification compared with traditional methods relying on labeled samples, which can process arbitrary unlabeled packet capture files into vectorized traffic representations and learn data feature representations carrying semantic information from unlabeled data, thus improving the model accuracy.
- The proposed model employs a self-attention mechanism to accurately extract bytes features of malicious traffic. Compared with the convolutional-neural-network-based feature extraction module, the Transformer-based feature extraction module can significantly improve the feature extraction capability by capturing key features of the malicious traffic as well as learning the correlation between multiple features.
- A bidirectional GLSTM (bi-GLSTM) is proposed to extract the temporal features of malicious traffic, which uses the GELU nonlinear function as the activation function in the recurrent stage. The idea of stochastic regularization is introduced in the activation process to enhance the generalization ability of the model, which makes bi-GLSTM more suitable for processing traffic data than the conventional bi-LSTM network.
2. Related Work
3. Proposed Model
3.1. Overview
3.2. Data Preprocessing
3.3. Pretraining with Self-Supervised Contrastive Learning
3.3.1. Contrastive Task Construction
3.3.2. Contrastive Encoder
3.3.3. Contrastive Projector
3.3.4. Contrastive Cross-Entropy Loss
3.4. Transformer Module
3.5. Bidirectional GLSTM Module
4. Experiment and Analysis
4.1. Dataset
4.2. Experimental Setup
4.3. Experimental Results
5. Discussion
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Anagnostopoulos, M.; Kambourakis, G.; Kopanos, P.; Louloudakis, G.; Gritzalis, S. DNS amplification attack revisited. Comput. Secur. 2013, 39, 475–485. [Google Scholar] [CrossRef]
- Vishwakarma, R.; Jain, A.K. A survey of DDoS attacking techniques and defence mechanisms in the IoT network. Telecommun. Syst. 2020, 73, 3–25. [Google Scholar] [CrossRef]
- CNCERT: 2020 Internet Network Security Monitoring Data Analysis Report. Available online: https://www.cert.org.cn/publish/main/upload/File/2020Report.pdf (accessed on 16 August 2021).
- Anderson, B.; McGrew, D. Identifying encrypted malware traffic with contextual flow data. In Proceedings of the 2016 ACM Workshop on Artificial Intelligence and Security, Vienna, Austria, 28 October 2016; pp. 35–46. [Google Scholar]
- Hong, Y.; Li, Q.; Yang, Y.; Shen, M. Graph based Encrypted Malicious Traffic Detection with Hybrid Analysis of Multi-view Features. Inf. Sci. 2023, 644, 119229. [Google Scholar] [CrossRef]
- Wang, Z.; Fok, K.W.; Thing, V.L. Machine learning for encrypted malicious traffic detection: Approaches, datasets and comparative study. Comput. Secur. 2022, 113, 102542. [Google Scholar] [CrossRef]
- Shen, M.; Liu, Y.; Chen, S.; Zhu, L.; Zhang, Y. Webpage fingerprinting using only packet length information. In Proceedings of the ICC 2019—2019 IEEE International Conference on Communications (ICC), Shanghai, China, 20–24 May 2019; pp. 1–6. [Google Scholar]
- Shen, M.; Liu, Y.; Zhu, L.; Xu, K.; Du, X.; Guizani, N. Optimizing feature selection for efficient encrypted traffic classification: A systematic approach. IEEE Netw. 2020, 34, 20–27. [Google Scholar] [CrossRef]
- Wang, W.; Zhu, M.; Wang, J.; Zeng, X.; Yang, Z. End-to-end encrypted traffic classification with one-dimensional convolution neural networks. In Proceedings of the 2017 IEEE International Conference on Intelligence and Security Informatics (ISI), Beijing, China, 22–24 July 2017; pp. 43–48. [Google Scholar]
- Xing, J.; Wu, C. Detecting anomalies in encrypted traffic via deep dictionary learning. In Proceedings of the IEEE INFOCOM 2020—IEEE Conference on Computer Communications Workshops (INFOCOM WKSHPS), Toronto, ON, Canada, 6–9 July 2020; pp. 734–739. [Google Scholar]
- Lin, K.; Xu, X.; Gao, H. TSCRNN: A novel classification scheme of encrypted traffic based on flow spatiotemporal features for efficient management of IIoT. Comput. Netw. 2021, 190, 107974. [Google Scholar] [CrossRef]
- Jaber, M.; Cascella, R.G.; Barakat, C. Using host profiling to refine statistical application identification. In Proceedings of the 2012 Proceedings IEEE INFOCOM, Orlando, FL, USA, 25–30 March 2012; pp. 2746–2750. [Google Scholar]
- Zhang, J.; Xiang, Y.; Zhou, W.; Wang, Y. Unsupervised traffic classification using flow statistical properties and IP packet payload. J. Comput. Syst. Sci. 2013, 79, 573–585. [Google Scholar] [CrossRef]
- Cheng, Z.; Zou, C.; Dong, J. Outlier detection using isolation forest and local outlier factor. In Proceedings of the Conference on Research in Adaptive and Convergent Systems, Chongqing, China, 24–27 September 2019; pp. 161–168. [Google Scholar]
- Xiong, Y.; Zuo, R. Recognizing multivariate geochemical anomalies for mineral exploration by combining deep learning and one-class support vector machine. Comput. Geosci. 2020, 140, 104484. [Google Scholar] [CrossRef]
- Paulauskas, N.; Bagdonas, Ą.F. Local outlier factor use for the network flow anomaly detection. Secur. Commun. Netw. 2015, 8, 4203–4212. [Google Scholar] [CrossRef]
- Draper-Gil, G.; Lashkari, A.H.; Mamun, M.S.I.; Ghorbani, A.A. Characterization of encrypted and vpn traffic using time-related. In Proceedings of the 2nd International Conference on Information Systems Security and Privacy (ICISSP), Rome, Italy, 19–21 February 2016; pp. 407–414. [Google Scholar]
- Taylor, V.F.; Spolaor, R.; Conti, M.; Martinovic, I. Robust smartphone app identification via encrypted network traffic analysis. IEEE Trans. Inf. Forensics Secur. 2017, 13, 63–78. [Google Scholar] [CrossRef]
- Thakkar, A.; Lohiya, R. Attack classification of imbalanced intrusion data for IoT network using ensemble learning-based deep neural network. IEEE Internet Things J. 2023, 10, 11888–11895. [Google Scholar] [CrossRef]
- Lotfollahi, M.; Jafari Siavoshani, M.; Shirali Hossein Zade, R.; Saberian, M. Deep packet: A novel approach for encrypted traffic classification using deep learning. Soft Comput. 2020, 24, 1999–2012. [Google Scholar] [CrossRef]
- Zhang, J.; Li, F.; Ye, F.; Wu, H. Autonomous unknown-application filtering and labeling for dl-based traffic classifier update. In Proceedings of the IEEE INFOCOM 2020—IEEE Conference on Computer Communications, Toronto, ON, Canada, 6–9 July 2020; pp. 397–405. [Google Scholar]
- Ibitoye, O.; Shafiq, O.; Matrawy, A. Analyzing adversarial attacks against deep learning for intrusion detection in IoT networks. In Proceedings of the 2019 IEEE Global Communications Conference (GLOBECOM), Waikoloa, HI, USA, 9–13 December 2019; pp. 1–6. [Google Scholar]
- Wang, X.; Chen, S.; Su, J. App-net: A hybrid neural network for encrypted mobile traffic classification. In Proceedings of the IEEE INFOCOM 2020—IEEE Conference on Computer Communications Workshops (INFOCOM WKSHPS), Toronto, ON, Canada, 6–9 July 2020; pp. 424–429. [Google Scholar]
- Shen, M.; Liu, Y.; Zhu, L.; Du, X.; Hu, J. Fine-grained webpage fingerprinting using only packet length information of encrypted traffic. IEEE Trans. Inf. Forensics Secur. 2020, 16, 2046–2059. [Google Scholar] [CrossRef]
- Alghanam, O.A.; Almobaideen, W.; Saadeh, M.; Adwan, O. An improved PIO feature selection algorithm for IoT network intrusion detection system based on ensemble learning. Expert Syst. Appl. 2023, 213, 118745. [Google Scholar] [CrossRef]
- Yao, H.; Liu, C.; Zhang, P.; Wu, S.; Jiang, C.; Yu, S. Identification of encrypted traffic through attention mechanism based long short term memory. IEEE Trans. Big Data 2019, 8, 241–252. [Google Scholar] [CrossRef]
- Chen, T.; Kornblith, S.; Norouzi, M.; Hinton, G. A simple framework for contrastive learning of visual representations. In Proceedings of the International Conference on Machine Learning, Virtual Event, 12–18 July 2020; pp. 1597–1607. [Google Scholar]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. In Proceedings of the Advances in Neural Information Processing Systems, Long Beach, CA, USA, 4–9 December 2017; Volume 30. [Google Scholar]
- Zhao, Z.; Chen, W.; Wu, X.; Chen, P.C.; Liu, J. LSTM network: A deep learning approach for short-term traffic forecast. IET Intell. Transp. Syst. 2017, 11, 68–75. [Google Scholar] [CrossRef]
- Hendrycks, D.; Gimpel, K. Gaussian error linear units (gelus). arXiv 2016, arXiv:1606.08415. [Google Scholar]
- Koroniotis, N.; Moustafa, N.; Sitnikova, E.; Turnbull, B. Towards the development of realistic botnet dataset in the internet of things for network forensic analytics: Bot-iot dataset. Future Gener. Comput. Syst. 2019, 100, 779–796. [Google Scholar] [CrossRef]
- Koroniotis, N.; Moustafa, N.; Sitnikova, E. A new network forensic framework based on deep learning for Internet of Things networks: A particle deep framework. Future Gener. Comput. Syst. 2020, 110, 91–106. [Google Scholar] [CrossRef]
- Koroniotis, N.; Moustafa, N.; Schiliro, F.; Gauravaram, P.; Janicke, H. A holistic review of cybersecurity and reliability perspectives in smart airports. IEEE Access 2020, 8, 209802–209834. [Google Scholar] [CrossRef]
Classes | Number |
---|---|
DDoS | 534,364 |
DoS | 535,358 |
Normal | 840 |
Scan | 72,442 |
Theft | 782 |
Total | 1,143,786 |
Item | Specifications |
---|---|
Op. Sys. | Ubuntu 16.04.6 LTS |
Python | 3.8.7 |
Pytorch | 1.12.1+cu116 |
GPU | 2× NVIDIA GeForce RTX 3080 12 GB |
RAM | 64 GB DDR4 @2666 MHz |
Nvidia Driver | 531.79 |
CUDA Driver | 11.6 |
Item | Hyperparameters | Item | Hyperparameters |
---|---|---|---|
Optimizer | Adam | Sequence Length of GLSTM | 1 |
Loss Function | Cross-Entropy | Dropout Ratio | 0.25 |
Learning Rate | 0.0001 | Activation Function | ReLU |
Batch Size | 256 | Input Dimension | 28 × 28 T, 1024 G |
Epoch | 1000 *, 30 + | Output Dimension | 1024 T, 64 G |
Number of Views | 2 | Embedding Dimension | 128 T, 256 G |
Temperature Coefficient | 0.07 | Layers | 4 T, 2 G |
Methods | ACC | Macro-PR | Macro-RC | Macro-F1 | Macro-FPR |
---|---|---|---|---|---|
Without pretraining | 97.97% | 96.63% | 85.09% | 88.68% | 0.60% |
With pretraining (ours) | 99.48% | 99.45% | 99.47% | 99.46% | 0.16% |
Classes | PR | RC | F1 | FPR |
---|---|---|---|---|
DDoS | 99.20% | 99.40% | 99.30% | 0.45% |
DoS | 99.45% | 99.20% | 99.32% | 0.32% |
Normal | 100% | 99.40% | 99.70% | 0.00% |
Scan | 99.89% | 99.98% | 99.93% | 0.04% |
Theft | 98.73% | 99.36% | 99.04% | 0.01% |
Loss Function | ACC | Macro-PR | Macro-RC | Macro-F1 |
---|---|---|---|---|
Cross-Entropy | 99.48% | 99.45% | 99.47% | 99.46% |
NLL Loss | 98.15% | 78.80% | 76.66% | 77.62% |
MultiFocal Loss | 98.39% | 98.52% | 97.22% | 97.85% |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Yang, J.; Jiang, X.; Liang, G.; Li, S.; Ma, Z. Malicious Traffic Identification with Self-Supervised Contrastive Learning. Sensors 2023, 23, 7215. https://doi.org/10.3390/s23167215
Yang J, Jiang X, Liang G, Li S, Ma Z. Malicious Traffic Identification with Self-Supervised Contrastive Learning. Sensors. 2023; 23(16):7215. https://doi.org/10.3390/s23167215
Chicago/Turabian StyleYang, Jin, Xinyun Jiang, Gang Liang, Siyu Li, and Zicheng Ma. 2023. "Malicious Traffic Identification with Self-Supervised Contrastive Learning" Sensors 23, no. 16: 7215. https://doi.org/10.3390/s23167215
APA StyleYang, J., Jiang, X., Liang, G., Li, S., & Ma, Z. (2023). Malicious Traffic Identification with Self-Supervised Contrastive Learning. Sensors, 23(16), 7215. https://doi.org/10.3390/s23167215