WuglyakBolgoink / cordova-plugin-iroot

Cordova Jailbreak/Root Detection Plugin for Apache Cordova
MIT License
35 stars 72 forks source link

successCallback can your add what's detected? : isRunningOnEmulator is FALSE POSITIVE #42

Closed iPMisterX closed 3 years ago

iPMisterX commented 4 years ago

My Apps use

cordova-plugin-iroot@2.0.2
successCallback return true

Vivo Y11 Android 9

but i check root with Root Beer

line_oa_chat_200826_132421

successCallback return true but i don't know what detected?

checkRootManagementApps checkPotentiallyDangerousApps checkRootCloakingApps checkTestKeys checkForDangerousProps checkForBusyBoxBinary checkForSuBinary checkSuExists checkForRWSystem ...or something is detected

iPMisterX commented 4 years ago

Now i know what's problem : FALSE POSITIVE

isRunningOnEmulator: true

I modify your script for display what detected and i found this!

rootBeer.isRooted

I/RootBeer: LOOKING FOR BINARY: /data/local/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /data/local/bin/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /data/local/xbin/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /sbin/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /su/bin/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /system/bin/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /system/bin/.ext/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /system/bin/failsafe/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /system/sd/xbin/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /system/usr/we-need-root/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /system/xbin/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /cache/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /data/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /dev/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /system/sbin/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /vendor/bin/su Absent :(
I/RootBeer: LOOKING FOR BINARY: /vendor/xbin/su Absent :(

Get device information.

E/IRoot: [getDeviceInfo][        Build.DEVICE][riva]
E/IRoot: [getDeviceInfo][         Build.BOARD][QC_Reference_Phone]
E/IRoot: [getDeviceInfo][         Build.MODEL][Redmi 5A]
E/IRoot: [getDeviceInfo][  Build.MANUFACTURER][Xiaomi]
E/IRoot: [getDeviceInfo][         Build.BRAND][Xiaomi]
E/IRoot: [getDeviceInfo][      Build.HARDWARE][qcom]
E/IRoot: [getDeviceInfo][       Build.PRODUCT][riva]
E/IRoot: [getDeviceInfo][   Build.FINGERPRINT][Xiaomi/riva/riva:8.1.0/OPM1.171019.026/V11.0.2.0.OCKMIXM:user/release-keys]
E/IRoot: [getDeviceInfo][          Build.HOST][mi-server]

checkExecutingCommands

E/IRoot: [canExecuteCommand] Error: Cannot run program "/system/xbin/which": error=2, No such file or directory

isRunningOnEmulator

E/IRoot: [isRunningOnEmulator] result [true] => [simpleCheck:true][checkGenymotion:false][checkGeneric:false][checkGoogleSDK:false]
E/IRoot: [simpleCheck] result [true] => [isEmulator:false][isAndSDK486:false][isQCRefPhone:true][isStartWBuild:false]

InternalRootDetection.isRooted

E/IRoot: check c1 = isExistBuildTags: false
E/IRoot: check c2 = doesSuperuserApkExist: false
E/IRoot: check c3 = isExistSUPath: false
E/IRoot: check c4 = checkDirPermissions: false
E/IRoot: check c5 = checkExecutingCommands: false
E/IRoot: check c6 = checkInstalledPackages: false
E/IRoot: check c7 = checkforOverTheAirCertificates: false
E/IRoot: check c8 = isRunningOnEmulator: true

successCallback

I/chromium: [INFO:CONSOLE(619)] **"isRooted: => true"**

CPU-Z

Screenshot_2020-08-26-20-03-02-505_com cpuid cpu_z

WuglyakBolgoink commented 4 years ago

Hallo @iPMisterX I'll check this!

iPMisterX commented 4 years ago

Temporary fix by comment this line

|| Build.BOARD.equals("QC_Reference_Phone") //bluestacks

from this plugins/cordova-plugin-iroot/src/android/de/cyberkatze/iroot/InternalRootDetection.java

public boolean isRunningOnEmulator() {
        Utils.getDeviceInfo();

        boolean simpleCheck = Build.MODEL.contains("Emulator")
            // ||Build.FINGERPRINT.startsWith("unknown") // Meizu Mx Pro will return unknown, so comment it!
            || Build.MODEL.contains("Android SDK built for x86")
            // || Build.BOARD.equals("QC_Reference_Phone") //bluestacks
            || Build.HOST.startsWith("Build"); //MSI App Player

        boolean checkGenymotion = Build.MANUFACTURER.contains("Genymotion");
        boolean checkGeneric = Build.FINGERPRINT.startsWith("generic") || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"));
        boolean checkGoogleSDK = Build.MODEL.contains("google_sdk") || "google_sdk".equals(Build.PRODUCT);

        boolean result = simpleCheck || checkGenymotion || checkGeneric || checkGoogleSDK;

        LOG.d(
            Constants.LOG_TAG,
            String.format(
                "[isRunningOnEmulator] result [%s] => [simpleCheck:%s][checkGenymotion:%s][checkGeneric:%s][checkGoogleSDK:%s]",
                result,
                simpleCheck,
                checkGenymotion,
                checkGeneric,
                checkGoogleSDK
            )
        );

        return result;
    }

but i know it will not detect bluestacks by the way, I think the actual problem is from Chinese Manufacturers

The following devices as i known

i hope you will find the way to fix this or the new way to detect bluestacks

WuglyakBolgoink commented 4 years ago

Hallo @iPMisterX thank you for additional information!

iPMisterX commented 4 years ago

New case in Sony

return false in isRunningOnEmulator and simpleCheckBuild Methods Build.HOST.startsWith("Build"); //MSI App Player

IRoot.simpleCheckBuild Method is PR #43

Root Detection List Screenshots

image image

iPMisterX commented 4 years ago

isRunningOnEmulator Method is the problem.

it must be an option to check Root with this Method IRoot must be only check device has been Rooted by default. #43

Check isRooted Without isRunningOnEmulator

IRoot.isRooted
IRoot.isRootedWithBusyBox

Check isRooted With isRunningOnEmulator

IRoot.isRootedWithEmulator
IRoot.isRootedWithBusyBoxWithEmulator
WuglyakBolgoink commented 4 years ago

@iPMisterX I will do a new plugin release in a few days

WuglyakBolgoink commented 3 years ago

merged in release v2.1.0