scottyab / rootbeer

Simple to use root checking Android library and sample app
Apache License 2.0
2.48k stars 440 forks source link

Nexus 7 emulator flagged as rooted #196

Closed david-s-svedberg closed 1 month ago

david-s-svedberg commented 2 years ago

Hi, using a fresh copy of the standard nexus 7 emulator in avd and your sample app it gets flagged as rooted: image

I've tested it with android 7.0, 7.11, 8.0 with the same result.

Android 12 also claims to be rooted but with a different result: image

even though the su file is there in system/xbin/: image

Log for 7-8:

2022-05-11 11:45:43.447 4596-4596/com.scottyab.rootbeer.sample V/RootBeer: RootBeer: checkForBinary() [193] - /system/xbin/su binary detected!
2022-05-11 11:45:43.484 4596-4596/com.scottyab.rootbeer.sample V/RootBeer: RootBeer: checkForDangerousProps() [283] - ro.debuggable = [1] detected!
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/local/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/local/bin/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/local/xbin/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /sbin/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /su/bin/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/bin/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/bin/.ext/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/bin/failsafe/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/sd/xbin/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/usr/we-need-root/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/xbin/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /cache/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /dev/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/sbin/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /vendor/bin/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /vendor/xbin/su Absent :(
2022-05-11 11:45:43.495 4596-4596/com.scottyab.rootbeer.sample I/zygote: Deoptimizing boolean kotlin.jvm.internal.Intrinsics.areEqual(java.lang.Object, java.lang.Object) due to JIT inline cache
2022-05-11 11:45:43.484 4596-4596/com.scottyab.rootbeer.sample V/RootBeer: RootBeer: checkForDangerousProps() [283] - ro.debuggable = [1] detected!
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/local/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/local/bin/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/local/xbin/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /sbin/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /su/bin/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/bin/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/bin/.ext/su Absent :(
2022-05-11 11:45:43.485 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/bin/failsafe/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/sd/xbin/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/usr/we-need-root/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/xbin/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /cache/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /dev/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/sbin/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /vendor/bin/su Absent :(
2022-05-11 11:45:43.486 4596-4596/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /vendor/xbin/su Absent :(
2022-05-11 11:45:43.495 4596-4596/com.scottyab.rootbeer.sample I/zygote: Deoptimizing boolean kotlin.jvm.internal.Intrinsics.areEqual(java.lang.Object, java.lang.Object) due to JIT inline cache
2022-05-11 11:45:48.418 4596-4601/com.scottyab.rootbeer.sample I/zygote: Do full code cache collection, code=251KB, data=162KB
2022-05-11 11:45:48.419 4596-4601/com.scottyab.rootbeer.sample I/zygote: After code cache collection, code=251KB, data=139KB
2022-05-11 11:45:50.010 4596-4638/com.scottyab.rootbeer.sample I/zygote: Deoptimizing kotlin.coroutines.CoroutineContext kotlinx.coroutines.internal.DispatchedContinuation.getContext() due to JIT inline cache
2022-05-11 11:45:50.011 4596-4596/com.scottyab.rootbeer.sample I/zygote: Deoptimizing void kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(java.lang.Object) due to JIT inline cache

Logs for 12:

2022-05-11 11:47:49.512 6676-6704/com.scottyab.rootbeer.sample D/EGL_emulation: app_time_stats: avg=16.66ms min=9.55ms max=29.46ms count=49
2022-05-11 11:47:50.516 6676-6704/com.scottyab.rootbeer.sample D/EGL_emulation: app_time_stats: avg=14.50ms min=9.14ms max=24.90ms count=53
2022-05-11 11:47:51.061 6676-6676/com.scottyab.rootbeer.sample V/RootBeer: RootBeer: checkForDangerousProps() [283] - ro.debuggable = [1] detected!
2022-05-11 11:47:51.063 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/local/su Absent :(
2022-05-11 11:47:51.065 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/local/bin/su Absent :(
2022-05-11 11:47:51.065 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/local/xbin/su Absent :(
2022-05-11 11:47:51.067 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /sbin/su Absent :(
2022-05-11 11:47:51.068 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /su/bin/su Absent :(
2022-05-11 11:47:51.070 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/bin/su Absent :(
2022-05-11 11:47:51.073 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/bin/.ext/su Absent :(
2022-05-11 11:47:51.076 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/bin/failsafe/su Absent :(
2022-05-11 11:47:51.077 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/sd/xbin/su Absent :(
2022-05-11 11:47:51.080 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/usr/we-need-root/su Absent :(
2022-05-11 11:47:51.081 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system/xbin/su Absent :(
2022-05-11 11:47:51.082 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /cache/su Absent :(
2022-05-11 11:47:51.083 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /data/su Absent :(
2022-05-11 11:47:51.085 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /dev/su Absent :(
2022-05-11 11:47:51.085 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /product/bin/su Absent :(
2022-05-11 11:47:51.086 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /apex/com.android.runtime/bin/su Absent :(
2022-05-11 11:47:51.087 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /apex/com.android.art/bin/su Absent :(
2022-05-11 11:47:51.088 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /system_ext/bin/su Absent :(
2022-05-11 11:47:51.090 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /odm/bin/su Absent :(
2022-05-11 11:47:51.092 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /vendor/bin/su Absent :(
2022-05-11 11:47:51.093 6676-6676/com.scottyab.rootbeer.sample I/RootBeer: LOOKING FOR BINARY: /vendor/xbin/su Absent :(
2022-05-11 11:47:51.518 6676-6704/com.scottyab.rootbeer.sample D/EGL_emulation: app_time_stats: avg=14.07ms min=5.88ms max=48.83ms count=46
3mph4515 commented 2 years ago

@scottyab Hi there, faced the same issue, all standard android studio emulators detect as rooted. Is this an expected behavior?

jordanjoecooper commented 2 years ago

Emulators are usually rooted so I think this is probably expected behaviour.

scottyab commented 1 month ago

Sorry for the slow reply. This is working as expected but we should include a FAQ note about emlators to confirm this.

Emulators are usually rooted so I think this is probably expected behaviour.

I'm not sure it's correct to say emulators are usually rooted. However they are debuggable and this system property 'ro.debuggable' is classed as a dangerous property so it's flagged as an indication of root. dangerous maybe a little OTT but it's certainly not something expected on a genuine device.