How I Stole a Crypto Key from an Android App: A Deep Dive into We
The Android app exposed a JavaScript bridge (CryptoInterface) to any page loaded in its WebView, and a deep link allowed loading an attacker-controlled URL. An attacker could host a malicious page that calls the bridge to read the crypto key from SharedPreferences and exfiltrate it.
The MHL Exchange app is a deliberately vulnerable Android cryptocurrency exchange. The goal: steal the crypto key stored in the app’s SharedPreferences by exploiting a WebView JavaScript bridge.
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 app registered a JavaScript bridge with sensitive methods and allowed a deep link to load arbitrary URLs in the WebView without validation.
What the attacker needed
Victim clicks a crafted deep link; attacker-controlled web server
How it was found
- Decompile the APK with JADX to find the deep link scheme, backend URL, and bridge name.
- Set up a local HTTP server and expose it via ngrok.
- Create a malicious HTML page that calls the bridge method getCryptoKey and sends the result to a webhook.
- Trigger the deep link mhlcrypto://showPage?url=<ngrok URL> to load the page in the WebView.
- Observe the exfiltrated crypto key on the webhook dashboard.
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 WebView is a mini-browser inside an app. This app let any web page it loaded talk to the app's own code through a bridge, and a link could make the app load an attacker's page. That page then asked the bridge for the secret key and sent it to the attacker.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.