Understanding RCEs + Exploiting Deep Links for RCE in Mobile Appl
A CTF walkthrough of the Injured Android app shows that a deep link handler passes a user-supplied binary name and parameter to a bundled native binary, allowing arbitrary command execution. The author demonstrates running a shell script placed in a writable location via a path traversal in the binary parameter.
Published on karliris62.medium.com
Remote Code Execution (RCE) is a critical security vulnerability that allows an attacker to run malicious code on a remote system or server without the user’s consent. Essentially, it means the attacker can gain control of another computer from anywhere in the world, executing commands as if they were a legitimate…
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 passes untrusted deep link parameters directly to a native binary execution function without validation or canonicalisation.
Impact
An attacker could execute arbitrary commands on the device with the app's privileges, limited to a CTF app and requiring a crafted link to be opened.
What the attacker needed
Victim opens a crafted deep link; app has a bundled executable binary; attacker can place a file in a writable location
The fix
The app should not execute files based on untrusted input and should whitelist and canonicalise all intent inputs.
How it was found
- Decompile the APK and inspect RCEActivity and AndroidManifest.xml to find the deep link intent filter and its query parameters.
- Identify the bundled binary narnia.x86_64 in the assets folder and check its accepted parameters.
- Craft deep links using the custom scheme with binary and param values to trigger the activity.
- Create a shell script in a writable location on the device and make it executable.
- Trigger the vulnerable app with a deep link that uses path traversal to point the binary parameter at the script.
- Read the output file to confirm arbitrary commands ran.
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 deep link is a URL that opens a specific screen inside a mobile app. Here the app took a file name from the link and ran it as a program without checking it. That let the tester run their own script and read the output, which is remote code execution.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.