Recreating Cordova Mobile Apps To Bypass Security Implementations
Cordova mobile apps ship their HTML and JavaScript source in the APK, so an attacker can extract it and rebuild a cloned app with the same package name, bypassing code-tampering and integrity checks. The author demonstrates cloning a banking app and notes that the original app's plugins may also have known vulnerabilities.
Published on infosecwriteups.com
I have recently found that hybrid mobile applications are used by many organizations. Hybrid applications allow developers to create applications using the same technologies and even the same code with minor to no changes for different OS or platforms.
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
Cordova apps store their HTML and JavaScript source as plain files inside the APK, and the framework provides no built-in way to compile or protect that source, so integrity checks can be bypassed by rebuilding the app.
Impact
An attacker could bypass code-tampering and integrity checks and create a malicious clone of the app, though the author notes the method may not work on every application.
What the attacker needed
A Cordova-based APK; NodeJS, Android SDK, Java JDK and Gradle; same package name as the original app
The fix
Cordova apps should add their own integrity and tamper-detection mechanisms, since the framework does not provide source protection by default.
How it was found
- Unzip the original APK and open the assets/www folder to view the HTML and JavaScript source.
- Create a new Cordova project with the same app name and package name as the original.
- Copy the source files from the original www folder into the new project, excluding cordova.js, cordova_plugins.js, cordova-js-src/ and plugins/.
- Add the Android platform version found in the original cordova.js file.
- Install the plugins listed in the original cordova_plugins.js file, using GitHub for plugins not on npm.
- Build the APK, sign it, and install it; code-tampering detection is bypassed unless specific configuration is set.
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 Cordova app is a mobile app built with web technology (HTML, JavaScript, CSS) and wrapped in a native shell. Because the web files are stored inside the app package as plain files, anyone who downloads the app can read and copy them. The author shows that you can take those files, put them into a fresh Cordova project, and build a new app that looks the same but has no integrity protection.
What is Mobile?
Flaws specific to Android and iOS apps: exported components, deep links, WebViews and data left on the device.