본문 바로가기
App/AndroGoat

AndroGoat.apk | 에뮬레이터 탐지 (Frida)

by 09337 2021. 9. 20.

초반 내용은 이전 글과 동일하다.
https://lyk00331.tistory.com/97

AndroGoat.apk | 에뮬레이터 탐지 (smali)

0. 기본 세팅 AndroGoat.apk 파일을 다운받은 후, 에뮬레이터(Nox)로 옮겨준다. 1. 에뮬레이터 탐지 나는 녹스를 사용 중이기 때문에 원래는 "This is Emulator" 라고 떠야하지만, (아마도..) 해당 APK가 외국

lyk00331.tistory.com

위 게시물을 참고하여 2번까지 진행한 후, 이번 글은 Frida와 관련된 내용으로 3번부터 작성했다.

3. frida 서버 실행

adb shell에 접속한 후, 안드로이드 기기에 설치해둔 frida server를 실행한다. (이때 frida가 PC와 모바일에 동일 버전으로 설치되어있어야 한다.)

4. frida script 작성

//emulator_detect.js

console.log("Script loaded successfully");
Java.perform(function x() {
	console.log("Inside java perform function");
	var my_class = Java.use(
	"owasp.sat.agoat.EmulatorDetectionActivity");

	my_class.isEmulator.implementation = function (args) {
	console.log("\n0*********************************")
	return true;
	};
})

위 스크립트는 에뮬레이터를 탐지하는 영역에 접속한 후, return 값을 true로 반환하면서 루팅 탐지가 되지 않았다며 후킹해주는 코드다.
만약, 기존에 "This is Emulator"라고 떴다면, 11번 라인을 반대로 false로 바꿔주면 된다.

5. frida script 실행

PC에 frida가 설치되어있는 경로에서 다음과 같이 frida를 통해 방금 작성한 스크립트를 실행한다.

frida.exe -U -f owasp.sat.agoat -l [경로]\emulator_detect.js --no-pause

6. 실행 결과

다음과 같이 "This is Emulator" 라고 나타나며 에뮬레이터라고 탐지된 것을 확인할 수 있다.

댓글