Skip to content
RCE Write-up Advanced

Xiaomi Mi6 Browser Remote Code Execution (Pwn2Own 2018)

The Xiaomi Mi6 browser exposed a JavaScript bridge that allowed an attacker-controlled web page to save an arbitrary APK to disk, then redirect to the Market app which loaded a WebView with a JavaScript bridge that silently installed the APK. Finally, a content provider in the installed app could be triggered to start a service, leading to remote code execution.

labs.f-secure.com

Published on labs.f-secure.com

At Pwn2own in 2018, F-Secure Labs demonstrated compromise of the Xiaomi Mi6 when it connected to a web page under control by an attacker. At a high level, the following steps were followed:

The author, on labs.f-secure.com

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 browser and Market app exposed JavaScript bridges to any web content without restricting which sites could call them, and the Market app's install function accepted a local file path without validation.

Impact

An attacker could remotely execute code on the victim's Xiaomi Mi6 device by convincing them to visit a malicious web page.

What the attacker needed

Victim uses Xiaomi Mi6 browser; victim clicks a link; attacker controls a website

How it was found

  1. Victim clicks a link that loads the attacker's web page in the Xiaomi browser.
  2. The page uses the browser's JavaScript bridge to save a base64-encoded APK to disk.
  3. The page creates an iframe with a mimarket:// URL to open the Market app's WebView.
  4. The Market app loads another attacker page in its WebView.
  5. That page calls the Market app's JavaScript bridge to silently install the saved APK.
  6. After installation, a callback triggers a content URL that starts a service in the installed app, leading to code execution.

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.

A JavaScript bridge is a feature that lets a web page call functions inside a mobile app. Here, the browser and the Market app both had bridges that let any website save files and install apps without asking the user. An attacker could trick a user into visiting a malicious page, which then installed a malicious app and started it, giving the attacker control of the phone.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.