This 'Dirty Stream' Bug Affects Android Apps With Billions Of Combined Downloads

Dirty Stream

If there is anything that can hold pretty much every single secret and record every single activity, that thing would be a smartphone.

Thanks to its array of sensors, smartphones know where users are, and what they do, at anytime, anywhere. They also aid users in capturing moments with the cameras, and store memories inside their storage system. And due to how the internet is becoming increasingly available and affordable, users' internet activity, social media interactions and all, are also stored.

This is convenient, and also a huge issue.

By putting everything inside a smartphone, users are literally putting all eggs into one basket.

Hackers that know people would store pretty much all of their lives inside their gadgets, are increasingly targeting smartphones in order to steal sensitive data.

And this time, Microsoft found a severe flaw on Android operating system that could compromise billions of users.

The flaw is dubbed the 'Dirty Stream.'

Dirty Stream
Dirty stream attack. (Credit: Microsoft)

The issue that Microsoft discovered affects Android applications that share files with other applications.

What happens here is that, to facilitate the sharing in a secure manner, Android implements a so-called "content provider" feature that basically acts as an interface for managing and exposing an app's data to other installed applications on a device.

When that kind of app wants to share its files, it must declare the specific paths to be used by other apps to get to that data. File providers also include an identifying feature that other apps can use as an address to find them on a system.

"This content provider-based model provides a well-defined file-sharing mechanism, enabling a serving application to share its files with other applications in a secure manner with fine-grained control," Microsoft said.

However, in many cases when an Android app receives a file from another app, it does not validate the content.

"Most concerning, it uses the filename provided by the serving application to cache the received file within the consuming application's internal data directory."

This weakness gives malicious actors an opening to create a rogue app that can send a file with a malicious filename directly to a receiving app - or file share target - without the user's knowledge or approval, Microsoft said.

Typical file share targets include email clients, messaging apps, networking apps, browsers, and file editors. When a share target receives a malicious filename, it uses the filename to initialize the file and trigger a process that could end with the app getting compromised, Microsoft said.

The potential impact varies greatly, and depends on how the Android app implements its specifics.

But in some cases, hackers could use the flaw to overwrite a receiving app's settings and cause it to communicate with an attacker-controlled server, or get it to share the user's authentication tokens and other data.

Or, hackers can create a malicious app to overwrite malicious code into a receiving app's native library to enable arbitrary code execution.

"Since the rogue app controls the name as well as the content of the file, by blindly trusting this input, a share target may overwrite critical files in its private data space, which may lead to serious consequences," Microsoft said.

In all, it allows remote code execution, token theft, and other issues because of a common security weakness.

Dirty Stream
Getting remote access to local shares. (Credit: Microsoft)

The vulnerability is actually common, and can be found in several apps.

Microsoft found at least four of the apps have more than 500 million installations each. One of which, the Xiaomi's File Manager, has at least 1 billion installations.

Microsoft informed Google's Android security research team of the problem and Google has published an updated guidance for Android app developers on how to recognize and remediate the issue. Microsoft has also shared its findings with vendors of affected Android apps on Google's Play store, and Microsoft believes that the vendors have fixed the issue.

However, Microsoft also believes that there are more apps out there that are fallible to exploit and compromise because of the same security weakness.

"We anticipate that the vulnerability pattern could be found in other applications," Microsoft's threat intelligence team said, in a blog post.

"We're sharing this research so developers and publishers can check their apps for similar issues, fix as appropriate, and prevent introducing such vulnerabilities into new apps or releases."

While there is no saying what other apps out there that are affected by this bug, users can help mitigate the risk by ensuring their Android apps are up to date and by only installing apps from trusted sources.

Published: 
01/05/2024