I. Chuẩn Bị Máy Mac / Laptop
1. Cài đặt Python & Frida
Đầu tiên, cài Python từ python.org. Sau đó cài bộ công cụ Frida:
python3 -m pip install Frida
python3 -m pip install objection
python3 -m pip install frida-tools
Hoặc dùng pip3 trực tiếp:
pip3 install Frida
pip3 install objection
pip3 install frida-tools
2. Tải Script Bypass SSL
Để bypass SSL pinning, bạn cần một script Frida đã được viết sẵn. Có nhiều script cộng đồng trên Frida CodeShare:
- Universal Android SSL Pinning Bypass
- Frida Android Unpinning SSL
- Frida Multiple Unpinning
- Bypass SSL Pinning by Q0120S
fridascript.js trên máy.
3. Cài đặt Platform-tools (ADB)
Tải Android Platform-tools bao gồm ADB — cần thiết để giao tiếp với thiết bị Android qua USB.
II. Cài Đặt Trên Điện Thoại
1. Root Thiết Bị Android
Để inject script vào ứng dụng, thiết bị Android phải được root.
2. Bật USB Debugging
Vào Cài đặt → Tùy chọn nhà phát triển → Gỡ lỗi USB và bật lên.
3. Tải Frida Server
Kiểm tra kiến trúc CPU của thiết bị:
adb shell getprop ro.product.cpu.abi
Sau đó tải bản Frida Server phù hợp từ trang releases Frida. Ví dụ: frida-server-16.1.1-android-arm64.xz.
4. Cài Frida Server lên điện thoại
frida-server phải được cài trên thiết bị Android trước khi inject script.
Giải nén file tải về và đổi tên thành frida-server, sau đó push lên thiết bị:
adb push <path-to-frida-server> /data/local/tmp/
Cấp quyền thực thi:
adb shell chmod 777 /data/local/tmp/frida-server
III. Cài Đặt Burp Suite
Tải và cài Burp Suite Community Edition.
Để cấu hình certificate và thiết bị Android, tham khảo:
IV. Push Certificate Burp Suite Lên Thiết Bị
Push certificate CA đã tải ở bước trước lên thiết bị:
adb push <path-to-cacert.der> /data/local/tmp/cert-der.crt
V. Bắt Đầu Inject — Bypass SSL Pinning
1. Cấu hình trên điện thoại
Kết nối Wi-Fi và cấu hình proxy thủ công:
# Tìm IP local của máy Mac
ifconfig | grep 192
Cài đặt proxy trên Wi-Fi Android:
Host: 192.168.x.y (IP máy Mac)
Port: 8080
Khởi động Frida Server trên điện thoại từ terminal Mac:
adb shell "su -c '/data/local/tmp/frida-server'"
Hoặc chạy thủ công:
adb shell
su
cd /data/local/tmp
./frida-server
2. Desktop — Chạy Frida
Mở Burp Suite và vào Proxy → Options để xác nhận listener đang hoạt động trên port 8080.
Sau đó chạy Frida để inject script bypass:
# Dùng file script local
frida -l <path-to-fridascript.js> -U -f <package-name>
Hoặc dùng CodeShare trực tiếp
frida --codeshare masbog/frida-android-unpinning-ssl -U -f <package-name>
Các CodeShare ID khác bạn có thể dùng:
pcipolloni/universal-android-ssl-pinning-bypass-with-fridaQ0120S/bypass-ssl-pinning
Tham Khảo
- Bypass SSL Pinning trên Android bằng Frida (Viblo)
- SSL Pinning Bypass for Android Emulators (Medium)
Cảm ơn: @toanalien