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

Objectionは、Fridaによって動作するランタイムモバイル探索ツールキットです。これは、脱獄またはルート化されたモバイルデバイスを必要とせずに、モバイルアプリケーションとそのセキュリティ姿勢を評価するのを助けることを目的に構築されました。

注意: これは脱獄/ルートバイパスの一形態ではありません。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

基本アクション

このチュートリアルでは、objectionのすべてのコマンドはリストされず、私がより便利だと感じたものだけが含まれます。

環境

パスワードやパスなどの興味深い情報は、環境内に見つけることができます。

env

Fridaに関する情報

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

静的分析を動的に

実際のアプリケーションでは、静的分析のおかげで、この部分で発見されたすべての情報を知っておくべきです。それでも、この方法では、クラス、メソッド、およびエクスポートされたオブジェクトの完全なリストのみが表示されるため、新しい何かを見ることができるかもしれません。

これは、アプリの読みやすいソースコードを取得できない場合にも役立ちます。

アクティビティ、レシーバー、およびサービスのリスト

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 戻り値.

関数のブール戻り値を変更する

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