Detecting Rust Code Vulnerabilities Through Transfer Learning
- 9 April 2026
- journal article
- research article
- Published by World Scientific Pub Co Pte Ltd in International Journal of Software Engineering and Knowledge Engineering
- Vol. 36 (13) , 1869-1899
Abstract
Rust is designed to prevent common memory safety issues, yet it remains susceptible to various security vulnerabilities. The limited availability of labeled vulnerability data in Rust presents a significant challenge for applying Machine Learning (ML) techniques. To address this, we propose TL-HGNN, a novel transfer learning framework that employs Heterogeneous Graph Neural Networks (HGNNs) and LLMs to detect Rust vulnerabilities without the need for Rust-specific training. TL-HGNN utilizes Inter-procedural Compressed Code Property Graphs (ICCPGs) to represent source code from high-resource languages (C or Java), training HGNN models that capture semantic and structural relationships. Rust code is translated into the source language using an iterative LLM-based approach to ensure correct syntax. The translated code is then converted into an ICCPG representation and analyzed with pre-trained HGNN models. Evaluations on 82 real-world Rust CVE pairs across 44 CWEs indicate that TL-HGNN achieves higher performance than the evaluated baselines on this dataset, achieving an F1-score of 66.24%. Additionally, an ablation study suggests the advantages of ICCPG representation over prior graph methods and the effectiveness of LLM translation over dictionary-based mapping for transfer learning. Our results also indicate that Java serves as a more effective source language than C in this context, and GPT-4.0 achieves higher performance than several other LLMs in translation quality. TL-HGNN represents an early application of transfer learning to Rust vulnerability detection.Keywords
This publication has 32 references indexed in Scilit:
- Transfer learning for software vulnerability prediction using Transformer modelsJournal of Systems and Software, 2025
- Understanding the Challenges in Detecting Vulnerabilities of Rust Applications2024
- Predicting Code Vulnerability Types via Heterogeneous GNN Learning2024
- Outside the Comfort Zone: Analysing LLM Capabilities in Software Vulnerability Detection2024
- A comprehensive analysis on software vulnerability detection datasets: trends, challenges, and road aheadInternational Journal of Information Security, 2024
- Formally understanding Rust’s ownership and borrowing system at the memory levelFormal Methods in System Design, 2024
- GNN-Based Transfer Learning and Tuning for Detecting Code Vulnerabilities across Different Programming Languages2024
- LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarks2024
- Deep Learning Based Vulnerability Detection: Are We There Yet?IEEE Transactions on Software Engineering, 2021
- Security Vulnerability Detection Using Deep Learning Natural Language Processing2021