arrow
Return

Machine Learning-Based Vulnerability Detection in Rust Code Using LLVM IR and Transformer Model

delete2025-09-18
delete0
delete
OA
AI
Y
Young Lee *
S
Syeda Jannatul Boshra
J
Jeong Yang
Z
Zechun Cao
G
Gongbo Liang
DOI:10.3390/make7030079delete
deleteOriginal
deleteShare
deleteSave
View PDF
Abstract

Abstract

En 中文
Rust’s growing popularity in high-integrity systems requires automated vulnerability detection in order to maintain its strong safety guarantees. Although Rust’s ownership model and compile-time checks prevent many errors, sometimes unexpected bugs may occasionally pass analysis, underlining the necessity for automated safe and unsafe code detection. This paper presents Rust-IR-BERT, a machine learning approach to detect security vulnerabilities in Rust code by analyzing its compiled LLVM intermediate representation (IR) instead of the raw source code. This approach offers novelty by employing LLVM IR’s language-neutral, semantically rich representation of the program, facilitating robust detection by capturing core data and control-flow semantics and reducing language-specific syntactic noise. Our method leverages a graph-based transformer model, GraphCodeBERT, which is a transformer architecture pretrained model to encode structural code semantics via data-flow information, followed by a gradient boosting classifier, CatBoost, that is capable of handling complex feature interactions—to classify code as vulnerable or safe. The model was evaluated using a carefully curated dataset of over 2300 real-world Rust code samples (vulnerable and non-vulnerable Rust code snippets) from RustSec and OSV advisory databases, compiled to LLVM IR and labeled with corresponding Common Vulnerabilities and Exposures (CVEs) identifiers to ensure comprehensive and realistic coverage. Rust-IR-BERT achieved an overall accuracy of 98.11%, with a recall of 99.31% for safe code and 93.67% for vulnerable code. Despite these promising results, this study acknowledges potential limitations such as focusing primarily on known CVEs. Built on a representative dataset spanning over 2300 real-world Rust samples from diverse crates, Rust-IR-BERT delivers consistently strong performance. Looking ahead, practical deployment could take the form of a Cargo plugin or pre-commit hook that automatically generates and scans LLVM IR artifacts during the development cycle, enabling developers to catch vulnerabilities at an early stage in the development cycle.
AI Summary

AI Summary

Key information extracted from the uploaded paper, including a brief overview, abstract, background, key highlights, visual analysis, and future outlook.

Journal

M
Machine Learning and Knowledge Extraction
IF:
6
Papers:
871
Citations:
1.8K

Organization

No organization information available
Cited Papers

Cited Papers

AIBugHunter: A Practical tool for predicting, classifying and repairing software vulnerabilities
err2023-11-20
err0
errOAAI
errMichael Fu; Chakkrit Tantithamthavorn; Trung Le; Yuki Kume; Van Nguyen; Dinh Phung; John Grundy
errShare
errSave
SySeVR: A Framework for Using Deep Learning to Detect Software Vulnerabilities
err2022-07-01
err261
errOAAI
errLi, Zhen; Zou, Deqing; Xu, Shouhuai; Jin, Hai; Zhu, Yawei; Chen, Zhaoxuan
errShare
errSave
Keynote Address: .QL for Source Code Analysis
err2007-09-01
err0
PREAI
errOege de Moor; Mathieu Verbaere; Elnar Hajiyev; Pavel Avgustinov; Torbjorn Ekman; Neil Ongkingco; Damien Sereni; Julian Tibble
errShare
errSave
SCL-CVD: Supervised contrastive learning for code vulnerability detection via GraphCodeBERT
err2024-10-01
err1
PREAI
errWang, Rongcun; Xu, Senlei; Tian, Yuan; Ji, Xingyu; Sun, Xiaobing; Jiang, Shujuang
errShare
errSave
Rudra
err2021-10-26
err0
errOAAI
errYechan Bae; Youngsuk Kim; Ammar Askar; Jungwon Lim; Taesoo Kim
errShare
errSave
researcher View more