Detecting Rust Code Vulnerabilities Through Transfer Learning

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 (HGNN) 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.

Authors

Institutions

Publication Details

Journal
International Journal of Software Engineering and Knowledge Engineering
Published
2026-03-05
DOI
https://doi.org/10.1142/s0218194026500208
Primary Topic
Software Testing and Debugging Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Detecting Rust Code Vulnerabilities Through Transfer Learning

Dianxiang Xu, Irfan Ali Khan, Weifeng Xu, Yu Luo
International Journal of Software Engineering and Knowledge Engineering
Software Testing and Debugging Techniques
article

Detecting Rust Code Vulnerabilities Through Transfer Learning

Dianxiang Xu, Irfan Ali Khan, Weifeng Xu, Yu Luo
article en

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 (HGNN) 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.

International Journal of Software Engineering and Knowledge Engineering
Twitter (United States) (US)
Openalex Percentile: Top 44%
Software Testing and Debugging Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.