Practical Android Pentesting: A Case Study on TikTok RCE
A WebView in TikTok concatenated a user-controlled URL into JavaScript executed after page load, allowing script injection on any loaded site. Chaining this with an internal deep-link bridge and a zip extraction flaw that lacked path traversal checks let an attacker overwrite native libraries and achieve remote code execution.
Published on dphoeniixx.medium.com
This write-up was previously removed because I personally believe that working with TikTok is Haram. I deleted it to avoid encouraging other Muslims in that direction.
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
Impact
An attacker who gets the victim to open a crafted link could run script in the WebView and, by chaining the download and extraction flaws, overwrite native libraries to achieve remote code execution; the intent-scheme path alone needed a user click.
What the attacker needed
Victim opens a crafted link; user clicks once for intent scheme; app has mini-app split installed
How it was found
- Open the tiktok://webview deep-link with a falcon URL whose fragment contains script, so the script runs in the WebView.
- Use the ToutiaoJSBridge openSchema function to open the internal aweme://wiki deep-link.
- Bypass the wiki URL validation using the javascript scheme to run script there.
- Invoke preloadMiniApp so the mini-app context and cache path are initialised.
- Trigger the sdkUpdate action with a high version and a URL whose filename ends in the file's md5, so the malicious zip is downloaded.
- The zip is extracted without the traversal check, overwriting native libraries in app_lib, which the app then loads.
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 an in-app browser. The app took part of a web address and pasted it directly into a script it ran, so a crafted link could run the attacker's own script inside the app. From there, other weak spots in the app let the attacker replace a code library the app loads, so the app ran the attacker's code.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.