A Malicious Code Detection Method Based on Stacked Depthwise Separable Convolutions and Attention Mechanism
Abstract
:1. Introduction
- This work presents a novel stacked architecture that integrates Transformers and convolutional networks. The model achieves a harmonious balance between adaptability to varying data sizes and strong generalization capability. By strategically combining these elements, the model demonstrates optimal performance in both generalization ability and model capacity across its five distinct stages.
- The paper highlights the significance of data augmentation techniques in addressing data imbalance challenges. By applying various transformations to images, multiple augmented samples are generated, effectively balancing the dataset. Through undersampling, these augmented samples lead to a more representative training set, enriching the model’s ability to capture diverse features and variations. The expanded dataset enhances the model’s robustness and generalization to unseen instances, resulting in improved overall performance.
- The model’s adaptability was extensively evaluated on the Malimg dataset, and its capabilities were rigorously verified on the enlarged Blended+ dataset. Comparative experiments with well-established models (XceptionNet, EfficientNetB0, ResNet50, VGG16, DenseNet169, and InceptionResNetV2) substantiate the proposed method’s superiority. Impressively, the approach achieved exceptional accuracy rates of 99.33% on Malimg and 96.60% on Blended+. The proposed method outperforms existing models, particularly in addressing imbalanced sample sets, showcasing its potential for practical real-world applications.
2. Related Work
2.1. Malicious Code Detection Technology
2.1.1. Static Detection Technology
2.1.2. Dynamic Detection Technology
2.1.3. Hybrid Detection Technology
2.2. Machine Learning-Based Detection Techniques
2.3. Visualization-Based Detection Techniques for Malicious Code
2.4. Deep Learning-Based Malicious Code Detection
3. The Malicious Code Detection Model Bades on Stacked DepthWise Separable Convolution and Attention Mechanism
- (1).
- The mapping of malicious code into a grayscale image.
- (2).
- The design of CoAtNet for grayscale image detection.
3.1. Binary Code to Grayscale Image
3.2. Detection of Malicious Code Based on Stacked Depthwise Separable Convolution and Attention Mechanism
4. Experimental Evaluation
4.1. Data Augmentation
4.2. Evaluation Metrics
4.3. Experimental Results
4.3.1. Validation of Data Augmentation Effectiveness
4.3.2. Validation of the Model’s Malicious Code Detection Capabilities
4.4. Comparison of Related Work
5. Conclusions and Future Work
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Total Amount of Malware and PUA. Available online: https://portal.av-atlas.org/malware (accessed on 3 July 2023).
- IT Threat Evolution Q1 2023. Mobile Statistics. Available online: https://securelist.com/it-threat-evolution-q1-2023-mobile-statistics/109893/ (accessed on 3 July 2023).
- Alazab, M. Profiling and classifying the behavior of malicious codes. J. Syst. Softw. 2015, 100, 91–102. [Google Scholar] [CrossRef]
- Venkatraman, S.; Alazab, M. Use of data visualisation for zero-day malware detection. Secur. Commun. Netw. 2018, 2018, 1728303. [Google Scholar] [CrossRef]
- Alweshah, M.; Hammouri, A.; Alkhalaileh, S.; Alzubi, O. Intrusion detection for the internet of things (IoT) based on the emperor penguin colony optimization algorithm. J. Ambient. Intell. Humaniz. Comput. 2023, 14, 6349–6366. [Google Scholar] [CrossRef]
- Alzubi, O.A.; Alzubi, J.A.; Alazab, M.; Alrabea, A.; Awajan, A.; Qiqieh, I. Optimized Machine Learning-Based Intrusion Detection System for Fog and Edge Computing Environment. Electronics 2022, 11, 3077. [Google Scholar] [CrossRef]
- Shafin, S.S.; Karmakar, G.; Mareels, I. Obfuscated Memory Malware Detection in Resource-Constrained IoT Devices for Smart City Applications. Sensors 2023, 23, 5348. [Google Scholar] [CrossRef] [PubMed]
- Abdullah, M.A.; Yu, Y.; Adu, K.; Imrana, Y.; Wang, X.; Cai, J. HCL-Classifier: CNN and LSTM based hybrid malware classifier for Internet of Things (IoT). Future Gener. Comput. Syst. 2023, 142, 41–58. [Google Scholar] [CrossRef]
- Srinivasan, S.; Deepalakshmi, P. An innovative malware detection methodology employing the amalgamation of stacked BiLSTM and CNN+LSTM-based classification networks with the assistance of Mayfly metaheuristic optimization algorithm in cyber-attack. Concurr. Comput. Pract. Exp. 2023, 35, e7679. [Google Scholar] [CrossRef]
- Alzubi, O.A.; Qiqieh, I.; Alzubi, J.A. Fusion of deep learning based cyberattack detection and classification model for intelligent systems. Cluster Comput. 2023, 26, 1363–1374. [Google Scholar] [CrossRef]
- Krizhevsky, A.; Sutskever, I.; Hinton, G. ImageNet classification with deep convolutional neural networks. Commun. ACM 2017, 60, 84–90. [Google Scholar] [CrossRef]
- Simonyan, K.; Zisserman, A. Very Deep Convolutional Networks for Large-Scale Image Recognition. In Proceedings of the 2014 IEEE Conference on Computer Vision and Pattern Recognition(CVPR), Columbus, OH, USA, 23–28 June 2014. [Google Scholar]
- Szegedy, C.; Liu, W.; Jia, Y.; Sermanet, P.; Reed, S.; Anguelov, D.; Erhan, D.; Vanhoucke, V.; Rabinovich, A. Going Deeper with Convolutions. In Proceedings of the 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Boston, MA, USA, 7–12 June 2015. [Google Scholar]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition(CVPR), Las Vegas, NV, USA, 27–30 June 2016. [Google Scholar]
- Jiang, K.; Bai, W.; Zhang, L.; Chen, J.; Pan, Z.; Guo, S. Malicious code detection based on multi-channel image deep learning. J. Comput. Appl. 2021, 4, 1142–1147. [Google Scholar]
- Wang, B.; Cai, H.; Su, Y. Classification of malicious code variants based on VGGNet. J. Comput. Appl. 2020, 1, 162–167. [Google Scholar]
- Luo, L.; Ming, J.; Wu, D.; Liu, P.; Zhu, S. Semantics-Based Obfuscation-Resilient Binary Code Similarity Comparison with Applications to Software and Algorithm Plagiarism Detecion. IEEE Trans. Softw. Eng. 2017, 43, 1157–1177. [Google Scholar] [CrossRef]
- Liu, Y.; Wang, Z.; Hou, Y.; Yan, H. A Method of Extracting Malware Features Based on Probabilistic Topic Model. J. Comput. Res. Dev. 2019, 56, 2339–2348. [Google Scholar]
- Alaeiyan, M.; Parsa, S.; Conti, M. Analysis and classification of context-based malware behavior. Comput. Commun. 2019, 136, 76–90. [Google Scholar] [CrossRef]
- Pektaş, A.; Acarman, T. Malware classification based on API calls and behaviour analysis. IET Inf. Secur. 2018, 12, 107–117. [Google Scholar] [CrossRef]
- Or-Meir, O.; Nissim, N.; Elovici, Y.; Rokach, L. Dynamic Malware Analysis in the Modern Era—A State of the Art Survey. ACM Comput. Surv. 2019, 52, 1–48. [Google Scholar] [CrossRef]
- Taher, F.; AlFandi, O.; AI-kfairy, M.; AI Hamadi, H.; Alrabaee, S. DroidDetectMW: A Hybrid Intelligent Model for Android Malware Detection. Appl. Sci. 2023, 13, 7720. [Google Scholar] [CrossRef]
- Ye, Y.; Li, T.; Adjeroh, D.; Lyengar, S.S. A Survey on Malware Detection Using Data Mining Techniques. ACM Comput. Surv. 2017, 50, 1–40. [Google Scholar] [CrossRef]
- Yang, H.; Li, S.; Wu, X.; Lu, H.; Han, W. A Novel Solutions for Malicious Code Detection and Family Clustering Based on Machine Learning. IEEE Access 2019, 7, 148853–148860. [Google Scholar] [CrossRef]
- Zhao, Y.; Cui, W.; Geng, S.; Bo, B.; Feng, Y.; Zhang, W. A Malware Detection Method of Code Texture Visualization Based on an Improved Faster RCNN Combining Transfer Learning. IEEE Access 2020, 8, 166630–166641. [Google Scholar] [CrossRef]
- Nataraj, L.; Manjunath, B. SPAM: Signal Precessing to Analyze Malware [Applications Corner]. IEEE Signal Process. Mag. 2016, 33, 105–117. [Google Scholar] [CrossRef]
- El Merabet, H.; Hajraoui, A. A Survey of Malware Detection Techniques based on Machine Learning. Int. J. Adv. Comput. Sci. Appl. 2019, 10, 366–373. [Google Scholar] [CrossRef]
- Naeem, H.; Guo, B.; Naeem, M.; Ullah, F.; Aldabbas, H.; Javed, M. Identification of malicious code variants based on image visualization. Comput. Electr. Eng. 2019, 76, 225–237. [Google Scholar] [CrossRef]
- Li, Q.; Mi, J.; Li, W.; Wang, J.; Cheng, M. CNN-Based Malware Variants Detection Method for Internet of Things. IEEE Internet Things J. 2021, 8, 16946–16962. [Google Scholar] [CrossRef]
- Sudhakar; Kumar, S. MCFT-CNN: Malware classification with finetune convolution neural networks using traditional and transfer learning in Internet of Things. Future Gener. Comput. Syst. 2021, 125, 334–351. [Google Scholar] [CrossRef]
- Vasan, D.; Alazab, M.; Wassan, S.; Safaei, B.; Zheng, Q. Image-Based malware classification using ensemble of CNN architectures (IMCEC). Comput. Secur. 2020, 92, 101748. [Google Scholar] [CrossRef]
- Chollet, F. Xception: Deep Learning with Depthwise Separable Convolutions. In Proceedings of the 2017 Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017. [Google Scholar]
- Tan, M.; Le, Q.V. EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks. In Proceedings of the 36th International Conference on Machine Learning, Long Beach, CA, USA, 10–15 June 2019. [Google Scholar]
- Huang, G.; Liu, Z.; Maaten, L. Densely Connected Convolutional Networks. In Proceedings of the 2017 Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017. [Google Scholar]
- Szegedy, C.; Ioffe, S.; Vanhoucke, V.; Alemi, A. Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, San Francisco, CA, USA, 4–9 February 2017. [Google Scholar]
- Cui, Z.; Xue, F.; Cai, X.; Cao, Y.; Wang, G.; Chen, J. Detection of Malicious Code Variants Based on Deep Learning. IEEE Trans. Ind. Inform. 2018, 14, 3187–3196. [Google Scholar] [CrossRef]
- Venkatraman, S.; Alazab, M.; Vinayakumar, R. A hybrid deep learning image-based analysis for effective malware detection. J. Inf. Secur. Appl. 2019, 47, 377–389. [Google Scholar] [CrossRef]
- Vasan, D.; Alazab, M.; Wassan, S.; Naeem, H.; Safaei, B.; Zheng, Q. IMCFN: Image-based malware classification using fine-tuned convolutional neural network architecture. Comput. Netw. 2020, 171, 107138. [Google Scholar] [CrossRef]
- Verma, V.; Muttoo, S.; Singh, V. Multiclass malware classification via first- and secind-order texture statistics. Comput. Secur. 2020, 97, 101895. [Google Scholar] [CrossRef]
- Wang, C.; Zhao, Z.; Wang, F.; Li, Q. A Novel Malware Detection and Family Classification Scheme for IoT Based on DEAM and DenseNet. Secur. Commun. Netw. 2021, 2021, 6658842. [Google Scholar] [CrossRef]
- Wang, S.; Wang, J.; Song, Y.; Li, S. Malicious Code Variant Identification Based on Multiscale Frature Fusion CNNs. Comput. Intell. Neurosci. 2021, 2021, 1070586. [Google Scholar] [CrossRef] [PubMed]
Works | Years | Used Approach | Data Analysis | Dataset | Accuracy (%) |
---|---|---|---|---|---|
Luo L. et al. [17] | 2017 | Semantics-Based Obfuscation-Resilient Binary Code Similarity Comparison | Static | N/A | N/A |
Liu Y. et al. [18] | 2019 | Latent Dirichlet Allocation | Static | Microsoft. Kaggle, CNCERT | 94.00 |
Alaeiyan M. et al. [19] | 2019 | Based on a conditioned graph structure | Dynamic | VirusShare | 97.10 |
Pektaş A. et al. [20] | 2018 | Online Machine Learning Algorithms | Dynamic | Malware Samples | 98.00 |
Yang H. et al. [24] | 2019 | Ensemble Models + t-SNE Algorithm | Machine Learning | Datacon | 98.39 99.67 |
Zhao Y. et al. [25] | 2020 | CNN | Deep Learning | Kaggle | 92.80 |
Naeem H. et al. [28] | 2019 | Collective Local and Global Malicious Patterns | Machine Learning | Malimg, Malheur, VirusShare, Microsoft Kaggle | 98.40 |
Method | Configuration | Method | Configuration |
---|---|---|---|
Rescale | 1/255 | Horizontal flip | False |
Fill mode | None | Width shift | 0.0 |
Height shift | 0.0 |
Dataset | The Model in This Article (Pre-Data Augmentation) | The Model in This Article (Post-Data Augmentation) | ||||||
---|---|---|---|---|---|---|---|---|
Accuracy (%) | Precision (%) | Recall (%) | F1-Score (%) | Accuracy (%) | Precision (%) | Recall (%) | F1-Score (%) | |
Malimg | 98.18 | 98.17 | 98.22 | 98.40 | 99.33 | 99.40 | 99.56 | 99.20 |
Blended+ | 96.07 | 96.02 | 96.10 | 96.28 | 96.60 | 96.23 | 96.40 | 96.57 |
Methods | Time | Accuracy (%) | Precision (%) | Recall (%) | F1-Score (%) |
---|---|---|---|---|---|
SPAM-GIST [26] | 2016 | 97.40 | —— | —— | —— |
DRBA+CNN [36] | 2018 | 94.50 | 96.60 | 88.40 | —— |
Venkatraman [37] | 2019 | 96.30 | 91.80 | 91.50 | 91.60 |
IMCFN [38] | 2020 | 98.82 | 98.85 | 98.81 | 98.75 |
Vinita [39] | 2020 | 98.58 | 98.04 | 98.06 | 98.05 |
DEAM-Densenet [40] | 2021 | 98.50 | 96.90 | 96.60 | 96.70 |
MFFC [41] | 2021 | 98.72 | 98.86 | 98.72 | 98.73 |
CoAtNet | —— | 99.33 | 99.40 | 99.56 | 99.20 |
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
Huang, H.; Du, R.; Wang, Z.; Li, X.; Yuan, G. A Malicious Code Detection Method Based on Stacked Depthwise Separable Convolutions and Attention Mechanism. Sensors 2023, 23, 7084. https://doi.org/10.3390/s23167084
Huang H, Du R, Wang Z, Li X, Yuan G. A Malicious Code Detection Method Based on Stacked Depthwise Separable Convolutions and Attention Mechanism. Sensors. 2023; 23(16):7084. https://doi.org/10.3390/s23167084
Chicago/Turabian StyleHuang, Hong, Rui Du, Zhaolian Wang, Xin Li, and Guotao Yuan. 2023. "A Malicious Code Detection Method Based on Stacked Depthwise Separable Convolutions and Attention Mechanism" Sensors 23, no. 16: 7084. https://doi.org/10.3390/s23167084