Malicious Traffic Detection on Tofino Using Graph Attention Model
Abstract
1. Introduction
2. Background and Related Works
2.1. Malicious Traffic Detection Based on Deep Learning
2.2. P4 Programmable Switch
3. Maltof
3.1. Problem Statement
3.2. Overall Architecture
3.3. RF-Based Screening Module
Algorithm 1: RF-based Screening Algorithm |
3.4. Deep Detection Module
3.4.1. Sliding Window Management
Algorithm 2: Deep Detection Algorithm |
3.4.2. Traffic Trajectory Map Construction
3.4.3. EGAT Module
4. Experimental Results and Analysis
4.1. Experimental Environment
4.2. Experimental Dataset
4.3. Comparison Method
4.4. RF Multi-Class Classification Results
4.5. EGAT Multi-Class Classification Results
4.6. Discussion
5. Summary
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Al-Garadi, M.A.; Mohamed, A.; Al-Ali, A.K.; Du, X.; Ali, I.; Guizani, M. A Survey of Machine and Deep Learning Methods for Internet of Things (IoT) Security. IEEE Commun. Surv. Tutor. 2020, 22, 1646–1685. [Google Scholar] [CrossRef]
- Fu, C.; Li, Q.; Shen, M.; Xu, K. Frequency Domain Feature based Robust Malicious Traffic Detection. IEEE/ACM Trans. Netw. 2022, 31, 452–467. [Google Scholar] [CrossRef]
- Kumar, R.; Swarnkar, M.; Singal, G.; Kumar, N. IoT Network Traffic Classification using Machine Learning Algorithms: An Experimental Analysis. IEEE Internet Things J. 2021, 9, 989–1008. [Google Scholar] [CrossRef]
- Azab, A.; Khasawneh, M.; Alrabaee, S.; Choo, K.K.R.; Sarsour, M. Network Traffic Classification: Techniques, Datasets, and Challenges. Digit. Commun. Netw. 2024, 10, 676–692. [Google Scholar] [CrossRef]
- Fu, C.; Li, Q.; Xu, K.; Wu, J. Point Cloud Analysis for ML-based Malicious Traffic Detection: Reducing Majorities of False Positive Alarms. In Proceedings of the 2023 ACM SIGSAC Conference on Computer and Communications Security, ACM, Copenhagen, Denmark, 26 November 2023; pp. 1005–1019. [Google Scholar]
- Gu, J.; Wang, Z.; Kuen, J.; Ma, L.; Shahroudy, A.; Shuai, B.; Liu, T.; Wang, X.; Wang, G.; Cai, J.; et al. Recent Advances in Convolutional Neural Networks. Pattern Recognit. 2018, 77, 354–377. [Google Scholar] [CrossRef]
- Van Houdt, G.; Mosquera, C.; Nápoles, G. A Review on the Long Short-Term Memory Model. Artif. Intell. Rev. 2020, 53, 5929–5955. [Google Scholar] [CrossRef]
- Zhang, H.; Li, Y.; Lv, Z.; Sangaiah, A.K.; Huang, T. A Real-time and Ubiquitous Network Attack Detection based on Deep Belief Network and Support Vector Machine. IEEE/CAA J. Autom. Sin. 2020, 7, 790–799. [Google Scholar] [CrossRef]
- Shaji, N.S.; Jain, T.; Muthalagu, R.; Pawar, P.M. Deep-discovery: Anomaly discovery in software-defined networks using artificial neural networks. Comput. Secur. 2023, 132, 103320. [Google Scholar] [CrossRef]
- Bosshart, P.; Daly, D.; Gibb, G.; Izzard, M.; McKeown, N.; Rexford, J.; Schlesinger, C.; Talayco, D.; Vahdat, A.; Varghese, G.; et al. P4: Programming Protocol-independent Packet Processors. ACM SIGCOMM Comput. Commun. Rev. 2014, 44, 87–95. [Google Scholar] [CrossRef]
- Pan, T.; Yu, N.; Jia, C.; Pi, J.; Xu, L.; Qiao, Y.; Li, Z.; Liu, K.; Lu, J.; Lu, J.; et al. Sailfish: Accelerating Cloud-scale Multi-tenant Multi-service Gateways with Programmable Switches. In Proceedings of the SIGCOMM’21, ACM, Virtual Event, USA, 27 August 2021; pp. 194–206. [Google Scholar]
- Chen, Z.; Cheng, G.; Niu, D.; Qiu, X.; Zhao, Y.; Zhou, Y. WFF-EGNN: Encrypted Traffic Classification based on Weaved Flow Fragment via Ensemble Graph Neural Networks. IEEE Trans. Mach. Learn. Commun. Netw. 2023, 1, 389–411. [Google Scholar] [CrossRef]
- Keshk, M.; Koroniotis, N.; Pham, N.; Moustafa, N.; Turnbull, B.; Zomaya, A.Y. An Explainable Deep Learning-enabled Intrusion Detection Framework in IoT Networks. Inf. Sci. 2023, 639, 119000. [Google Scholar] [CrossRef]
- Wang, W.; Zhu, M.; Zeng, X.; Ye, X.; Sheng, Y. Malware Traffic Classification using Convolutional Neural Network for Representation Learning. In Proceedings of the ICOIN’17, IEEE, Da Nang, Vietnam, 11–13 January 2017; pp. 712–717. [Google Scholar]
- 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 ISI’17, Beijing, China, 22–24 July 2017; pp. 43–48. [Google Scholar]
- Lopez-Martin, M.; Carro, B.; Sanchez-Esguevillas, A.; Lloret, J. Network Traffic Classifier with Convolutional and Recurrent Neural Networks for Internet of Things. IEEE Access 2017, 5, 18042–18050. [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 INFOCOM’20, IEEE, Virtual Event, USA, 6–9 July 2020; pp. 397–405. [Google Scholar]
- Sun, B.; Yang, W.; Yan, M.; Wu, D.; Zhu, Y.; Bai, Z. An Encrypted Traffic Classification Method Combining Graph Convolutional Network and Autoencoder. In Proceedings of the IPCCC’20, Virtual Event, USA, 20 November 2020; pp. 1–8. [Google Scholar]
- Lo, W.W.; Layeghy, S.; Sarhan, M.; Gallagher, M.; Portmann, M. E-graphsage: A Graph Neural Network based Intrusion Detection System for IoT. In Proceedings of the NOMS’22, Budapest, Hungary, 25–29 April 2022; pp. 1–9. [Google Scholar]
- Scarselli, F.; Gori, M.; Tsoi, A.C.; Hagenbuchner, M.; Monfardini, G. The Graph Neural Network Model. IEEE Trans. Neural Networks 2008, 20, 61–80. [Google Scholar] [CrossRef]
- AlSabeh, A.; Khoury, J.; Kfoury, E.; Crichigno, J.; Bou-Harb, E. A survey on security applications of P4 programmable switches and a STRIDE-based vulnerability assessment. Comput. Netw. 2022, 207, 108800. [Google Scholar] [CrossRef]
- Mi, Y.; Wang, A. ML-pushback: Machine Learning based Pushback Defense Against DDoS. In Proceedings of the CoNEXT’19, Orlando, FL, USA, 9–12 December 2019; pp. 80–81. [Google Scholar]
- Xavier, B.M.; Guimarães, R.S.; Comarela, G.; Martinello, M. Programmable Switches for In-networking Classification. In Proceedings of the INFOCOM’21, Vancouver, BC, Canada, 10–13 May 2021; pp. 1–10. [Google Scholar]
- Xie, G.; Li, Q.; Dong, Y.; Duan, G.; Jiang, Y.; Duan, J. Mousika: Enable General In-network Intelligence in Programmable Switches by Knowledge Distillation. In Proceedings of the INFOCOM’22, London, UK, 2–5 May 2022; pp. 1938–1947. [Google Scholar]
- Baldini, G.; Amerini, I. Online Distributed Denial of Service (DDoS) Intrusion Detection based on Adaptive Sliding Window and Morphological Fractal Dimension. Comput. Netw. 2022, 210, 108923. [Google Scholar] [CrossRef]
- Paszke, A.; Gross, S.; Massa, F.; Lerer, A.; Bradbury, J.; Chanan, G.; Killeen, T.; Lin, Z.; Gimelshein, N.; Antiga, L.; et al. Pytorch: An imperative style, high-performance deep learning library. In NIPS’19; Curran Associates Inc.: Red Hook, NY, USA, 2019. [Google Scholar]
- Moustafa, N.; Slay, J. UNSW-NB15: A Comprehensive Data Set for Network Intrusion Detection Systems (UNSW-NB15 Network Data Set). In Proceedings of the MilCIS’15, IEEE, Canberra, ACT, Australia, 10–12 November 2015; pp. 1–6. [Google Scholar]
- Alam, K.; Monir, M.F.; Hassan, Z.; Habib, M.T. Optimizing IoT Network Intrusion Detection: A Deep Learning Approach. In Proceedings of the 2024 7th Conference on Cloud and Internet of Things (CIoT), Montreal, QC, Canada, 29–31 October 2024; pp. 1–5. [Google Scholar] [CrossRef]
- Bhuiyan, M.H.; Alam, K.; Shahin, K.I.; Farid, D.M. A Deep Learning Approach for Network Intrusion Classification. In Proceedings of the 2024 IEEE Region 10 Symposium (TENSYMP), New Delhi, India, 27–29 September 2024; pp. 1–6. [Google Scholar] [CrossRef]
- Xie, S.; Zhan, C.; Li, J.; Li, Y. Intrusion Detection Method based on Graph Edge Attention and Focal Loss. In Proceedings of the 2025 4th International Conference on Cryptography, Network Security and Communication Technology, New York, NY, USA, 17–19 January 2025; pp. 21–28. [Google Scholar] [CrossRef]
- Mohy-Eddine, M.; Guezzaz, A.; Benkirane, S.; Azrour, M.; Farhaoui, Y. An Ensemble Learning Based Intrusion Detection Model for Industrial IoT Security. Big Data Min. Anal. 2023, 6, 273–287. [Google Scholar] [CrossRef]
- Yang, C.; Wu, L.; Xu, J.; Ren, Y.; Tian, B.; Wei, Z. Graph Learning Framework for Data Link Anomaly Detection. IEEE Access 2024, 12, 114820–114828. [Google Scholar] [CrossRef]
- Wu, C.; Sun, J.; Chen, J.; Alazab, M.; Liu, Y.; Xiang, Y. TCG-IDS: Robust Network Intrusion Detection via Temporal Contrastive Graph Learning. IEEE Trans. Inf. Forensics Secur. 2025, 20, 1475–1486. [Google Scholar] [CrossRef]
- Park, S.H.; Goo, J.M.; Jo, C.H. Receiver Operating Characteristic (ROC) Curve: Practical Review for Radiologists. Korean J. Radiol. 2004, 5, 11–18. [Google Scholar] [CrossRef]
- Aykroyd, R.G.; Leiva, V.; Ruggeri, F. Recent developments of control charts, identification of big data sources and future trends of current research. Technol. Forecast. Soc. Chang. 2019, 144, 221–232. [Google Scholar] [CrossRef]
- Yeganeh, A.; Shadman, A.R.; Triantafyllou, I.S.; Shongwe, S.C.; Abbasi, S.A. Run Rules-Based EWMA Charts for Efficient Monitoring of Profile Parameters. IEEE Access 2021, 9, 38503–38521. [Google Scholar] [CrossRef]
- Flossdorf, J.; Fried, R.; Jentsch, C. Online monitoring of dynamic networks using flexible multivariate control charts. Soc. Netw. Anal. Min. 2023, 13, 87. [Google Scholar] [CrossRef]
- Zhou, P.; Lin, D.K.; Niu, X.; He, Z. Performance evaluation method for network monitoring based on separable temporal exponential random graph models with application to the study of autocorrelation effects. Comput. Ind. Eng. 2020, 145, 106507. [Google Scholar] [CrossRef]
Ref | Model | Dataset | Contributions |
---|---|---|---|
Wang et al. [14] | CNN | - | First-time application of representation learning methods to malicious traffic classification shows experimental results that meet the accuracy requirements for real-world applications. |
Wang et al. [15] | CNN | ISCX VPN–non-VPN | Automatically extract nonlinear features using E2E approach; in four experiments, 11 out of 12 evaluation metrics outperformed existing methods. |
Lopez et al. [16] | CNN + RNN | IoT network traffic | No feature engineering is required, and CNN is naturally extended to traffic classification. |
Zhang et al. [17] | Learning Traffic Classifier | ISCX VPN–non-VPN | Capable of effectively filtering unknown-category traffic in real time and providing accurate labels, with support for online classifier updates. |
Sun et al. [18] | GCN | Open public datasets | Extract structural features using GCN and employing an autoencoder to complement flow data representation; high classification performance can still be achieved even when labeled samples are limited. |
Lo et al. [19] | NN | Real network data | Capable of capturing all intrusion samples with zero false positives; custom window-based feature extraction for critical infrastructure environments enhances detection reliability. |
This work | EGAT | NF-UNSW-NB15 | This paper proposes a malicious traffic detection architecture that collaborates with CPU and Tofino. It combines the rule-based fast pre-filtering on the Tofino side with the EGAT deep reasoning analysis on the CPU side to perform deeper feature aggregation and classification of suspicious traffic, thus achieving high-accuracy and low-latency malicious traffic detection. |
Experimental Platform | Setting |
---|---|
Parameters of Algorithm 1. | |
n_estimators | 64 |
max_depth | 4 |
max_features | sqrt |
min_samples_split | 2 |
min_samples_leaf | 1 |
bootstrap | True |
THRESHOLD | 38 |
Parameters of Algorithm 2. | |
Activation function | eLU |
Loss function | Cross-entropy |
Optimization algorithm | Adam |
Number of training rounds | Epoch = 2 |
Batch size | Batch_size = 500 |
Learning rate | Lr = 0.007 |
Dropout | 0.2 |
Category Name | Meaning | Quantity |
---|---|---|
Normal | Normal traffic | 46,521 |
Analysis | Attack traffic infiltrated through port scanning, emails, and web script files. | 200 |
Backdoor | Attack traffic that bypasses security mechanisms such as identity authentication to illegally access data. | 179 |
DoS | Attack traffic that occupies a large amount of memory resources and makes the network unable to provide normal services. | 505 |
Exploits | Attack traffic that exploits security vulnerabilities in operating systems, etc. | 2474 |
Fuzzers | Attack traffic that causes a target program to overflow by inputting random data. | 1948 |
Generic | Use hash functions to create collision attack traffic for each block cipher. | 557 |
Reconnaissance | Attack traffic that bypasses security mechanisms by collecting network information. | 1230 |
Shellcode | Attack traffic that allows attackers to exploit vulnerabilities and execute arbitrary instructions by adding code blocks. | 137 |
Worms | Attack traffic that replicates itself and spreads to other target hosts. | 30 |
Generic | Use hash functions to create collision attack traffic for each block cipher. | 550 |
Name | Description |
---|---|
SRC_ADDR | The source IP address for the data flow. |
SRC_PORT | The source port. |
DST_ADDR | The destination IP address for the data flow. |
DST_PORT | The destination port. |
PROTOCOL | The transport-layer protocol. |
PROTO | The application-layer protocol. |
IN_BYTES | The total number of incoming bytes from the source. |
OUT_BYTES | The total number of outgoing bytes to the destination. |
IN_PKTS | The total number of incoming packets from the source. |
OUT_PKTS | The total number of outgoing packets to the destination. |
TCP_FLAGS | TCP control flags set on the connection to track flow state. |
MILLISECONDS | The total duration of the flow, measured in milliseconds. |
Label | A label describing whether the flow is normal or suspicious. |
Attack | Indicator specifying if the flow is part of an attack scenario. |
Ref | Method | Purpose | Task Type | Result |
---|---|---|---|---|
Alam et al. [28] | CNN | Generalization test for IoT traffic detection | Binary-class | High accuracy and F1 (main dataset: F1 = 0.9952); outperforms CNN+LSTM, DNN, etc. |
Bhuiyan et al. [29] | DNN | Intrusion type classification and cross-dataset robustness evaluation | Binary-class | Outperforms baseline models on NF datasets; accuracy up to 0.99 on test set |
Xie et al. [30] | Edge Attention | Multi-class attack detection under imbalanced data | Multi-class | Accuracy = 97.87% on NF-UNSW-NB15 |
Mohy-Eddine et al. [31] | RF | Industrial IoT intrusion detection with feature selection | Binary-class | Accuracy = 99.30% on NF-UNSW-NB15-v2; low inference time |
Yang et al. [32] | Graph Attention | Link anomaly detection using structural and edge features | Binary-class and multi-class | Outperforms baselines on multiple datasets including NF-UNSW-NB15 |
Wu et al. [33] | GNN | Multi-type attack detection in zero-trust networks | Binary-class and multi-class | Balanced accuracy = 91.48%, FPR = 3.34% on NF-UNSW-NB15-v2 |
Method | Accuracy | Precision | Recall | F1 |
---|---|---|---|---|
CNN | 0.9751 | 0.9743 | 0.9747 | 0.9748 |
LSTM | 0.9744 | 0.9681 | 0.9743 | 0.9712 |
E-GraphSAGE | 0.9764 | 0.9727 | 0.9764 | 0.9746 |
EGAT | 0.9785 | 0.9779 | 0.9785 | 0.9786 |
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. |
© 2025 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
Gao, X.; Tan, L.; Chen, S.; Zhang, P.; Wang, J. Malicious Traffic Detection on Tofino Using Graph Attention Model. Appl. Sci. 2025, 15, 7179. https://doi.org/10.3390/app15137179
Gao X, Tan L, Chen S, Zhang P, Wang J. Malicious Traffic Detection on Tofino Using Graph Attention Model. Applied Sciences. 2025; 15(13):7179. https://doi.org/10.3390/app15137179
Chicago/Turabian StyleGao, Xichang, Lizhuang Tan, Shengpeng Chen, Peiying Zhang, and Jian Wang. 2025. "Malicious Traffic Detection on Tofino Using Graph Attention Model" Applied Sciences 15, no. 13: 7179. https://doi.org/10.3390/app15137179
APA StyleGao, X., Tan, L., Chen, S., Zhang, P., & Wang, J. (2025). Malicious Traffic Detection on Tofino Using Graph Attention Model. Applied Sciences, 15(13), 7179. https://doi.org/10.3390/app15137179