HackerPapers

arXiv:2003.03296cs.PL

Memory-Safety Challenge Considered Solved? An In-Depth Study with All Rust CVEs

Hui Xu, Zhuangbin Chen, Mingshen Sun, Yangfan Zhou, Michael Lyu

Abstract

Rust is an emerging programing language that aims at preventing memory-safety bugs without sacrificing much efficiency. The claimed property is very attractive to developers, and many projects start using the language. However, can Rust achieve the memory-safety promise? This paper studies the question by surveying 186 real-world bug reports collected from several origins which contain all existing Rust CVEs (common vulnerability and exposures) of memory-safety issues by 2020-12-31. We manually analyze each bug and extract their culprit patterns. Our analysis result shows that Rust can keep its promise that all memory-safety bugs require unsafe code, and many memory-safety bugs in our dataset are mild soundness issues that only leave a possibility to write memory-safety bugs without unsafe code. Furthermore, we summarize three typical categories of memory-safety bugs, including automatic memory reclaim, unsound function, and unsound generic or trait. While automatic memory claim bugs are related to the side effect of Rust newly-adopted ownership-based resource management scheme, unsound function reveals the essential challenge of Rust development for avoiding unsound code, and unsound generic or trait intensifies the risk of introducing unsoundness. Based on these findings, we propose two promising directions towards improving the security of Rust development, including several best practices of using specific APIs and methods to detect particular bugs involving unsafe code. Our work intends to raise more discussions regarding the memory-safety issues of Rust and facilitate the maturity of the language.

arXiv comments
Journal reference
DOI
Subjects
cs.PLProgramming Languages cs.CRCryptography and Security cs.SESoftware Engineering

On Hacker News

Linked by 3 identifiable commenters in 6 comments across 6 threads, from Jun 2020 to Jul 2024. Found in 4 HN submissions from Jun 2020 to Jan 2021. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments6 threads

    • Microsoft: 70% of all security bugs are memory safety issues: https://www.zdnet.com/article/microsoft-70-percent-of-all-se... Chrome: 70% of all security bugs are memory safety issues: https://www.zdnet.com/article/chrome-70-of-all-security-bugs... "Rust is an emerging…

      timschmidtView on HNParent context

  1. Rewrite it in Rust 1 comment
    • https://arxiv.org/abs/2003.03296 "Rust is an emerging programing language that aims at preventing memory-safety bugs without sacrificing much efficiency. The claimed property is very attractive to developers, and many projects start using the language. However, can Rust achieve…

      timschmidtView on HNParent context

    • Here is a good summary of how Ada deals with safety in the context of memory management: https://news.ycombinator.com/item?id=14216128 It's not rust but at the same time I think rust has sacrificed general safety in favor of memory safety which has produced a tendency towards a…

      Arch-TKView on HNParent context

    • Yet once the Chromium team goes down that Rust to C++ FFI route, they will encounter the same old bugs outlined in this paper. [0] They might as well fork Servo and create their own engine from that, but even that is still a prototype worked on for years with zero C++ at least.…

      rvzView on HNParent context

    • Don't let your feelings get in the way of your valid argument about C++. The Linux kernel will eventually going use the FFI route from Rust and C someday, but it is no safer in both safe Rust and unsafe Rust according to this memory saftey assessment study that has Rust CVEs [0]…

      rvzView on HNParent context

    • That's if you use 'Safe Rust', then the safety guarantees hold true. However, the risks increase as soon as you start using unsafe{} or import a crate that also has unsafe{} code which is why I like using cargo-geiger on my projects to see the unsafe{} uses in my code and…

      rvzView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.