Back
Featured image of post APK-MITM (SSL-Pinning)

APK-MITM (SSL-Pinning)

개요

Proxy툴로 패킷을 잡아야할 때 일반적으로 사용하는 툴의 인증서를 넣거나 Frida로 후킹을 해야한다. 하지만 이러한 방식은 루팅된 단말이 있어야 하기 때문에 루팅된 단말이 없을 경우 해당 방법으로 SSL-Pinning이 가능하다. (Anroid 7이상 단말기에서는 시스템 영역에 인증서 이동을 시켜야하기 때문에 루팅이 필수이다.)

설치 방법

설치를 위해서는 Node.js(14+)와 java(8+)이 설치되어 있어야한다.

$ npm install -g apk-mitm

기본 옵션

$ apk-mitm <path-to-apk/xapk/apks>

* Optional flags:
--wait Wait for manual changes before re-encoding
--tmp-dir <path> Where temporary files will be stored
--keep-tmp-dir Don't delete the temporary directory after patching
--debuggable Make the patched app debuggable
--skip-patches Don't apply any patches (for troubleshooting)
--apktool <path-to-jar> Use custom version of Apktool
--certificate <path-to-pem/der> Add specific certificate to network security config

사용예시

아래와 같이 앱을 패치하고, 사용하는 프록시 툴 인증서를 설치하면 HTTPS 패킷이 정상적으로 들어오는 것을 확인 할 수 있다.

$ apk-mitm example.apk

  ✔ Decoding APK file
  ✔ Modifying app manifest
  ✔ Replacing network security config
  ✔ Disabling certificate pinning
  ✔ Encoding patched APK file
  ✔ Signing patched APK file

   Done!  Patched APK: ./example-patched.apk

출처

https://github.com/shroudedcode/apk-mitm

comments powered by Disqus