Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save morisono/c974e6fa31fd06874d051b93d8cdfc53 to your computer and use it in GitHub Desktop.
Save morisono/c974e6fa31fd06874d051b93d8cdfc53 to your computer and use it in GitHub Desktop.
PayPay のリバースエンジニアリングに関するメモたち

PayPay アプリをデコンパイルする

JADX というツールを使うとある程度 java のコードに直してくれる
apk ファイルを読み込ませるだけなので難しくない
Ctrl + Shift + F で特定の単語をapk全体から検索

PayPay の通信を mitmproxy で盗み見る

環境

前提ツールのセットアップ

adb のインストール

Windows なら Android SDK Platform-Tools をダウンロードして PATH を通すのが楽

Python のインストール

https://www.python.org/

mitmproxy のインストール

https://mitmproxy.org/

mitmproxy は一度起動しておく(CA 証明書を生成するため)

frida-tools のインストール

https://frida.re/docs/installation/

pip install frida-tools

Windows の場合は %Appdata%\Python\Python3XX\Scripts に PATH を通す必要がある(XX はバージョン)

frida-server を動作させる

公式ドキュメント: https://frida.re/docs/android/

リリースページ から Android 用の frida-server をダウンロード、解凍して、ファイルの名前を frida-server に変えておく https://github.com/frida/frida/releases/download/16.2.1/frida-server-16.2.1-android-arm64.xz

PC と Android 端末を接続し以下のコマンドを実行

adb push <frida-server があるパス> /data/local/tmp/
adb shell "su -c chmod 755 /data/local/tmp/frida-server"
adb shell "su -c /data/local/tmp/frida-server &"

frida-ps -U を実行してパッケージ一覧のようなものがいっぱい出てくれば正常に動作している

frida-interception-and-unpinning を準備

公式ドキュメント: https://github.com/httptoolkit/frida-interception-and-unpinning#android-getting-started-guide

  1. リポジトリ (https://github.com/httptoolkit/frida-interception-and-unpinning) をダウンロードもしくはクローン
  2. config.js ファイルを開き編集する
    • CERT_PEM~/.mitmproxy/mitmproxy-ca-cert.pem の内容に置き換える
    • PROXY_HOST は PC のローカル IP アドレス
    • PROXY_PORT8080 に変更

MITM する

mitmproxy を起動してから次のコマンドを実行する

cd frida-interception-and-unpinning
frida -U -l ./config.js -l ./native-connect-hook.js -l ./native-tls-hook.js -l ./android/android-proxy-override.js -l ./android/android-system-certificate-injection.js -l ./android/android-certificate-unpinning.js -l ./android/android-certificate-unpinning-fallback.js -f jp.ne.paypay.android.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment