Exploiting Unsanitized URL Handling and SQL Injection through Deep Links in iOS App: Write-up of Flipcoin Lab
The Flipcoin iOS wallet app accepted an undocumented 'testnet' parameter in its deep link without sanitisation, letting an attacker point the app at their own server. Combined with a local UNION-based SQL injection in the 'amount' parameter, an attacker with physical access could extract the wallet's recovery key and send it to a host they control.
Whether in application security testing for web or mobile applications, understanding the application’s flow — including how it receives and processes input — is essential for effectively identifying potential vulnerabilities. This understanding is important because security risks can emerge from multiple layers…
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 passed the deep link's 'amount' value into a SQLite query built with sqlite3_prepare without parameter binding, and also trusted an undocumented 'testnet' URL parameter without validation.
Impact
An attacker with physical access to the device could extract the wallet recovery key from the local database and, via the unsanitised testnet parameter, exfiltrate it to a server they control.
What the attacker needed
Physical access to the device; jailbroken iOS device; attacker-controlled server
How it was found
- Obtain the deep link from the QR code shown in the app.
- Reverse the app binary in Ghidra to find extra deep link parameters, including 'testnet' and a default dev URL.
- Add the 'testnet' parameter to the deep link pointing at the tester's own server and confirm the app sends a request to it.
- Locate the SQLite database holding sensitive data and inspect its tables.
- Hook sqlite3_prepare with Frida to watch queries being prepared.
- Inject into the 'amount' parameter and use UNION-based SQL injection to extract the recovery key.
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 special link that opens a particular screen inside an app, and this app also accepted an extra hidden setting in that link that told it which server to talk to. The app also put a value from the link straight into a database query, so crafted input could make the database return other stored data, such as a wallet recovery key. Because the hidden setting let the attacker choose the server, the stolen data could be sent straight to them.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.