Thursday, January 14, 2016

how to disable root check for android apps


Sometimes it is necessary do disable the root check of an Android app to test it on a rooted device.
To do this you need to find the implementation of the root check inside the JAVA source.
Most root checks try to access folders which are normally not accessible or try to start a root shell with"su" command.

To  decompile apk's I use jadx https://github.com/skylot/jadx but also unpacking the apk, converting the dex file to jar with dex2jar and decompile with jad is possible.

There are also websites like http://www.decompileandroid.com/ which decompiles the apk's but  I would only use them if the apk is already published to play store.

TO dicover the root check implementation, looking for "su" inside the decompiled java code is always a good idea. Also looking for other folders/resouces like "/system/app/Superuser.apk", "/sbin/", "/system/bin/", "/system/xbin/", "/data/local/", "/data/local/bin/su" or direct searching for "root" can be useful.

Once you found the class with the root check function, search the same in SMALI code and always return the same value:
  const/4 v0, 0x0
  return v0

Rebuild the apk, deploy and test it.