Self-Improvement

[InsecureBankv2] Rooting Bypass (Frida Hooking) 본문

AOS/InsecureBankv2

[InsecureBankv2] Rooting Bypass (Frida Hooking)

JoGeun 2021. 12. 29. 15:05

Rooting Bypas

어플리케이션을 실행하여 로그인하면 루팅된 단말기의 경우 "Rooted Device!!"가 출력된다.

PostLogin 클래스의 showRootStatus() 메소드를 보면 IF문에 의해 루팅 단말기를 판별하게 된다.

본인의 것은 루팅된 단말기이지만 루팅 탐지 로직에 안걸려서 "Device not Rooted!!"로 나오게 되는데 이를 역으로 루팅 단말기로 나오게끔 후킹해보자 (코드 패치도 가능하다)

 

FRIDA

루팅을 탐지하는 로직에서 PostLogin 클래스의 doesSuperuserApkExist(), doesSUexist() 메소드의 리턴값에 의해 결정된다. 두개의 메소드의 리턴값이 false로 나왔기 때문에 나의 단말기에는 "Device not Rooted!!"가 출력된다.

실제로 그러는지 아래의 후킹코드로 실행해보자

    console.log("[*] Injected JS");
    Java.perform(function() {
        var rooting = Java.use("com.android.insecurebankv2.PostLogin");
        rooting.doesSuperuserApkExist.overload("java.lang.String").implementation = function(arg1){
            var ret = this.doesSuperuserApkExist(arg1);
            console.log("[*] doesSuperuserApkExist() Original ret = "+ret);
            return ret;
        }
        rooting.doesSUexist.implementation = function(){
            var ret = this.doesSUexist();
            console.log("[*] doesSUexist Original ret = "+ret);
            return ret;
        }
    });

 

이제는 둘 다 true로 후킹하면 "Rooted Device!!"가 출력된다.

    console.log("[*] Injected JS");
    Java.perform(function() {
        var rooting = Java.use("com.android.insecurebankv2.PostLogin");
        rooting.doesSuperuserApkExist.overload("java.lang.String").implementation = function(arg1){
            //var ret = this.doesSuperuserApkExist(arg1);
            //console.log("[*] doesSuperuserApkExist() Original ret = "+ret);
            return true;
        }
        rooting.doesSUexist.implementation = function(){
            //var ret = this.doesSUexist();
            //console.log("[*] doesSUexist Original ret = "+ret);
            return true;
        }
    });