TIL/General

Frida & HTTP Toolkit 이용한 Android SSL Pinning

asvv 2023. 10. 25. 15:46

Frida 설치

Python 3.9 기준으로 Frida 설치

pip install frida
pip install objection
pip install frida-tools

HTTP Toolkit 설치

https://httptoolkit.com/ 에서 설치.

ADB 설치

https://developer.android.com/studio/releases/platform-tools?hl=ko
해당 사이트에서 SDK Platform tools를 각 OS 버전에 맞게 설치

Android 기기 Bit 확인

adb shell getprop ro.product.cpu.abi
Application Binary Interface Bit
armeabi-v7a 32bit
arm64-v8a 64bit
x86 32bit
x86_64 64bit

Frida Server 설치

기존 Frida Server는 제조사 측에서 탐지할 수 있어, Hluda Server로 대체

설치 시, Bit에 맞게 설치. arm64-v8a 이면 hluda-server-16.1.4-android-arm64 다운로드

ADB 명령어로 hluda server 안드로이드에 넣기

다운로드한 파일 압축 해제 후 "hluda-server64"로 이름 변경. (편하게 사용하기 위함)

# windows
adb push "hluda-server64" /data/local/tmp
adb shell

# android
su
cd /data/local/tmp
chmod 777 hluda-server64
./hluda-server64 &

SSL Pinning 환경 구축

Frida-interception-and-unpinning 이용해서 SSL Pinning 진행

git clone https://github.com/httptoolkit/frida-interception-and-unpinning.git
  1. config.js 수정
    1.1. Http Toolkit을 설치하면 %APP_DATA%\Local\httptoolkit\Config\에 ca.pem 파일 존재
    1.2. 해당 파일 내용을 config.js 에 추가

  1. HTTP Toolkit 실행
  2. Frida 명령어 실행
    frida -U \
     -l ./config.js \
     -l ./native-connect-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 $PACKAGE_ID

HTTP Toolkit으로 Pinning한 패킷 분석 진행

반응형