cordova-plugin-rootguard v1.0.0
Cordova Plugin - RootGuard : cordova-plugin-rootguard
cordova-plugin-rootguard is a security plugin for Cordova that detects:
ā
Root Access (Magisk, SuperSU, su binaries, system modifications)
ā
Frida Runtime Instrumentation (open ports, injected libraries, running processes)
š Features
- ā
Detects root access (e.g., presence of
su, known root apps, and system modifications) - ā Detects Frida-based debugging and instrumentation
- ā Efficient and lightweight detection
- ā Easy integration with Cordova applications
- ā Compatible with Cordova Android projects.
š Installation
Option 1: Install from GitHub
cordova plugin add https://github.com/binuka97/cordova-plugin-rootguard.gitOption 2: Install Locally
- Download and place the
cordova-plugin-rootguard/folder inside your project. - Run:
cordova plugin add ./cordova-plugin-rootguard
š Usage
JavaScript API
The plugin provides a single function checkSecurity that checks for both root access and Frida detection.
š Usage
RootGuard.checkSecurity(function(result) {
if (result === 1) {
console.log("Security status: " + (result ? "Compromised" : "Safe"));
console.log("Security Risk Detected: Root or Frida is present.");
} else {
console.log("Device is secure.");
}
}, function(error) {
console.error("Error detecting Root/Frida:", error);
});š§ How It Works
Root Detection
- File Check: Scans for common root-related files (e.g.,
su,Superuser.apk,.magisk). - Command Execution: Attempts to execute
suto check for root access. - Mount Check: Verifies if
/systemis mounted as read-write instead of read-only.
Frida Detection
- Port Scan: Checks for Frida's default listening ports (
27042,27043). - Memory Scan: Reads
/proc/self/mapsto detect Frida-related libraries (frida,gum-js,gadget). - Process Check: Looks for a running
frida-serverprocess. - Property Check: Scans system properties for any Frida-related entries.
š ļø Testing
Testing Root Detection
- Install Magisk or SuperSU on your Android device.
- Run your Cordova app. It should detect root and exit.
Testing Frida Detection
- Start Frida-server on the device:
adb push frida-server /data/local/tmp/ adb shell chmod 755 /data/local/tmp/frida-server adb shell /data/local/tmp/frida-server & - Run your Cordova app. It should detect Frida and exit.
Supported Platforms
ā Android (Minimum SDK: API 21+) ā iOS (Not supported yet)
Troubleshooting
Common Issues & Fixes
1. Plugin Not Found After Installation
Run cordova platform remove android && cordova platform add android to refresh plugins.
2. App Crashes on Certain Devices
Ensure the plugin has the required permissions and that your app has minSdkVersion set to 21 or higher in config.xml.
3. False Positives or False Negatives
Root detection can vary across devices. Consider adding additional root detection methods if needed.
š License
This project is licensed under the MIT License.
šØāš» Contributing
We welcome contributions! Feel free to submit a pull request or report issues on the repository.
š Support
For any issues, please open a GitHub issue in the repository.
Author
š Binuka Kamesh
š§ Contact: binukakamesh97@gmail.com
š GitHub: binuka97
Maintained by Binuka Kamesh
11 months ago