Objection Tutorial

Support HackTricks

Bug bounty tip: sign up for Intigriti, a premium bug bounty platform created by hackers, for hackers! Join us at https://go.intigriti.com/hacktricks today, and start earning bounties up to $100,000!

Introduction

objection - Runtime Mobile Exploration

ObjectionFrida로 구동되는 런타임 모바일 탐색 툴킷입니다. 이는 탈옥되거나 루팅된 모바일 장치 없이 모바일 애플리케이션과 그 보안 상태를 평가하는 데 도움을 주기 위해 만들어졌습니다.

Note: 이것은 어떤 형태의 탈옥 / 루트 우회가 아닙니다. objection을 사용함으로써, 사용자는 직면한 샌드박스에 의해 부과된 모든 제한에 여전히 제한됩니다.

Resume

objection목표는 사용자가 Frida가 제공하는 주요 작업을 호출할 수 있도록 하는 것입니다. 그렇지 않으면, 사용자는 테스트하려는 모든 애플리케이션에 대해 단일 스크립트를 생성해야 합니다.

Tutorial

이 튜토리얼에서는 여기에서 다운로드할 수 있는 APK를 사용할 것입니다:

2MB
app-release.zip
archive

또는 원본 저장소에서 (app-release.apk 다운로드)

Installation

pip3 install objection

Connection

정상 ADB 연결을 만들고 장치에서 frida 서버를 시작합니다 (그리고 클라이언트와 서버 모두에서 frida가 작동하는지 확인합니다).

루팅된 장치를 사용하는 경우, --gadget 옵션 내에서 테스트할 애플리케이션을 선택해야 합니다. 이 경우:

frida-ps -Uai
objection --gadget asvid.github.io.fridaapp explore

Basic Actions

이 튜토리얼에서는 유용하다고 생각되는 명령어만 나열할 것이며, objections의 모든 가능한 명령어는 나열되지 않습니다.

Environment

환경 내에서 흥미로운 정보(예: 비밀번호 또는 경로)를 찾을 수 있습니다.

env

프리다 정보

frida

업로드/다운로드

file download <remote path> [<local path>]
file upload <local path> [<remote path>]

frida 스크립트 가져오기

import <local path frida-script>

SSLPinning

android sslpinning disable #Attempts to disable SSL Pinning on Android devices.

루트 탐지

android root disable  #Attempts to disable root detection on Android devices.
android root simulate #Attempts to simulate a rooted Android environment.

Exec Command

android shell_exec whoami

스크린샷

android ui screenshot /tmp/screenshot
android ui FLAG_SECURE false  #This may enable you to take screenshots using the hardware keys

정적 분석을 동적으로 만들기

실제 애플리케이션에서는 정적 분석 덕분에 objection을 사용하기 전에 이 부분에서 발견된 모든 정보를 알아야 합니다. 어쨌든, 이 방법을 통해 새로운 것을 볼 수 있을지도 모릅니다. 여기에서는 클래스, 메서드 및 내보낸 객체의 전체 목록만 볼 수 있습니다.

이것은 어떤 방법으로든 애플리케이션의 읽을 수 있는 소스 코드를 얻을 수 없는 경우에도 유용합니다.

활동, 수신기 및 서비스 목록

android hooking list activities
android hooking list services
android hooking list receivers

Frida를 찾을 수 없으면 오류가 발생합니다.

현재 활동 가져오기

android hooking get current_activity

클래스 검색

애플리케이션 내에서 클래스를 찾아보겠습니다.

android hooking search classes asvid.github.io.fridaapp

클래스의 메서드 검색

이제 MainActivity: 클래스 내부의 메서드를 추출해 보겠습니다.

android hooking search methods asvid.github.io.fridaapp MainActivity

클래스의 선언된 메소드와 그 매개변수 목록

클래스의 메소드가 어떤 매개변수를 필요로 하는지 알아봅시다:

android hooking list class_methods asvid.github.io.fridaapp.MainActivity

클래스 목록

현재 애플리케이션 내에서 로드된 모든 클래스를 나열할 수도 있습니다:

android hooking list classes #List all loaded classes, As the target application gets usedmore, this command will return more classes.

이것은 클래스의 메서드를 후킹하고 클래스의 이름만 알고 있을 때 매우 유용합니다. 이 함수를 사용하여 클래스를 소유한 모듈을 검색한 다음 메서드를 후킹할 수 있습니다.

후킹이 쉬움

메서드 후킹(감시)

애플리케이션의 소스 코드에서 MainActivity함수 sum()매초 실행된다는 것을 알 수 있습니다. 함수가 호출될 때마다 모든 가능한 정보(인수, 반환 값 및 백트레이스)를 덤프해 보겠습니다:

android hooking watch class_method asvid.github.io.fridaapp.MainActivity.sum --dump-args --dump-backtrace --dump-return

전체 클래스 후킹(감시)

사실 MainActivity 클래스의 모든 메소드가 정말 흥미롭습니다. 모두 후킹해봅시다. 조심하세요, 이로 인해 애플리케이션이 충돌할 수 있습니다.

android hooking watch class asvid.github.io.fridaapp.MainActivity --dump-args --dump-return

If you play with the application while the class is hooked you will see when 각 함수가 호출되는지, its 인수 and the 반환 value.

함수의 불리언 반환 값 변경

From the source code you can see that the function checkPin gets a String as argument and returns a boolean. Lets make the function 항상 true를 반환하게:

Now, If you write anything in the text box for the PIN code you will see tat anything is valid:

클래스 인스턴스

Search for and print 특정 Java 클래스의 실시간 인스턴스, specified by a fully qualified class name. Out is the result of an attempt at getting a string value for a discovered objection which would typically 객체의 속성 값을 포함할.

android heap print_instances <class>

Keystore/Intents

키스토어와 인텐트를 사용하여 실험할 수 있습니다:

android keystore list
android intents launch_activity
android intent launch_service

메모리

덤프

memory dump all <local destination> #Dump all memory
memory dump from_base <base_address> <size_to_dump> <local_destination> #Dump a part

목록

memory list modules

목록의 맨 아래에서 frida를 볼 수 있습니다:

frida가 무엇을 내보내는지 확인해 봅시다:

검색/쓰기

objection을 사용하여 메모리 내에서 검색하고 쓸 수도 있습니다:

memory search "<pattern eg: 41 41 41 ?? 41>" (--string) (--offsets-only)
memory write "<address>" "<pattern eg: 41 41 41 41>" (--string)

SQLite

sqlite 명령어를 사용하여 sqlite 데이터베이스와 상호작용할 수 있습니다.

Exit

exit

Objection에서 내가 놓치는 것

  • 후킹 메서드가 가끔 애플리케이션을 충돌시킵니다 (이는 Frida 때문이기도 합니다).

  • 클래스의 인스턴스를 사용하여 인스턴스의 함수를 호출할 수 없습니다. 그리고 클래스의 새 인스턴스를 생성하고 이를 사용하여 함수를 호출할 수 없습니다.

  • 애플리케이션에서 사용되는 일반적인 암호화 메서드를 후킹하여 암호화된 텍스트, 평문, 키, IV 및 사용된 알고리즘을 볼 수 있는 단축키(sslpinning과 같은)가 없습니다.

버그 바운티 팁: 해커를 위해 해커가 만든 프리미엄 버그 바운티 플랫폼인 Intigriti가입하세요! 오늘 https://go.intigriti.com/hacktricks에서 저희와 함께하고 최대 $100,000의 보상을 받기 시작하세요!

HackTricks 지원하기

Last updated