iOS Pentesting without Jailbreak
Tip
AWS 해킹 배우기 및 연습하기:
HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기:HackTricks Training GCP Red Team Expert (GRTE)
Azure 해킹 배우기 및 연습하기:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 계획 확인하기!
- **💬 디스코드 그룹 또는 텔레그램 그룹에 참여하거나 트위터 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.
Main idea
Applications signed with the entitlement get_task_allow allow third party applications to run a function called task_for_pid() with the process ID of the initial application as argument in order to get the task port over it (be able to control it and access it’s memory).
However, it’s not as easy as just pulling the IPA, re-signing it with the entitlement, and flashing it back to your device. This is becasue of FairPlay protection. When the signature of the app changes, the DRM (Digital Rights Management) key is invalidated and the app won’t work.
With an old jailbroken device, it’s possible to install the IPA, decrypt it using your favourite tool (such as Iridium or frida-ios-dump), and pulling it back off the device. Although, if possible, it’s recommended to just as the client for the decrypted IPA.
Obtain decrypted IPA
Get it from Apple
- pentest할 앱을 iPhone에 설치합니다.
- macOS에 Apple Configurator를 설치하고 실행합니다.
- Mac에서
Terminal을 열고/Users/[username]/Library/Group\\ Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/MobileApps로 cd 합니다. 이후 이 폴더에 IPA가 나타납니다. - iOS 장치가 표시될 것입니다. 장치를 더블클릭한 다음 상단 메뉴 바에서 Add + → Apps를 클릭합니다.
- Add를 클릭하면 Configurator가 Apple에서 IPA를 다운로드하고 기기로 푸시하려 시도합니다. 앞서 권장대로 이미 IPA를 설치했다면 앱을 재설치하겠냐는 프롬프트가 나타납니다.
- IPA는
/Users/[username]/Library/Group\\ Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/MobileApps에 다운로드되므로 여기서 가져올 수 있습니다.
이 과정에 대한 자세한 내용은 https://dvuln.com/blog/modern-ios-pentesting-no-jailbreak-needed을 확인하세요.
Decrypting the app
In order to decrypt the IPA we are going to install it. However, if you have an old jailbroken iPhone, potentailly it’s version is not going to be supported by the application as usually apps only suports latests versions.
So, in order to install it, just unzip the IPA:
unzip redacted.ipa -d unzipped
Info.plist에서 최소 지원 버전을 확인하고, 사용 중인 기기가 그보다 오래된 경우 값을 변경하여 지원되도록 하세요.
IPA를 다시 Zip으로 압축:
cd unzipped
zip -r ../no-min-version.ipa *
그런 다음 예를 들어 다음과 같이 IPA를 설치합니다:
ideviceinstaller -i no-min-version.ipa -w
Note that you might need AppSync Unified tweak from Cydia to prevent any invalid signature errors.
설치 후에는 Cydia의 Iridium tweak를 사용해 decrypted IPA를 얻을 수 있습니다.
권한(entitlements) 패치 및 재서명
get-task-allow entitlement으로 애플리케이션을 재서명하기 위해 app-signer, codesign, iResign 같은 여러 도구가 있습니다. app-signer는 매우 사용자 친화적인 인터페이스를 제공하여 재서명할 IPA 파일을 지정하고, put it get-taks-allow 및 사용할 인증서와 프로비저닝 프로파일을 쉽게 설정할 수 있습니다.
인증서와 서명 프로필과 관련해, Apple은 Xcode를 통해 모든 계정에 대해 free developer signing profiles를 제공합니다. 앱을 하나 생성하고 구성하면 됩니다. 그런 다음 Settings → Privacy & Security로 이동해 Developer Mode를 클릭하여 iPhone이 개발자 앱을 신뢰하도록 설정하세요.
재서명된 IPA를 사용하여 장치에 설치하고 pentest할 시간입니다:
ideviceinstaller -i resigned.ipa -w
IPA patching + DYLIB injection + free Apple ID re-sign (CLI)
이미 decrypted IPA가 있다면, 커스텀 DYLIB을 로드하도록 패치하고 entitlements(예: network)을 추가한 뒤, free Apple ID를 사용해 without Xcode로 재서명할 수 있습니다. 이는 non-jailbroken 기기에서 in-app instrumentation에 유용합니다.
Typical flow:
# Build the implant (macOS for build step)
make
# Patch the IPA to inject the DYLIB
python3 tools/patcher.py patch --ipa MyApp.ipa --dylib libShell.dylib
# -> MyApp_patched.ipa
# Patch + sign + install in one step (free Apple ID)
python3 tools/patcher.py full \
--ipa MyApp.ipa \
--dylib libShell.dylib \
--apple-id user@example.com \
--install \
--udid <device-udid>
참고:
- Free Apple ID signing은 보통 7일 후 만료되며 주당 3개의 App ID와 10개의 sideloaded apps로 제한됩니다.
- 이 도구는 Apple에 SRP로 인증하고 무료 dev certificate + provisioning profile을 생성하여 크로스-플랫폼으로 re-sign할 수 있습니다. Apple의 anisette 헤더는 플랫폼별로 처리됩니다 (macOS는
AOSKit.framework사용, Linux는 Anisette.py, Windows는 외부 anisette 서버 사용). - 이는 sandbox를 우회하지 않습니다. 주입된 코드는 앱 프로세스 내부에서 실행되며 앱의 sandbox와 keychain access groups에만 접근할 수 있습니다.
USB-only access to the injected implant
주입된 DYLIB가 로컬 TCP 제어 채널을 노출하면, 트래픽을 Wi-Fi/cellular에서 벗어나도록 유지하고 USB로 포워딩할 수 있습니다:
# Forward device-local TCP port to host
iproxy 8080 8080
# Example client commands (host side)
python3 client.py "ls"
python3 client.py "pwd"
python3 client.py "scp -r Documents host:./downloads"
만약 implant에 keychain helpers가 포함되어 있다면, accessible to that app 항목들을 dump할 수 있습니다:
python3 client.py "keychain dump"
python3 client.py "keychain dump --filter self"
python3 client.py "keychain dump --class generic"
개발자 모드 활성화 (iOS 16+)
iOS 16부터 Apple은 개발자 모드를 도입했습니다: get_task_allow을 포함하거나 개발 인증서로 서명된 바이너리는 기기에서 개발자 모드가 활성화될 때까지 실행을 거부합니다. 또한 이 플래그가 켜져 있지 않으면 Frida/LLDB를 연결할 수 없습니다.
- 휴대폰에 어떤 개발자 서명 IPA를 설치하거나 푸시합니다.
- 설정 → 개인 정보 보호 및 보안 → 개발자 모드로 이동하여 활성화합니다.
- 기기가 재부팅됩니다. 암호를 입력한 후 Turn On 버튼으로 개발자 모드를 켜라는 메시지가 표시됩니다.
개발자 모드는 비활성화하거나 기기를 초기화할 때까지 유지되므로 이 단계는 기기당 한 번만 수행하면 됩니다. Apple documentation는 보안 영향에 대해 설명합니다.
최신 사이드로딩 옵션
다음은 탈옥 없이도 재서명된 IPA를 사이드로드하고 최신 상태로 유지할 수 있는 성숙한 방법들입니다:
| 도구 | 요구사항 | 장점 | 제약 |
|---|---|---|---|
| AltStore 2 / SideStore | macOS/Windows/Linux 동반 앱으로, 무료 개발자 프로필로 IPA를 7일마다 재서명함 | Wi‑Fi를 통한 자동 다시로드, iOS 17까지 동작 | 같은 네트워크에 있는 컴퓨터 필요, Apple이 부과한 3개 앱 제한 |
| TrollStore 1/2 | CoreTrust 취약점에 노출된 iOS 14 – 15.4.1 기기 | 영구적 서명(7일 제한 없음); 설치 후 컴퓨터 불필요 | iOS 15.5+에서는 지원되지 않음(버그 패치됨) |
현행 iOS 버전에서의 일상적인 pentests에는 Alt/Side-Store가 보통 가장 실용적입니다.
Hooking / dynamic instrumentation
앱이 get_task_allow로 서명되고 개발자 모드가 켜져 있으면 jailbroken device에서와 정확히 동일하게 앱을 hook할 수 있습니다:
# Spawn & attach with objection
objection -g "com.example.target" explore
# Or plain Frida
frida -U -f com.example.target -l my_script.js --no-pause
최근 Frida 릴리스 (>=16)는 pointer authentication 및 기타 iOS 17 완화 조치를 자동으로 처리하므로 대부분의 기존 스크립트가 그대로 작동합니다.
non-jailbroken IPA에서 Frida Gadget injection (listen mode)
만약 modify and re-sign an IPA 할 수 있다면, Frida Gadget을 임베드하고 Mach-O를 패치해 시작 시 **@rpath**로 로드되게 할 수 있습니다. 이렇게 하면 jailbreak 없이 Frida/Objection을 사용할 수 있습니다(디바이스가 재서명된 IPA를 수락해야 함).
실용적인 워크플로우는 GadgetInjector (Python tool)를 사용해 FridaGadget.dylib을 주입하고 listen-mode 구성을 생성하는 것입니다:
python3 gadget_injector.py MyApp.ipa
# Output: MyApp-frida-listen.ipa
Re-signing constraints (탈옥되지 않은 설치에서 중요):
- 모든 embedded dylibs를 동일한 Team ID로 서명하세요.
FridaGadget.dylib에 추가 entitlements를 절대 추가하지 마세요.
재서명하고 IPA를 설치한 후, listen 모드에서 attach하세요:
# (Optional) start the app paused
xcrun devicectl device process launch \
--device <UDID> \
--start-stopped <bundle-id>
# Forward Frida listen port over USB (default 27042)
pymobiledevice3 usbmux forward 27042 27042
# Objection
objection -g <bundle-id> explore
# Or Frida CLI
frida -H 127.0.0.1:27042 -n MyApp
MobSF를 이용한 자동 동적 분석 (no jailbreak)
MobSF는 동일한 기술(get_task_allow)을 사용해 dev-signed IPA를 실제 기기에 계측할 수 있으며, 파일 시스템 브라우저, 트래픽 캡처 및 Frida 콘솔을 갖춘 웹 UI를 제공합니다【】. 가장 빠른 방법은 MobSF를 Docker에서 실행한 뒤 iPhone을 USB로 연결하는 것입니다:
docker pull opensecurity/mobile-security-framework-mobsf:latest
docker run -p 8000:8000 --privileged \
-v /var/run/usbmuxd:/var/run/usbmuxd \
opensecurity/mobile-security-framework-mobsf:latest
# Browse to http://127.0.0.1:8000 and upload your resigned IPA
MobSF will automatically deploy the binary, enable a Frida server inside the app sandbox and generate an interactive report.
iOS 17 & Lockdown Mode 주의사항
- Lockdown Mode (Settings → Privacy & Security)은 동적 링커가 서명되지 않았거나 외부에서 서명된 동적 라이브러리를 로드하는 것을 차단합니다. 이 모드가 활성화되어 있을 수 있는 디바이스를 테스트할 때는 반드시 해당 모드를 비활성화해야 하며, 그렇지 않으면 Frida/objection 세션이 즉시 종료됩니다.
- Pointer Authentication (PAC)은 A12+ 기기에서 시스템 전역으로 강제됩니다. Frida ≥16은 PAC 제거를 투명하게 처리하므로, 새로운 주요 iOS 버전이 출시될 때 frida-server와 Python/CLI 툴체인을 최신 상태로 유지하면 됩니다.
참고자료
- https://dvuln.com/blog/modern-ios-pentesting-no-jailbreak-needed
- Apple developer documentation – Enabling Developer Mode on a device: https://developer.apple.com/documentation/xcode/enabling-developer-mode-on-a-device
- Mobile Security Framework (MobSF): https://mobsf.github.io/Mobile-Security-Framework-MobSF/
- https://github.com/test1ng-guy/iOS-sandbox-explorer
- https://github.com/Saurabh221662/GadgetInjector
Tip
AWS 해킹 배우기 및 연습하기:
HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기:HackTricks Training GCP Red Team Expert (GRTE)
Azure 해킹 배우기 및 연습하기:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 계획 확인하기!
- **💬 디스코드 그룹 또는 텔레그램 그룹에 참여하거나 트위터 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.


