journal article·2025-06-10Open access

Go Source Code Vulnerability Detection Method Based on Graph Neural Network

Lisha Yuan, Yong Fang, Qiang Zhang, Zhonglin Liu, Yijia Xu

Applied Sciences· Volume 15· Issue 12

Abstract

With the widespread application of the Go language, the demand for vulnerability detection in Go programs is increasing. Existing detection models and methods have deficiencies in extracting source code features of Go programs and mainly focus on detecting concurrency vulnerabilities. In response to these issues, we propose a Go program vulnerability detection method based on a graph neural network (GNN). The core of this approach is to utilize GraphSAGE to extract the global structure and deep semantic information of each concurrent function, maximizing the learning of concurrency vulnerability features. To capture contextual information of fine-grained code fragments in source code, we employ taint analysis to extract taint propagation chains and use a Transformer model with a multi-head attention mechanism, based on lexical analysis, to extract fine-grained vulnerability features. We integrate graph-level and token-level features to maximize the detection of various complex types of vulnerabilities in Go source code. Experimental results on a real-world vulnerability dataset demonstrate that our model outperforms existing detection methods and tools, achieving an F1-score of 91.35%. Furthermore, ablation experiments confirm that the proposed feature fusion method effectively extracts deep vulnerability features.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Advanced Malware Detection Techniques · Software Testing and Debugging Techniques · Software Engineering Research

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

School of Cyber Science and Engineering, Sichuan University, Chengdu 610207, China

Funding

Key Laboratory of Data Protection and Intelligent Management, Ministry of Education, Sichuan University

References (45)

Show source-provided references
1. Boucher, N., and Anderson, R. (2023, January 9–11). Trojan source: Invisible vulnerabilities. Proceedings of the 32nd USENIX security symposium (USENIX Security 23), Anaheim, CA, USA.
2. Cpvd: Cross project vulnerability detection based on graph attention network and domain adaptation10.1109/TSE.2023.3285910 ↗
3. Vul-LMGNNs: Fusing language models and online-distilled graph neural networks for code vulnerability detection10.1016/j.inffus.2024.102748 ↗
4. Vulnerability detection via multiple-graph-based code representation10.1109/TSE.2024.3427815 ↗
5. Combining graph-based learning with automated data collection for code vulnerability detection10.1109/TIFS.2020.3044773 ↗
6. PWAGAT: Potential Web attacker detection based on graph attention network10.1016/j.neucom.2023.126725 ↗
7. Unknown web attack threat detection based on large language model10.1016/j.asoc.2025.112905 ↗
8. Bgnn4vd: Constructing bidirectional graph neural-network for vulnerability detection10.1016/j.infsof.2021.106576 ↗
9. HyVulDect: A hybrid semantic vulnerability mining system based on graph neural network10.1016/j.cose.2022.102823 ↗
10. Liu, Z., Zhu, S., Qin, B., Chen, H., and Song, L. (2021, January 19–23). Automatically detecting and fixing concurrency bugs in go software systems. Proceedings of the 26th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Virtual.10.1145/3445814.3446756 ↗
11. Liu, Z., Xia, S., Liang, Y., Song, L., and Hu, H. (March, January 28). Who goes first? Detecting go concurrency bugs via message reordering. Proceedings of the 27th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Lausanne, Switzerland.
12. Inductive representation learning on large graphs
13. Chen, T., and Guestrin, C. (2016, January 13–17). Xgboost: A scalable tree boosting system. Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA.10.1145/2939672.2939785 ↗
14. CSGVD: A deep learning approach combining sequence and graph embedding for source code vulnerability detection10.1016/j.jss.2023.111623 ↗
15. VDoTR: Vulnerability detection based on tensor representation of comprehensive code graphs10.1016/j.cose.2023.103247 ↗
16. Wen, X.C., Chen, Y., Gao, C., Zhang, H., Zhang, J.M., and Liao, Q. (2023, January 14–20). Vulnerability detection with graph simplification and enhanced graph representation learning. Proceedings of the 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), Melbourne, Australia.10.1109/ICSE48619.2023.00191 ↗
17. Mergendahl, S., Burow, N., and Okhravi, H. (2022, January 18–20). Cross-Language Attacks. Proceedings of the NDSS, Chengdu, China.10.14722/ndss.2022.24078 ↗
18. Jackson, J. (2025, June 01). Microsoft: Rust Is the Industry’s ‘Best Chance’ at Safe Systems Programming, 20 October 2020. Available online: https://thenewstack.io/microsoft-rust-is-the-industrys-best-chance-at-safe-systems-programming/.
19. Xu, Z., Chen, B., Chandramohan, M., Liu, Y., and Song, F. (2017, January 20–28). Spain: Security patch analysis for binaries towards understanding the pain and pills. Proceedings of the 2017 IEEE/ACM 39th International Conference on Software Engineering (ICSE), Buenos Aires, Argentina.10.1109/ICSE.2017.49 ↗
20. Predicting vulnerable software components via text mining10.1109/TSE.2014.2340398 ↗
21. Improving defect prediction with deep forest10.1016/j.infsof.2019.07.003 ↗
22. Li, Y., Wang, S., and Nguyen, T.N. (2021, January 23–28). Vulnerability detection with fine-grained interpretations. Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Athens, Greece.10.1145/3468264.3468597 ↗
23. Sysevr: A framework for using deep learning to detect software vulnerabilities10.1109/TDSC.2021.3051525 ↗
24. Wu, F., Wang, J., Liu, J., and Wang, W. (2017, January 13–16). Vulnerability detection with deep learning. Proceedings of the 2017 3rd IEEE international conference on computer and communications (ICCC), Chengdu, China.10.1109/CompComm.2017.8322752 ↗
25. Devign: Effective vulnerability identification by learning comprehensive program semantics via graph neural networks
26. Li, Z., Zou, D., Xu, S., Ou, X., Jin, H., Wang, S., Deng, Z., and Zhong, Y. (2018). Vuldeepecker: A deep learning-based system for vulnerability detection. arXiv.10.14722/ndss.2018.23158 ↗
27. Software vulnerability detection using deep neural networks: A survey10.1109/JPROC.2020.2993293 ↗
28. Nie, X., Li, N., Wang, K., Wang, S., Luo, X., and Wang, H. (2023, January 17–21). Understanding and tackling label errors in deep learning-based vulnerability detection (experience paper). Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis, Seattle, WA, USA.10.1145/3597926.3598037 ↗
29. Cross-domain vulnerability detection using graph embedding and domain adaptation10.1016/j.cose.2022.103017 ↗
30. Wang, C., Ko, R., Zhang, Y., Yang, Y., and Lin, Z. (2023, January 14–20). Taintmini: Detecting flow of sensitive data in mini-programs with static taint analysis. Proceedings of the 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), Melbourne, Australia.10.1109/ICSE48619.2023.00086 ↗
31. Chen, S., Lin, Z., and Zhang, Y. (2021, January 11–13). {SelectiveTaint}: Efficient data flow tracking with static binary rewriting. Proceedings of the 30th USENIX Security Symposium (USENIX Security 21), Vancouver, BC, Canada.
32. Zhang, L., Chen, J., Diao, W., Guo, S., Weng, J., and Zhang, K. (2019, January 23–25). {CryptoREX}: Large-scale analysis of cryptographic misuse in {IoT} devices. Proceedings of the 22nd International Symposium on Research in Attacks, Intrusions and Defenses (RAID 2019), Beijing, China.
33. Detecting and measuring aggressive location harvesting in mobile apps via data-flow path embedding10.1145/3579447 ↗
34. Huang, W., Dong, Y., and Milanova, A. (2014, January 5–13). Type-based taint analysis for Java web applications. Proceedings of the Fundamental Approaches to Software Engineering: 17th International Conference, FASE 2014, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2014, Grenoble, France. Proceedings 17.
35. Fu, X., and Cai, H. (2020, January 5–11). Scaling application-level dynamic taint analysis to enterprise-scale distributed systems. Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering: Companion Proceedings, Seoul, Republic of Korea.10.1145/3377812.3390910 ↗
36. Zhang, J., Tian, C., and Duan, Z. (2019, January 25–31). Fastdroid: Efficient taint analysis for android applications. Proceedings of the 2019 IEEE/ACM 41st International Conference on Software Engineering: Companion Proceedings (ICSE-Companion), Montreal, QC, Canada.10.1109/ICSE-Companion.2019.00092 ↗
37. Zhong, Z., Liu, J., Wu, D., Di, P., Sui, Y., and Liu, A.X. (2022, January 21–29). Field-based static taint analysis for industrial microservices. Proceedings of the 44th International Conference on Software Engineering: Software Engineering in Practice, Pittsburgh, PA, USA.10.1145/3510457.3513075 ↗
38. Liang, J., Wang, M., Zhou, C., Wu, Z., Jiang, Y., Liu, J., Liu, Z., and Sun, J. (2022, January 23–25). Pata: Fuzzing with path aware taint analysis. Proceedings of the 2022 IEEE Symposium on Security and Privacy (SP), San Francisco, CA, USA.10.1109/SP46214.2022.9833594 ↗
39. Chow, Y.W., Schäfer, M., and Pradel, M. (2023, January 17–21). Beware of the unexpected: Bimodal taint analysis. Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis, Seattle, WA, USA.10.1145/3597926.3598050 ↗
40. Liu, P., Sun, C., Zheng, Y., Feng, X., Qin, C., Wang, Y., Li, Z., and Sun, L. (2023). Harnessing the power of llm to support binary taint analysis. arXiv.
41. Qi, Z., Feng, Q., Cheng, Y., Yan, M., Li, P., Yin, H., and Wei, T. (2021, January 21–25). SpecTaint: Speculative Taint Analysis for Discovering Spectre Gadgets. Proceedings of the NDSS, Virtual.10.14722/ndss.2021.24466 ↗
42. Design and implementation of an efficient container tag dynamic taint analysis10.1016/j.cose.2023.103528 ↗
43. Sang, Q., Wang, Y., Liu, Y., Jia, X., Bao, T., and Su, P. (2024, January 20–22). Airtaint: Making dynamic taint analysis faster and easier. Proceedings of the 2024 IEEE Symposium on Security and Privacy (SP), San Francisco, CA, USA.10.1109/SP54263.2024.00045 ↗
44. (2025, May 20). Available online: https://github.com/advisories.
45. On the selection of a better radial basis function and its shape parameter in interpolation problems