LoginSignup
13
1

More than 1 year has passed since last update.

AndroidのChrome 99以降の通信取得手順

Last updated at Posted at 2022-12-16

AndroidのChrome99以降のバージョンから通信の取得手順が増えたので簡単にメモします。

※PortSwiggerの記事に下記の記載があるためroot権限が必要ない手順を取ります。

In addition, you need to make further configuration changes in order to proxy HTTPS traffic from a Chrome browser that's at version 99 or above.
For further information on how to perform these steps, you can refer to the following external links. Please note that we're not responsible for the content of these pages:

出典: Configuring an Android device to work with Burp Suite Professional

検証環境

  • Android 9
  • Chrome 107.0.5304.91

手順

方法としてはChromeの起動オプションでBurpSuiteの証明書の透明性チェックを無効にすることで通信を取得できるようにします。

Chromeの設定

  • Chromeを開きchrome://flagsにアクセス
  • Search flagsからEnable command line on non-rooted devicesと検索
  • 設定をEnableに変更

これでChromeがコマンドラインファイルを読み込めるようになります。

chrome-flags.png

コマンドラインファイルの作成

  • BurpSuiteからCA証明書をエクスポート
  • 証明書の保存場所に移動して下記コマンドでSPKIフィンガープリントを取得
$ openssl x509 -in cacert.der -pubkey -inform der -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
  • 取得した値を使ってchrome.txtを作成
chrome.txt
chrome --ignore-certificate-errors-spki-list=$SPKI_FINGERPRINT

※ファイル名は任意の名前で問題ありません。

Android端末に送信

  • adbコマンドでファイルをAndroid端末に送信
$ adb push chrome.txt /sdcard/
  • 送信したファイルを以下に保存する
    • /data/local/tmp/chrome-command-line
    • /data/local/tmp/android-webview-command-line
    • /data/local/tmp/webview-command-line
    • /data/local/tmp/content-shell-command-line
$ adb shell cp /sdcard/chrome.txt /data/local/tmp/chrome-command-line
$ adb shell cp /sdcard/chrome.txt /data/local/tmp/android-webview-command-line
$ adb shell cp /sdcard/chrome.txt /data/local/tmp/webview-command-line
$ adb shell cp /sdcard/chrome.txt /data/local/tmp/content-shell-command-line
  • Chromeが読み込めるように権限を変更
$ adb shell chmod 755 /data/local/tmp/chrome-command-line
$ adb shell chmod 755 /data/local/tmp/android-webview-command-line
$ adb shell chmod 755 /data/local/tmp/webview-command-line
$ adb shell chmod 755 /data/local/tmp/content-shell-command-line

変更
パーミッションを555から755へ変更しています。
ファイルを書き換えるたびに削除するのが面倒なので。

Chromeの起動オプションの確認

  • ファイルを送信後、Chromeを再起動
  • chrome://versionにアクセス
  • コマンドラインにオプションが表示されているか確認
    • --ignore-certificate-errors-spki-list=SPKI_FINGERPRINT

chrome-version.png

※SPKI_FINGERPRINTの箇所はopensslコマンドで取得した値になります。

BurpSuiteで通信の確認

Chromeの起動オプション設定後、BurpSuiteで通信が取れるようになっていると思います。

burppp.png

一連の流れ

Chromeの設定以外はスクリプトにして実行したら簡単かと思います。

chromeflag.sh
# コマンドラインファイルの作成
SPKI_FINGERPRINT=`openssl x509 -in cacert.der -pubkey -inform der -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64`
echo "chrome --ignore-certificate-errors-spki-list=$SPKI_FINGERPRINT" > chrome.txt

# Android端末へ送信
adb push chrome.txt /sdcard/
adb shell cp /sdcard/chrome.txt /data/local/tmp/chrome-command-line
adb shell cp /sdcard/chrome.txt /data/local/tmp/android-webview-command-line
adb shell cp /sdcard/chrome.txt /data/local/tmp/webview-command-line
adb shell cp /sdcard/chrome.txt /data/local/tmp/content-shell-command-line

# 権限設定
adb shell chmod 755 /data/local/tmp/chrome-command-line
adb shell chmod 755 /data/local/tmp/android-webview-command-line
adb shell chmod 755 /data/local/tmp/webview-command-line
adb shell chmod 755 /data/local/tmp/content-shell-command-line

変更
パーミッションを555から755にしています。
ファイルを書き換えるたびに削除するのが面倒なので。

参考記事

13
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
1