objection 툴로 Repackaging
원리는 Manual Repackaing과 동일하나, 도구로 편하게 리패키징 할 수 있다.
먼저 Xcode에 무료 사용자 계정이건, 개발자 계정이건 등록해서 빈 깡통 프로젝트를 장치로 빌드하면 embedded.provision 파일이 생성된다. 이는 서명과 관련된 많은 정보를 포함하며 이 정상 프로비전 파일을 이용하여 패치한 IPA 파일을 정상 빌드하는 데에 사용되며, Manual Repackaing에서 다룬 내용과 동일하다.
#개발자 signing certificate가 있는 지 확인하는 명령어 security find-identity -p codesigning -v

프로젝트의 Signing 파트에 어떤 계정으로 빌드했는지 확인하고 그에 맞는 signing identity를 사용하자.
Objection 설치
#objection 새로 설치 명령어 pip3 install objection #기존의 objection 업데이트 pip3 install --upgrade objection
Dependencies 설치
dylib을 삽입하여 앱을 리패키징하는 것은 objection patchipa 명령어를 이용하는데, 몇가지 추가설치 필요.
applesign
- from: https://github.com/nowsecure/node-applesign
insert_dylib
- from: https://github.com/Tyilo/insert_dylib
security
,codesign
,xcodebuild
- macOS/XCode commands
zip
&unzip
- builtin, or just installed usinghomebrew
7z
- installed using homebrew withbrew install p7zip
하나씩 설치 해보자.
applesign
#npm이 없다면 npm부터 설치 brew install npm #applesign 설치 npm install -g applesign
insert_dylib
git clone https://github.com/Tyilo/insert_dylib cd insert_dylib xcodebuild cp build/Release/insert_dylib /usr/local/bin/insert_dylib
git clone하고 빌드하고, /usr/local/bin/ 아래에 넣으면 됨.
나머지 dependencies
아마 Xcode 설치하면서 기본적으로 설치된 상태일 것이므로 생략.
IPA 패치하기
#sining identity는 맨앞에서 security find-identity 명령어로 찾은 것 objection patchipa --source 앱.ipa --codesign-signature <signing identity>

오류 없이 잘 됐다면 아래 그림처럼 앱-frida-codesigned.ipa 파일이 생성된다.

장치에서 실행하기
macOS와 Linux에서의 사용도구 차이가 있는데, 맥 기준으로만 다룬다.
macOS유저라면 ios-deploy라는 편리한 도구를 사용하면 끝이다.
#ios-deploy 설치 npm install -g ios-deploy
#앱.app 디렉토리에서 명령어를 실행해야하므로 unzip #그냥 확장자를 zip으로 바꾸고 압축 풀면 됨. unzip 패치한앱.ipa #장치로 deploy 시키기 (장치에서 실행 및 lldb 디버거 연결) ios-deply --bundle Payload/앱.app -W -d

[100%] 완료 후에 앱이 뜨기 까지 frozen 상태로 시간이 좀 걸리는데, 그 이유는 frida-gadget이 로드되기까지 시간이 걸리기 때문이다.
마지막에 Success가 뜨면서 lldb 명령창이 뜬다.
#새로운 콘솔창 열고 아래 명령어 실행 시 objection 명령 프롬프트 접근도 가능 #objection 툴이 자동으로 연결된 디바이스를 찾고 listening 중인 frida-gadget을 찾는다. objection explore
.png?table=block&id=3cf3459b-114b-4530-98b6-12bd10f587c4&cache=v2)
objection REPL 명령어
Objection Wiki : https://github.com/sensepost/objection/wiki/Using-objection
아래는 유용한 명령어 몇가지만 나열함.
# 앱에서 사용하는 저장소들 나열 $ env

# 자주 쓰이는 ssl pinning 메소드들 후킹해서 disable 시키기 $ ios sslpinning disable

# Dump the Keychain $ ios keychain dump

# access modifier를 포함한 키체인 내용을 json파일로 덤프하기. $ ios keychain dump --json <myfile.json>

# 만들어져있는 plist 파일 내부 관찰 $ ios plist cat <myfile.plist>

보안
FridaGadget.dylib가 올라와 있는지 검사 및 종료시키는 코드 삽입.