arXiv:2610.21373cs.CROct 2026

Manuscript Offprint

arXiv:2610.21373

Evaluating and Improving Static Application Security Testing Tools for Rust

Huaien Zhang, Zhengjie Zhao, Yu Pei, Tian Dong, Minxue Pan, Shin Hwei Tan, Hao Chen

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Huaien Zhang, Zhengjie Zhao, Yu Pei, Tian Dong, Minxue Pan, Shin Hwei Tan, Hao Chen, Fellow, IEEE

Abstract—Rust has become a popular systems programming language in recent years because of its strong guarantees on memory and concurrency safety. Many types of system software have been re-implemented in Rust. However, Rust programs can still suffer from common memory and concurrency vulnerabilities due to unsafe code and misunderstandings of its complex mechanisms. To mitigate such vulnerabilities, developers often rely on static application security testing (SAST) tools. However, the effectiveness of existing Rust SAST tools on real-world vulnerabilities remains underexplored. In this paper, we first conduct an empirical evaluation of mainstream Rust SAST tools using security vulnerabilities identified in real-world Rust applications. We systematically assess their effectiveness, uncover common weaknesses, and analyze the root causes behind them. Motivated by the study, we propose TRUST, a large language model (LLM)-assisted automated testing framework. TRUST automatically analyzes the official Rust reference to derive and implement semantics-preserving transformations. It leverages these transformations to generate mutant programs for evaluating Rust SAST tools and uncovering potential faults within them. Overall, TRUST has revealed 46 faults across six popular SAST tools, 17 of which have been confirmed. In addition, our study yields ten empirical findings and four practical lessons that provide actionable guidance for developing more effective, robust, and maintainable Rust SAST tools.

Index Terms—Static analysis, software testing, Rust, LLM

I. INTRODUCTION

Rust has become a popular systems programming language and is widely used in domains including operating systems [1], compilers [2], and databases [3]. Rust ensures memory and concurrency safety through novel mechanisms such as ownership and borrow checking. However, developers may misunderstand or misuse Rust intrinsic language features, especially unsafe for low-level interactions, leaving Rust programs vulnerable to security issues. SAST tools can detect such vulnerabilities through static analysis without executing the programs, making them well suited to various Rust applications. However, unlike traditional programming languages such as C/C++ and Java, Rust has its own distinctive features. These features can affect the essential information required by static analysis; consequently, ignoring them can greatly reduce

use std::ffi::CString; use std::os::raw::c_char; struct PwEntry { pw_dir: *mut c_char, } fn make_entry(path: &str) -> PwEntry { let dir = CString::new(path).unwrap(); let dir_ptr = dir.into_raw(); PwEntry { pw_dir: dir_ptr } } fn print_and_free(entry: PwEntry) { unsafe { // from_raw() takes ownership back into a // CString, which will then be freed on drop let dir = CString::from_raw(entry.pw_dir); println!("dir = {:?}", dir); // dir is dropped here; the underlying // allocation is freed exactly once } } fn main() { let entry = make_entry("/home/user"); print_and_free(entry); }

Figure 1. A False Positive in UAF Vulnerability Detection

the accuracy of SAST tools. Figure 1 presents a Rust program example related to the ownership mechanism. Some SAST tools, such as LockBud [4], incorrectly treat the underlying allocation of dir as if it were freed by the call to into_raw at lines 8–9. In fact, into_raw only transfers ownership from CString to a raw pointer without freeing the underlying memory. As a result, SAST tools may report a use-after-free (UAF) warning at lines 15–16 for this example, which is a false positive.

This example illustrates a concrete challenge for applying SAST tools to Rust: if a tool does not correctly model Rust-specific semantics such as ownership transfer, it may misinterpret memory states and produce false alarms. Since Rust provides several language features that differ substantially from those of C/C++ and Java, it is important to understand how existing SAST tools handle such features in practice. To this end, we conduct the first comprehensive empirical study evaluating the capability, effectiveness, and limitations of existing SAST tools for Rust. Particularly, our study aims to answer the following research questions (RQs):

• RQ1: What vulnerability types is each SAST tool expected to detect? This RQ helps us understand the capability of each SAST tool in terms of vulnerability coverage and reveals whether different tools exhibit complementary strengths in detecting specific categories of security issues.

Huaien Zhang, Tian Dong, and Hao Chen are with the Department of Computer Science, University of Hong Kong, Pok Fu Lam, Hong Kong (e-mail: huaien@hku.hk; tiandong@hku.hk; chenho@hku.hk)

Zhengjie Zhao and Minxue Pan are with the Software Institute, Nanjing University, Nanjing 210023, China (e-mail: zhengjiezhao@smail.nju.edu.cn; mxp@nju.edu.cn).

Yu Pei is with the Department of Computing, Hong Kong Polytechnic University, Hung Hom, Hong Kong (e-mail: max.yu.pei@polyu.edu.hk)

Shin Hwei Tan is with the Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada (e-mail: shinhwei.tan@concordia.ca)

• RQ2: How do SAST tools perform on real-world projects? This RQ assesses the effectiveness of these tools in detecting real-world vulnerabilities, focusing on false positive (FP) and false-negative (FN) rates in realistic software development scenarios.

• RQ3: What are the underlying causes of inaccurate analysis results? This RQ investigates the limitations of SAST tools by analyzing FPs and FNs and identifies the key factors that affect their effectiveness.

To address the research questions, we manually collected 320 vulnerabilities from four popular vulnerability sources and evaluated six popular SAST tools, including Semgrep, LockBud, Prusti, Rudra, MIRAI, and MirChecker, on this dataset. Through this investigation, we summarized ten key findings from our analysis and derived four lessons for improving Rust SAST tools. Based on these findings, we proposed TRUST, an LLM-assisted testing framework that can identify and apply semantics-preserving program transformations derived from the Rust Reference [5]. On the six aforementioned SAST tools, TRUST successfully detected 46 previously unknown faults. We have reported all detected faults to the corresponding developers, and 17 of them have been confirmed to date, which clearly demonstrates the value of TRUST and the findings summarized in this study.

Prior studies have shown that semantics-preserving transformations can effectively expose faults in a wide range of SAST tools [6], [7], [8]. However, these approaches rely on predefined transformation patterns, limiting their ability to adapt to evolving language features. Moreover, existing evaluations of SAST tools have predominantly focused on established languages such as C/C++ [7], Java [9], [10], and Solidity [11], [12], [13], leaving newer programming languages insufficiently examined. This gap is particularly significant in the case of Rust, a modern systems programming language with unique features such as ownership and borrowing that fundamentally shape program behavior. Although Rust is designed to enforce strong memory-safety guarantees, vulnerabilities can still emerge from unsafe code, developer misconceptions, and complex language interactions. As a result, understanding the effectiveness and limitations of Rust-specific SAST tools is both necessary and timely, yet remains largely underexplored.

Overall, this paper makes the following contributions:

  • To the best of our knowledge, we present the first empirical study of Rust SAST tools. Our study is based on 320 real-world vulnerabilities collected from four popular security advisory databases. Using these samples, we analyze the effectiveness of these tools and derive ten key findings and four lessons for future SAST tool design.

• Motivated by these findings, we propose TRUST, a novel testing framework that synthesizes semantics-preserving program transformations based on the language reference and automatically detects faults in SAST tools.

• We evaluate TRUST on six SAST tools and uncover 46 previously unknown faults, 17 of which have been confirmed by the corresponding developers. The experimental data and source code of TRUST are publicly available at Link.

References (27)