CTF/Frida

Frida 후킹 #1 자동으로 rooting우회하기

종금 2022. 9. 17. 12:29
반응형

최대한 후킹 없이 진단을 하는 것을 목표로 하였지만 결국 한계점에 와서 프리다를 시작하였다.
프리다의 경우 본인이 직접 자바스크립트를 짤수도 있지만 역시 남들이 만들어둔 것에 변조가 최고 아니겠는가 

그러기에 남들변조부터 시작하는 것으로 시작해보자
먼저 남들이 만들어둔 것을 쓸 스크립트는 아래 깃헙니다.

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

 

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

A script that helps you trace classes, functions, and modify the return values of methods on Android platform - GitHub - noobpk/frida-android-hook: A script that helps you trace classes, functions,...

github.com

 

-------------------설치---------------------------
일단 설치하기 위해서 Document를 보고 명령어를 쳤더니 실패가 떴다.

읽어보니 이전에 내가 진단을 위해 설치한 프리다(12.6.23)와 프리타툴(4.1.0)이 설치되서 문제라고 한다. 
그래서 두버전 삭제후

 

새로운 버전(frida=15.1.17, frida-tools=10.8.0을 설치한다.)

 

그리고 다시 실행해보니 설치가 잘되었다.

 

--------------------------------테스트----------------------------------
그럼 이제 해당 내용에 대해서 테스트 해보도록하자.
테스트 대상은 OWASP가 만든 어플을 대상으로 해보자
https://github.com/OWASP/owasp-mastg/tree/master/Crackmes/Android

 

GitHub - OWASP/owasp-mastg: The Mobile Application Security Testing Guide (MASTG) is a comprehensive manual for mobile app secur

The Mobile Application Security Testing Guide (MASTG) is a comprehensive manual for mobile app security testing and reverse engineering. It describes the technical processes for verifying the contr...

github.com

먼저 해당 사이트에서 Level1.apk 다운로드후

 

루트가 켜진 에뮬에 설치한다.

 

해당 어플을 켜보면 root가 켜져있다고 하며 꺼지는 것을 확인

 

에뮬에 켜졌기에 패키지이름 확인 가능

 

Frida -U -f "패키지이름" -l "js스크립트 이름*" --no-pause 를 통해 사용해본다
*현재 사용한 패키지는 hookhome\methods\bypass_root.js이다.

 

그러면 해당 어플이 실행되고 잘 시작되는 것을 볼 수 있다.

 

물론 해당 방법으로 root가 모두 뚫리면 좋겠지만 자꾸 진화하며 안되는 경우가 있다.
이럴 경우에는 직접 수동으로 스크립트 작성해야하니 이건 다음글에서 적어보자.

반응형