최근 괜찮은 탈옥 툴이 나와서 게시글을 작성한다.

 

Dopamine 이라는 툴인데 해당 툴의 경우 Checkra1n나 palera1n 처럼 컴퓨터가 필요 없다.

 

장점은 언제나 폰이 꺼지면 dopamine을 켜서 탈옥 누르면 바로 탈옥이 완료된다는 것이다. 추가적으로 탈옥 우회 기능도 탑제하고 있어서 활성화 시 탈옥 탐지 우회를 높은 확률로 성공한다.

 

해당 툴 사용 가능한 버전과 기기는 아래와 같다

iOS and ipadOS:

15.0
15.0.1
15.0.2
15.1
15.1.1

15.2
15.2.1
15.3
15.3.1
15.4

15.4.1

A12:
iPhone Xs
iPhone Xs Max
iPhone XR
iPad mini (5th)
iPad Air (3rd)

iPad 8th
A12X:
iPad Pro 11 (1st)
iPad Pro 12.9 (3rd)
A12Z:
iPad Pro 11 (2nd)
iPad Pro 12.9 (4th)
A13:
iPhone 11
iPhone 11 Pro
iPhone 11 Pro Max
iPhone SE (2nd)

iPad 9th
A14:
iPhone 12 mini
iPhone 12
iPhone 12 Pro
iPhone 12 Pro Max

iPad Air (4th)
A15:
iPhone:
iPhone 13 mini
iPhone 13
iPhone 13 Pro
iPhone 13 Pro Max
iPad:
iPad mini (6th)
M1:
iPad Pro 11 (3rd)
iPad Pro 12.9 (5th)
   

https://ellekit.space/dopamine/

 

Dopamine

arm64e Jailbreak for iOS 15.0-15.4.1

ellekit.space

 

 

우선 설치를 위해서는 트롤스토어 설치가 우선 시 된다.

https://github.com/opa334/TrollStore/releases/tag/1.5.1

 

Release 1.5.1 · opa334/TrollStore

Fix crash on uninstallation

github.com

아이폰 Safari로 트롤스토어를 다운받는다.

설치하면 GTACarTracker가 생성 되는데 해당 앱으로 접속한다.

 

접속 시 Install TrollStore 버튼이 있어서 설치 시 TrollStore가 설치된다. 매우 쉽다.

 

그 후 아래 경로로 최신 dopamine을 다운 받는다.

https://github.com/opa334/Dopamine/releases/tag/1.1.10

 

Release 1.1.10 · opa334/Dopamine

Fix an issue where on some devices launchd would get killed by jetsam during the initial userspace reboot, resulting in a kernel panic (1.1.3 regression) Fix an issue where under some super rare ci...

github.com

 

필자의 경우 타 개발자가 기존 dopamine에서 Roothide 기능을 추가한 Roothide dopamine을 설치했다.

https://github.com/RootHide/Dopamine-roothide/releases/tag/1.0.6

 

Release 1.0.6 · RootHide/Dopamine-roothide

1: Merge the latest code of dopamine 2: Improve performance and stability through improved jit activation timing this version contains many bug fixes and stability and performance improvements, eve...

github.com

 

 

다운로드 후 내보내기를 통해 TrollStore로 해당 설치파일을 열어 Install

 

설치된 도파민 앱 접속 시 탈옥 버튼이 있는데 이것만 누르면 탈옥이 완료된다.

 

탈옥 중인 Dopamine 완료 시 아래와 같이 "탈옥이 되었습니다"라는 문구가 나오게 된다.

 

그러면 Sileo와 RootHide가 설치되는데 이제 관련 트윅을 다운로드 받아 설치하면  커스텀하여 아이폰 사용이 가능하다.

 

RootHide 트윅의 경우 RootHide dopamine에서만 나타나고 탈옥 탐지 우회를 더 강하게 해준다는데 우선 한번 더 확인이 필요하다.

 

한가지 조심해야할 점은 frida를 직접 앱에 붙이기 위해서는 Pid로 붙어야지 패키지명으로 하면 자체 탈옥 탐지 우회 기능떄문에 앱 연결이 끊겨 frida가 작동하질 않는다.

'APP 모의해킹 > iOS' 카테고리의 다른 글

palera1n ios 15~16 탈옥방법 with 맥북  (0) 2023.06.18
Tweak setting  (0) 2023.04.23
iOS Setting  (0) 2023.04.03
iOS 탈옥 탐지 우회 예시 코드 [추가 업로드예정]  (0) 2023.03.30
iOS 정적 분석  (0) 2023.03.30

사용자의 환경은 아이폰 x와 맥에서 진행을 하였다

기본적인 세팅은 Usb타입 케이블을 사용해야한다. c type으로 진행하였을 때 필자는 작동이 되지 않았고 Usb에 c-type 젠더를 끼워서 연결하니 정상적으로 탈옥이 되었다.

 

우선적으로 설치해야하는 것은 palera1n 이다.

아래 링크로 들어가서 palera1n-macos-universal을 다운 받는다.

https://github.com/palera1n/palera1n/releases

 

Releases · palera1n/palera1n

iOS 15.0-16.5 semi-tethered checkm8 jailbreak. Contribute to palera1n/palera1n development by creating an account on GitHub.

github.com

기본적으로 맥북과 핸드폰은 신뢰상태로 연결되어 있어야하고 탈옥 시 아이폰의 애플 계정 및 암호를 삭제해야한다.

 

순차적으로 명령어를 실행한다

#다운로드 한 경로로 이동( 필자는 다운로드 폴더에 저장되어서 다운로드 폴더로 이동함)
cd ~/Downloads

sudo mkdir -p /usr/local/bin

sudo mv ./palera1n-macos-universal /usr/local/bin/palera1n

sudo xattr -c /usr/local/bin/palera1n

sudo chmod +x /usr/local/bin/palera1n

cd /usr/local/bin/

#아이폰 연결 후 아래 명령어 실행
./palera1n -cf

#위 과정이 끝나면 아래 과정을 한번더 진행한다.
./palera1n -f

 

 <Error>: Timed out waiting for download mode (error code: -status_exploit_timeout_error) 탈옥 진행 중에 이 에러가 뜬다면 라이트닝 포트를 제거했다가 다시 연결하면 이후 과정이 순차적으로 진행되니 알고 있을 것!

 

여기서 특이한 점은 palera1n 을 두번 실행하는 것인데 첫번째 실행은 전체 시스템을 복사해서 페이크 시스템 만들고 탈옥을 하는 것이다

Where -c is a request to create FakeFS (a fake system created by cloning your entire system), f is a request to run rootfull.

한번 더 진행하는 정확한 이유는 모르지만 fakefs는 탈옥에만 이용되어 나중에 -c 명령어를 뺴면 fakeos를 삭제 진짜 os에 데이터를 올리는 것으로 예상된다. 그 이유로 첫번째 명령어 실행시 palera1n이 설치가 안되고 두번째 명령어를 실행할 때 palera1n이 깔린다. 

 

 

참고는 아래 링크를 통해 palera1n 을 참고 하여 작성되었다

https://www.youtube.com/watch?v=HDoG0urndkg&t=327s 

 

'APP 모의해킹 > iOS' 카테고리의 다른 글

RootHide Dopamine 설치 (Feat.탈옥 탐지 우회 RootHide)  (0) 2023.11.03
Tweak setting  (0) 2023.04.23
iOS Setting  (0) 2023.04.03
iOS 탈옥 탐지 우회 예시 코드 [추가 업로드예정]  (0) 2023.03.30
iOS 정적 분석  (0) 2023.03.30

이번에 트윅 개발을 위해 세팅을 진행할려고 한다.

본 환경은 맥북 m1 pro  환경에서 진행 되고 필자가 오늘 설치한 방법이니 참고하면 좋겠다.

기본적으로 트윅은 theos라는 툴을 이용하여 제작한다. 여러 라이브러리 및 기본 세팅을 도와주는 좋은 툴이다.

 

기본 세팅에 대한 정보는 hackcattml 님에게 얻었습니다.

https://hackcatml.tistory.com/107

 

THEOS 설치

frida로 후킹 시 알수 없는 이유로 크래시나는 경우가 있습니다. 그럴 경우, Theos 후킹 트윅 개발을 고려해볼수 있습니다. 저 같은 경우 탈옥탐지우회를 위해 fopen함수를 frida로 후킹하였는데, 알

hackcatml.tistory.com

맥에는 Homebrew가 세팅되어야 나중에 설정이 안꼬입니다.

 

# git과 ldid 설치
brew install git
brew install ldid

# user명 아래 파일에 theos 폴더와 안에 staging명으로 폴더 생성
mkdir ~/theos
mkdir ~/theos/staging

# theos와 staging을 환경 변수로 설정
echo "export THEOS=~/theos" >> ~/.zshrc
echo "export THEOS_STAGING_DIR=~/theos/staging" >> ~/.zshrc

# theos device 라이브러리를 다운로드
git clone --recursive https://github.com/theos/theos.git $THEOS

# ios sdk 중 원하는 버전을 다운로드 필자는 우선 다 다운로드함
# tmp이라는 거는 임시 폴더를 생성해야 불필요한 파일 생성을 줄이기 위해 임시 폴더 이용
curl -LO https://github.com/theos/sdks/archive/master.zip
TMP=$(mktemp -d)
unzip master.zip -d $TMP
mv $TMP/sdks-master/*.sdk $THEOS/sdks
rm -r master.zip $TMP

# 환경 변수에 추가
export workzone="$HOME/theos/bin"

# 환경 변수 적용을 위해서는 아래 명령어를 실행해야함
source ~/.zshrc

# 환경 변수 문제가 없다면 빨간 표시 없이 아무것도 뜨지 않을것이다.

위 세팅이 끝나면

theos/bin 내부에 있는 nic.pl을 실행시키면 된다

다만 ~경로가 아닌 theos 내부에서 프로젝트 생성이 아래 에러가 날것이다. 그렇기 때문에 ~경로에서 nic.pl을 실행하여

~디렉토리 바로 아래에 프로젝트를 생성한다.

[error] Cowardly refusing to make a project inside $THEOS

 

Project Name 은 소문자로 작성

특정 패키지 명으로 설정하고 싶으면 아래와 같이 설정 ex) com.hack.test

Package Name [com.yourcompany.tio]: com.hack.test
  • "이름 <메일>" 형식으로 작성
Author/Maintainer Name [Tyrell]:  <root@tyrell.kr>

SpringBoard에서 작동 시키고 싶다면 그냥 스킵을 위해 엔터

만약 특정 bundle id에 만 트윅이 작동하기 위해서는 세팅에 아래와 같이 설정

[iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]: com.aaa.bbb
  • 설치 후 적용을 위해 지정한 앱 강제 종료
  • 강제 종료 원하지 않으면 "-"
  • 무시 "enter"로 스킵
[iphone/tweak] List of applications to terminate upon installation (space-separated, '-' for none) [SpringBoard]: (enter)

이제 code ./Tweak.x 명령어로 트윅 코딩을 시작하면 된다.

# vscode로 tweak.x를 여는 명령어
code ./Tweak.x

# 아래 둘다 가능하고 작성 코드를 기반으로 deb 아이폰 설치 파일을 만들어 주는 명령어
make package
# 빌드 번호 없이 파일명으로 생성
make package FINALPACKAGE=1

만약 빌드가 다 완료되었을 경우 

scp를 이용하여 deb 파일을 기기 내로 이동시킨다.

# 파일 보내기
# 폴더 전송시 -r 옵션을 주면 됨
scp [옵션] [파일명] [원격지_id]@[원격지_ip]:[받는 위치]
scp testfile root@[IP]:/tmp/data/local/  
# 파일 가져오기
cp [옵션] [원격지_id]@[원격지_ip]:[원본 위치] [받는 위치]
scp root@[IP]:/tmp/data/local/testfile /tmp

만든 트윅 파일 설치

dpkg -i [deb패키지파일]

설치 시

/Library/MobileSubstrate/DynamicLibraries 에 해당 트윅이 설치된 것을 확인가능

해당 트윅이 정상 작동 안할 시 SpringBoard 리스프링 할 것

killall SpringBoard

1. openssh install

2. Frida 

https://build.frida.re/

수동으로 넣을려면 /usr/sbin/ 아래에 frida-server를 넣는다.

3. Cracker XI

https://cydia.iphonecake.com/

 

How to Install AppCake | AppCake Cydia Repo

Best iOS App Installer AppCake. AppCake is the most advanced iOS Cracked Apps Installer. It can install cracked iOS apps; install DEB files; download magnet & .torrent files. How To Install AppCake

cydia.iphonecake.com

4. fridump3

python fridump3 -u -r -s [pid]

https://github.com/rootbsd/fridump3

 

GitHub - rootbsd/fridump3: A universal memory dumper using Frida for Python 3

A universal memory dumper using Frida for Python 3 - GitHub - rootbsd/fridump3: A universal memory dumper using Frida for Python 3

github.com

5. ios dump

https://github.com/AloneMonkey/frida-ios-dump

 

GitHub - AloneMonkey/frida-ios-dump: pull decrypted ipa from jailbreak device

pull decrypted ipa from jailbreak device. Contribute to AloneMonkey/frida-ios-dump development by creating an account on GitHub.

github.com

[Errno None] Unable to connect to port 22 on 에러 뜨는건 Openssh 미설치이기 떄문

DUMP_JS = os.path.join(script_dir, 'dump.js')

User = 'root'
Password = 'alpine'
Host = 'ios IP'
Port = 22
KeyFileName = None

5. Filza

6. Shuffle

설정 트윅을 정리해서 보여줌

https://creaturecoding.com/repo

7. AppSync Unified

비인가 IPA 앱 파일을 설치하기 위해서 사용함

https://cydia.akemi.ai

8. apple file conduit "2"

3utools내 파일을 jailbreak 폴더까지 보이게 해준다.

9. A-bypass

https://repo.rpgfarm.com/

preferenceloader 추가 설치 필요 

 

'APP 모의해킹 > iOS' 카테고리의 다른 글

palera1n ios 15~16 탈옥방법 with 맥북  (0) 2023.06.18
Tweak setting  (0) 2023.04.23
iOS 탈옥 탐지 우회 예시 코드 [추가 업로드예정]  (0) 2023.03.30
iOS 정적 분석  (0) 2023.03.30
iOS 진단 코드  (0) 2023.03.21

일반적인 ios 후킹 코드

console.log("[*] Started: Hooking"); 
if (ObjC.available) {
    try {
        var className = "Class 명";
        var funcName = "메소드 명";
        var hook = eval('ObjC.classes.' + className + '["' + funcName + '"]');
        var newretval = ptr('0x0');

        Interceptor.attach(hook.implementation,{
            onLeave : function(retval) {console.log("[*] Class Name : " + className);
            console.log("[*] Function Name : " + funcName);
            console.log("[+] type of return value : " + typeof retval);
            console.log("[-] return value : " + retval);
            retval.replace(newretval);
            console.log("[-] new return value : " + retval);
            
        }});}
    catch(err) { console.log("[!] Exception2: " + err.message); } } 
else { console.log("not aVailable!")}

Ida를 이용한 메모리 주소를 추가하여 해당 반환값을 변조하는 코드

var targetMobile = 'DVIA-v2';
var addr = ptr(0x1949A8);
var moduleBase = Module.getBaseAddress(targetMobile);
var targetAddress = moduleBase.add(addr);


Interceptor.attach(targetAddress, {
    onEnter: function(args) {
        console.log('Address Entered: ' +addr + 'args: '+ args[2]);
    },
    onLeave: function(retval){
        console.log('retval: '+retval);
        retval.replace(0x0);
        console.log('modify: '+ retval);
    }
});

UI dump 출처 : https://hackcatml.tistory.com/57

frida -U DVIA-v2 -l UI_dump.js

var window = ObjC.classes.UIWindow.keyWindow();
var rootControl = window.rootViewController();

var ui = window.recursiveDescription().toString();
var ui_autolayout = window['- _autolayoutTrace']().toString();
var control = rootControl['- _printHierarchy']().toString();

// 전체 UI 계층 출력하고 싶은 경우    
// console.log("\n\x1b[31m" + ui + "\x1b[0m"); 

// Simplified recursiveDescription
// console.log("\n\x1b[34m" + ui_autolayout + "\x1b[0m");

// 현재 화면에 보여지는 UIController를 알고 싶은 경우
console.log("\n\x1b[32m" + control + "\x1b[0m");

 

'APP 모의해킹 > iOS' 카테고리의 다른 글

palera1n ios 15~16 탈옥방법 with 맥북  (0) 2023.06.18
Tweak setting  (0) 2023.04.23
iOS Setting  (0) 2023.04.03
iOS 정적 분석  (0) 2023.03.30
iOS 진단 코드  (0) 2023.03.21

Info.plist : 번들 ID, 버전번호, 메타데이터

- iOS 앱의 중요 정보 포함

- 앱에 대한 필수 구성정보 설명

- 키-값의 구조

- 모든 번들 실행 파일 정보 포함

- XML 또는 bplist 형식

- url scheme도 존재

- 앱 권한 (UsageDescription)

-  App Transport Security(ATS)설정 ➔ NSAppTransportSecurity

 

Library/ ➔ 캐시, 환경설정, 쿠키 및 속성 목록 (plist) 구성파일

Library/Caches/ ➔ 반영구 캐시 파일로 사용불가 및 백업 없음, 저장공간 정리 시 제거

Library/Application Support/ ➔ 앱 실행에 필요한 파일, 사용자에게 안보임 컨텐츠 백업(NSURLIsExcludedFromBackupKey)

 Library/Preferences ➔ 앱 재시작시에도 유지되는 속성 BUNDLEID.plist에 암호화 되지 않은 상태로 저장 NSUserDefaults 존재

tmp/ ➔ 앱 실행에 유지할 필요가 없는 임시 파일

/private/var/mobile/Containers/Data/Application/[app uuid]/Libaray/Cookies ➔ 쿠키 경로

 

디버깅 로그 내 중요정보 노출 여부

➔ 3uTools Realtime-log

➔ /var/mobile/Containers/Data/Application/[앱uuid]

➔ sdsiosloginfo.exe -d [로그파일명]

 

Keychain

➔ 앱 실행 시 민감한 정보를 저장하는 sqlite

➔ 주요정보(인증토큰, 비밀번호) 평문 저장

https://github.com/ptoomey3/Keychain-Dumper/releases

 

Releases · ptoomey3/Keychain-Dumper

A tool to check which keychain items are available to an attacker once an iOS device has been jailbroken - ptoomey3/Keychain-Dumper

github.com

Objection

# objection을 이용한 keychain dump
pip install objection
frida-ps -Uai
objection -g [packagename] explore
ios keychain dump

++
# 추가기능
# 탈옥 탐지 로직 우회
ios jailbreak disable
# ssl pinning
ios sslpinning disable

백그라운드 이미지 내 중요 정보 저장 여부

var/mobile/Containers/Data/Application/[Bundle_id]/Library/SplashBoard/Snapshots/sceneID:com.test.test-default/*.ktx
var/mobile/Containers/Data/Application/[Bundle_id]/Library/SplashBoard/Snapshots/sceneID:com.test.test-default/downscaled/*.ktx

 

'APP 모의해킹 > iOS' 카테고리의 다른 글

palera1n ios 15~16 탈옥방법 with 맥북  (0) 2023.06.18
Tweak setting  (0) 2023.04.23
iOS Setting  (0) 2023.04.03
iOS 탈옥 탐지 우회 예시 코드 [추가 업로드예정]  (0) 2023.03.30
iOS 진단 코드  (0) 2023.03.21

+ Recent posts