4- Root Detection and Bypass
En PostLogin.java se hacen varias comprobaciones débiles para detectar el root.
Este era un APK que instalaba SuperSU hace más de 10 años
java
void showRootStatus() {
boolean isrooted = doesSuperuserApkExist("/system/app/Superuser.apk") || doesSUexist();
if (isrooted) {
this.root_status.setText("Rooted Device!!");
} else {
this.root_status.setText("Device not Rooted!!");
}
}Magisk suele esconder el binario su fuera del PATH normal o usar hooks (MagiskHide / Zygisk) que interceptan justo este tipo de detección y devuelven "no encontrado" a la app, junto con que muchas veces which nisiquiera está aquí /system/xbin/which
java
private boolean doesSUexist() {
Process process = null;
try {
process = Runtime.getRuntime().exec(new String[]{"/system/xbin/which", "su"});
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
if (in.readLine() == null) {
if (process != null) {
process.destroy();
}
return false;
}
if (process == null) {
return true;
}
process.destroy();
return true;
} catch (Throwable th) {
if (process != null) {
process.destroy();
}
return false;
}
}Aquí lo ideal sería hacer usar Play Integrity API (reemplazo de SafetyNet)
Mucho más difícil de bypassear que comprobaciones Client Side.