Google Migrating Android to Memory-Safe Programming Languages

Google is seeing a significant decrease in memory safety issues in Android due to the progressive migration to memory-safe programming languages, such as Rust.

Between 2019 and 2022, the annual number of reported memory safety issues in Android has dropped from 223 to 85, due to an increase in the amount of memory-safe code entering the mobile platform, and the trend is expected to continue.

Memory safety bugs, Google notes, are typically the most severe type of vulnerabilities. In 2022, they accounted for 86% of the critical-severity flaws in Android and for 89% of the remotely exploitable issues.

“Over the past few years, memory safety vulnerabilities have accounted for 78% of confirmed exploited ‘in-the-wild’ vulnerabilities on Android devices,” the internet giant explains.

The company also points out that the decrease in severe vulnerabilities has led to an increase in lower-impact issues, such as denial-of-service (DoS) flaws.

With most of the new code added to Android 13 being written in a memory-safe language, memory safety issues no longer represent the majority of vulnerabilities in the operating system, Google says.

“While correlation doesn’t necessarily mean causation, it’s interesting to note that the percent of vulnerabilities caused by memory safety issues seems to correlate rather closely with the development language that’s used for new code,” Google notes.

Support for Rust was introduced in Android 12, with the purpose of shifting development to a memory-safe programming language rather than converting existing C/C++ code to Rust.

“In Android 13, about 21% of all new native code (C/C++/Rust) is in Rust. To date, there have been zero memory safety vulnerabilities discovered in Android’s Rust code,” Google says.

The internet giant has also invested in improving the memory safety of C/C++ and says it has seen very few memory safety issues in Java, which uses the Java Native Interface (JNI) interface programming framework to access low-level resources. Most of the APIs in Android are implemented in Java.

The goal is to use Rust anywhere where native code is required, including kernel (due to support for Rust in Linux 6.1).

“Using Rust in Android allows us to optimize both security and system health with fewer compromises” to performance and security, Google says.

“As Android migrates away from C/C++ to Java/Kotlin/Rust, we expect the number of memory safety vulnerabilities to continue to fall,” the internet giant continues.

Related: NSA Publishes Guidance on Mitigating Software Memory Safety Issues

Related: Google Details Memory-Related Security Improvements in Android 11

Related: Google Working on Improving Memory Safety in Chrome

view counter

Ionut Arghire is an international correspondent for SecurityWeek.

Previous Columns by Ionut Arghire:

Source link


Leave a Reply

Your email address will not be published. Required fields are marked *