본문 바로가기

4-1. 2025-2 심화 스터디/안드로이드

[2025.11.22] APP 5주차 활동

참고강의: 프리다(Frida) 를 이용한 안드로이드 앱 모의해킹

https://inf.run/WqSJ9

 

프리다(Frida)를 이용한 안드로이드 앱 모의해킹| 보안프로젝트 - 인프런 강의

현재 평점 4.9점 수강생 750명인 강의를 만나보세요. 모의해킹 실무에서 활용되고 있는 프리다 (Frida)의 완벽 활용법을 배울 수 있습니다. 안드로이드보안, 취약점진단, 보안, 해킹, 모의해킹

www.inflearn.com

 

섹션 9.  프리다 실무 활용

 

국제 표준웹보안 기구에서 배포한 앱을 사용해 실습하였다. 

https://github.com/OWASP/mastg

 

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

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

github.com

 

26. 루킹 탐지 우회 

앱 구조 분석 (Uncrackable Level 1 기준)

  • MainActivity.onCreate()에서 보안 체크 수행
  • c.a(), c.b(), c.c() 중 하나라도 true 반환 시
    → "Root detected!" 메시지 + System.exit(0) 호출 후 앱 종료

루팅 탐지 방식

  • su 바이너리 존재 확인
  • 루팅 관련 앱 설치 여부 확인
  • 특정 파일 경로 검사 등
setImmediate(function() {
  Java.perform(function() {
    var exit_bypass = Java.use("java.lang.System");
    exit_bypass.exit.implementation = function (arg) {
      console.log("[*] Exit Bypass");
    }
  })
})

 

System.exit()을 가로채 앱이 종료되는 대신 콘솔 로그를 출력하도록 수정해 종료 우회

 

27. 암호 복호화 

public void verify(View view) {
    String str;
    String obj = ((EditText) findViewById(R.id.edit_text)).getText().toString();
    AlertDialog create = new Builder(this).create();
    if (a.a(obj)) {
        create.setTitle("Success!");
        str = "This is the correct secret.";
    } else {
        create.setTitle("Nope...");
        str = "That's not it. Try again.";
    }
    create.setMessage(str);
    create.setButton(-3, "OK", new OnClickListener() {
        public void onClick(DialogInterface dialogInterface, int i) {
            dialogInterface.dismiss();
        }
    });
    create.show();
}

 

타깃 메서드: sg.vantagepoint.a.a 클래스의 a() 메서드 ->무조건 참으로 만들어야한다

 

1. 해당 메서드가 무조건 true를 반환하게 만드는 방법

var trueClass = Java.use("sg.vantagepoint.uncrackable1.a");
trueClass.a.implementation = function(arg){
    console.log("\n[*] True");
    return true;
}

 

2. 메서드를 호출해 복호화 결과값을 얻음->결과값을 통해 메서드가 true값이 되게하는 문자열 생성

var decrypteClass = Java.use("sg.vantagepoint.a.a");
d.a.implementation = function(arg1, arg2) {
    var secret = d.a.call(this, arg1, arg2);
    var s = '';
    for (var i = 0; i < secret.length; i++) {
        s += String.fromCharCode(secret[i]);
        console.log(secret[i]);
    }
    console.log(s);
}

 

 

28.로그인 우회

  • 로그인 처리 시 checkKeyResult(boolean) 메서드가 결과를 처리
  • true면 vault 화면으로 이동

-> 무조건 로그인 성공으로 처리해서 로그인 우회

 

setImmediate(function() {
  Java.perform(function() {
    var login = Java.use("com.mwr.example.sieve.MainLoginActivity");
    login.checkkeyResult.implementation = function(arg) {
      console.log("[*] Login bypass");
      this.checkKeyResult(true); 
    };
  });
});

 

29. 부르트포스 PIN

 

부르트포스: 암호를 풀기 위해 가능한 모든 값을 대입해보는 무차별 대입 공격

 

function padToFour(number) {
 if (number <= 9999) {
 number = ("0000" + number).slice(-4);
 return String(number);
 }
}
var pinBypass = Java.use("com.mwr.example.sieve.PinActivity");
pinBypass.submit.implementation = function(arg) {
 var service = this.serviceConnection.value;
 for (var i = 0; i < 9999; i++) {
 var pin_string = padToFour(i);
 service.checkPin(pin_string);
 console.log(pin_string);
 }
}

 

->0000 ~ 9999 까지 자동 대입해 내부 저장된 PIN을 자동탐색

'4-1. 2025-2 심화 스터디 > 안드로이드' 카테고리의 다른 글

[2025.11.29] APP 6주차 활동  (0) 2025.12.02
[2025.11.08] APP 3주차 활동  (0) 2025.11.09
[2025.10.04] APP 2주차활동  (0) 2025.10.04
[2025.09.27] APP 1주차활동  (0) 2025.09.28