Skip to content
Mobile Write-up Advanced

Hacking Xiaomi'S Android Apps - Part 1

Several Xiaomi Android apps exposed exported activities and deep links that loaded attacker-controlled URLs in WebViews, and one app had a flawed URL validation that allowed an open redirect to bypass the whitelist. An attacker could steal authentication tokens, read app logs, deceive users with fake app links, and invoke JavaScript bridges to access user data and device features.

ameya Follow

Published on blog.takemyhand.xyz

In this blogpost I want to disclose some interesting security issues that I found while researching on Xiaomi's assets, which got me to #5 within a month and also the top researcher spot for April and May '21.

Ameya (@iamTakeMyHand), on blog.takemyhand.xyz

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the apps exported activities and deep links that accepted arbitrary URLs and loaded them in WebViews without proper validation, and one app's URL check was inverted so that returning false allowed the WebView to load disallowed URLs.

Impact

An attacker could steal authentication tokens, read app logs, deceive users into thinking they are using the legitimate app, and invoke JavaScript bridges to access user data, control music, read calendar, and exfiltrate session information.

What the attacker needed

Victim clicks a link; malicious app installed; attacker hosts a page

The fix

The simple fix was to specify browser package in com.miui.player.component.HybridUriParser when launching browser intent.

How it was found

  1. Craft a deep link or intent that makes the app load an attacker-controlled URL in its WebView.
  2. Host a page that triggers the vulnerable behaviour, such as a download response or JavaScript bridge call.
  3. Send the link to the victim or use ADB to start the activity.
  4. The app loads the attacker page, which can access cookies, invoke JavaScript interfaces, or exfiltrate data.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Android apps can be told to open links or start screens by other apps. If an app trusts a link from outside without checking it, an attacker can make the app open a malicious web page inside the app. That page can then use the app's special powers, like reading your login token or calendar, because it runs inside the trusted app.

What is Mobile?

Flaws specific to Android and iOS apps: exported components, deep links, WebViews and data left on the device.

More by ameya

View all

1 more disclosed report, best first.

More from Xiaomi

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Mobile app vulnerabilities

The lesson behind this report.

Flaws specific to Android and iOS apps: exported components, deep links, WebViews and data left on the device.