New Bugs Identified in Popular Programming Language
During a six-and-a-half-hour implementation, a new static analysis tool created at Georgia Tech doubled the number of known memory safety bugs in the Rust programming language.
Developed over the course of three years, the tool, known as Rudra, recently received the distinguished artifact award during the ACM Symposium on Operating Systems Principles.
Rust is a general-purpose programming language for creating software applications and is managed by a community of volunteer coders. Within Rust exist two areas, safe and unsafe code. According to Yechan Bae, Ph.D. student at the Georgia Tech School of Cybersecurity and Privacy (SCP), Rudra is designed to search the safe and unsafe areas of Rust for memory safety bugs that may have eluded developers.
“When a program is written entirely in safe Rust, its compiler automatically guarantees memory safety,” said Bae. “On the other hand, if a program contains unsafe Rust, it is up to the programmer to guarantee memory safety.”
While programmers do their best to secure their code, Bae explained bugs can still slip through and compromise the safety of a program. Despite its sinister label, unsafe Rust is just the part of the language that isn’t covered under Rust’s memory safety guarantee. It is still regularly used by developers to write low-level systems software.
“Memory safety problems in Rust are the most subtle burden to developers writing secure programs,” said SCP Associate Professor Taesoo Kim. “Rudra helps all Rust programmers audit their projects in the unsafe parts of the Rust and discover potential memory bugs in an early phase. Its algorithm is fast and causes small false positives, allowing us to scale Rudra to all the Rust packages in its registry.”
Bae and his team identified three common bug patterns in unsafe Rust- panic safety, high-order invariant, and send/sync variance bugs- and created two new algorithms to detect them. Rudra was implemented as a custom Rust compiler using high-level intermediate representations and mid-level intermediate representations to detect the identified bugs.
“The two goals of Rudra were to identify the common security bugs throughout Rust and for the tool to be used daily by Rust users,” said Bae. “Our research helped developers and advised Rust security advisors of the existing threats.”
Rudra analyzed 43,000 Rust packages in its repository and found 264 unknown memory safety bugs throughout the Rust ecosystem. Two of these bugs were discovered in the Rust standard library, one in the official futures package. Rudra also detected an issue with Rust’s Compiler.
The research was presented by Bae at the 28th ACM Symposium on Operating Systems Principles. The paper, Rudra: Finding Memory Safety Bugs in Rust at the Ecosystem Scale, is co-authored by Yechan Bae, Youngsuk Kim, Ammar Askar, Jungwon Lim, and Taesoo Kim. The project was announced as the Distinguished Artifact Award winner at the beginning of the conference. The open-source software is available for free at https://github.com/sslab-gatech/Rudra.