5.7 KiB
Cordova Apps
{% hint style="success" %}
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Support HackTricks
- Check the subscription plans!
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.
For further details check https://infosecwriteups.com/recreating-cordova-mobile-apps-to-bypass-security-implementations-8845ff7bdc58. This is a sumary:
Apache Cordova is recognized for enabling the development of hybrid applications using JavaScript, HTML, and CSS. It allows the creation of Android and iOS applications; however, it lacks a default mechanism for securing the application's source code. In contrast to React Native, Cordova does not compile the source code by default, which can lead to code tampering vulnerabilities. Cordova utilizes WebView to render applications, exposing the HTML and JavaScript code even after being compiled into APK or IPA files. React Native, conversely, employs a JavaScript VM to execute JavaScript code, offering better source code protection.
Cloning a Cordova Application
Before cloning a Cordova application, ensure that NodeJS is installed along with other prerequisites like the Android SDK, Java JDK, and Gradle. The official Cordova documentation provides a comprehensive guide for these installations.
Consider an example application named Bank.apk
with the package name com.android.bank
. To access the source code, unzip bank.apk
and navigate to the bank/assets/www
folder. This folder contains the complete source code of the application, including HTML and JS files. The application's configuration can be found in bank/res/xml/config.xml
.
To clone the application, follow these steps:
npm install -g cordova@latest
cordova create bank-new com.android.bank Bank
cd bank-new
Copy the contents of bank/assets/www
to bank-new/www
, excluding cordova_plugins.js
, cordova.js
, cordova-js-src/
, and the plugins/
directory.
Specify the platform (Android or iOS) when creating a new Cordova project. For cloning an Android app, add the Android platform. Note that Cordova's platform versions and Android API levels are distinct. Refer to the Cordova documentation for details on platform versions and supported Android APIs.
To determine the appropriate Cordova Android platform version, check the PLATFORM_VERSION_BUILD_LABEL
in the original application's cordova.js
file.
After setting up the platform, install the required plugins. The original application's bank/assets/www/cordova_plugins.js
file lists all the plugins and their versions. Install each plugin individually as shown below:
cd bank-new
cordova plugin add cordova-plugin-dialogs@2.0.1
If a plugin is not available on npm, it can be sourced from GitHub:
cd bank-new
cordova plugin add https://github.com/moderna/cordova-plugin-cache.git
Ensure all prerequisites are met before compiling:
cd bank-new
cordova requirements
To build the APK, use the following command:
cd bank-new
cordova build android — packageType=apk
This command generates an APK with the debug option enabled, facilitating debugging via Google Chrome. It's crucial to sign the APK before installation, especially if the application includes code tampering detection mechanisms.
Automation Tool
For those seeking to automate the cloning process, MobSecco is a recommended tool. It streamlines the cloning of Android applications, simplifying the steps outlined above.
{% hint style="success" %}
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Support HackTricks
- Check the subscription plans!
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.