1.0.0 • Published 5 months ago

cordova-plugin-rootguard v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Cordova Plugin - RootGuard : cordova-plugin-rootguard

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.git

Option 2: Install Locally

  1. Download and place the cordova-plugin-rootguard/ folder inside your project.
  2. 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 su to check for root access.
  • Mount Check: Verifies if /system is 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/maps to detect Frida-related libraries (frida, gum-js, gadget).
  • Process Check: Looks for a running frida-server process.
  • Property Check: Scans system properties for any Frida-related entries.

šŸ› ļø Testing

Testing Root Detection

  1. Install Magisk or SuperSU on your Android device.
  2. Run your Cordova app. It should detect root and exit.

Testing Frida Detection

  1. 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 &
  2. 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