KGPstudio
article thumbnail
반응형

프리다 후킹을 통한 탈옥 탐지 우회는 두가지가 있다. 그 중 클래스와 메소드를 확인이 가능할 때 사용하는 방법을 소개한다.

 

1.     클래스 및 메소드를 후킹하는 방법

 

이 방법에는 수많은 스크립트가 존재한다. 그 스크립트는 아래에서 다운로드 받을 수 있다.

https://github.com/noobpk/frida-ios-hook

 

GitHub - noobpk/frida-ios-hook: A tool that helps you easy trace classes, functions, and modify the return values of methods on

A tool that helps you easy trace classes, functions, and modify the return values of methods on iOS platform - GitHub - noobpk/frida-ios-hook: A tool that helps you easy trace classes, functions, a...

github.com

스크립트 중에는 모든 탈옥관련 경로와 파일들을 체크해서 탐지하는 코드가 있다면 우회해주는 스크립트도 있다. 보안솔루션이 적용되지 않은 앱이라면 이 스크립트 하나만으로 간단하게 우회가 가능하다.

 


1-1 jailbreak.js 파일 사용

다운로드 받은 bypass_jailbreak.js파일을 사용하였다.

frida -U -f com.interpark.shop -l bypass_jailbreak.js 명령어를 사용하여 실행했다.

실행결과 다음 사진과 같이 탈옥 탐지 우회에 성공했다는 메세지를 확인할 수 있고, 기기에서도 탈옥 탐지 우회에 성공하여 JailBroken되어 있습니다 라는 메시지가 아닌 정상적으로 어플리케이션이 실행되고 있음을 확인할 수 있다.

 

1-2 bypass-jailbreak-1.js 파일 사용

다운 받은 bypass-jailbreak-1.js파일을 사용하였다. 이 파일을 사용하기 위해서는 클래스와 메소드가 필요하기 때문에 코드분석을 먼저 진행해 보았고 확인한 클래스와 메소드를 적용하기 위해 파일을 확인했다.

function bypassJailbreakDetection() {
  try {
    var className = "JailbreakDetection";
        var funcName = "+ isJail";
        var hook = eval('ObjC.classes.' + className + '["' + funcName + '"]');
        Interceptor.attach(hook.implementation, {
          onLeave: function(retval) {
            console.log("[*] Class Name: " + className);
            console.log("[*] Method Name: " + funcName);
            console.log("\t[-] Type of return value: " + typeof retval);
            console.log("\t[-] Original Return Value: " + retval);
            retval.replace(0x0);
            console.log("\t[-] Type of return value: " + typeof retval);
            console.log("\t[-] Return Value: " + retval);
          }
        });

  } catch(err) {
    console.log("[-] Error: " + err.message);
  }
}

if (ObjC.available) {
  bypassJailbreakDetection();
} else {
  send("error: Objective-C Runtime is not available!");
}

className 에는 클래스를 적어주면 되고, funcName에는 메소드를 적어주면 된다.

(** 분석 중 메소드 앞에 +나 -기호가 존재하는 것을 확인할 수 있는데 기호까지 맞춰서 적어줘야 한다,) 

 

그 후 다음과 같은 명령어를 실행하여 탈옥 탐지 우회를 진행한다.

frida -U -f [패키지명] -l bypass-jailbreak-1.js

결과적으로 0x1로 나오는 리턴값을 0x0으로 변환하여 탈옥 탐지 우회에 성공할 수 있었다.

반응형
profile

KGPstudio

@KGP-Admin

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!