#1 - Security/iOS
-
iOS Syscall Instruction and Hooking#1 - Security/iOS 2022. 12. 12. 15:07
예전에 올린 글 중 iOS Exit 후킹 코드를 사용하다가 syscall 사용하여 exit 시키는 경우도 있어 찾아보게 되었다. 일단 iOS Syscall Table이다. https://www.theiphonewiki.com/wiki/Kernel_Syscalls 그 다음 iOS Syscall Instruction을 보면 이렇다. The immediate passed to svc is ignored, but the standard library uses svc 0x80. x16 holds the syscall number x0 through x8 hold up to 9 arguments* There are no arguments on the stack x0 and x1 hold up to 2 return ..
-
[iOS] Exit Function Hook#1 - Security/iOS 2020. 11. 25. 14:32
iOS 진단하다 탈옥 탐지 문구도 없이 앱 종료가 발생한다.. 그래서 생각해낸 방법은 exit 함수 훅걸어서 BackTrace 로 타고타고 올라감 var exit = Module.findExportByName('libSystem.B.dylib', 'exit'); Interceptor.attach(exit, { onEnter: function (args) { console.log("[*] exit Call"); console.log('\tBacktrace:\n\t' + Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress) .join('\n\t')); }, onLeave: function (retval) { } });
-
iOS 설치 파일 추출(IPA)#1 - Security/iOS 2020. 5. 26. 08:29
가끔 진단을 하다보면 직접 앱을 설치해서 주는 경우가 있다. APK 같은 경우는 추출하는 방법 검색하면 많이 나와 찾기 쉽지만 iOS는 버전마다 다르고해서 찾는데 오래걸릴 수 있다. 여러 방법 해본 결과 아래의 방법이 가장 편한거 같다. ipainstaller 로 쉽고 빠르게 ipa 파일 추출이 가능하다 [환경] 아이폰6 IOS 12.4.1 CheckRa1n 탈옥 1. Cydia 에서 IPA Installer, IPA Installer Console 두개를 다운 받는다. 2. 아이폰에 SSH 연결한다. 3. 아래 명령어 입력하여 추출한다. ipainstaller -b 4. /private/var/mobile/Documents 가 기본 경로인 것 같다. 해당 경로가서 FTP 사용하여 IPA 파일 추출
-
iOS Anti-Reversing Defenses#1 - Security/iOS 2020. 5. 22. 14:16
출처 : https://mobile-security.gitbook.io/mobile-security-testing-guide/ios-testing-guide/0x06j-testing-resiliency-against-reverse-engineering#overview iOS Anti-Reversing Defenses mobile-security.gitbook.io Jailbreak Detection (MSTG-RESILIENCE-1) Overview Jailbreak detection mechanisms are added to reverse engineering defense to make running the app on a jailbroken device more difficult. This bloc..
-
[iOS] User Function Frida Hooking#1 - Security/iOS 2019. 11. 21. 16:32
Case. ida로 바이너리 열어서 보면 심볼이 되어있지 않은 사용자 함수들이 발견된다. 해당 함수들 후킹 할 때, 바이너리 실행 단 함수 주소를 계산해서 인터셉트 해야한다. 사용자 함수 주소 계산 방식 : ((코드 섹션 오프셋) + (사용자 함수 절대 주소 – 코드섹션 시작 주소)) + Base 주소 코드섹션 시작주소는 0x100007db0 코드섹션 오프셋은 32176이다. 내가 찾고 싶은 사용자 함수 절대 주소는 0x1000108cc이다. Base 주소 더하지 않고 계산해보면 0x108cc 가 나오게 된다. 이제 Frida로 Base 주소 구한다음 Add 해준 주소를 인터셉트 하면 된다. 예제 코드 var module_base = Module.findBaseAddress('모듈이름'); var use..
-
[iOS] Frida Javascript API#1 - Security/iOS 2019. 10. 2. 13:39
1. [Class Methods Confirm] ObjC.classes[class_name].$ownMethods >실행결과 ------------------------------------------------------------------------------------------- 2. [Application Installation path] ObjC.classes[class_name].$moduleName; >실행결과 ------------------------------------------------------------------------------------------- 3. [Mapping each instance variable(ivars)] ObjC.classes[class_nam..
-
IDA 디컴파일 에러#1 - Security/iOS 2019. 10. 1. 21:14
1. "call analysis failed" 에러 시 [해당 디컴파일 안되는 곳 메소드 가서 Y 눌러 인자값 삭제] * 디컴파일을 위해서 분석용으로만 참고 2. "Decompilation failure: xxxxxx: positive sp value has been found" IDA 스택포인터 오류 해결법 디컴파일 시작 시 해당 함수 오류나면(오류나는 이유는 스택포인터가 음수거나 제대로된 SP로 안되어있기 때문에) 오류난 오류창 보게되면 어느 함수에 오류난 주소값 확인할 수 있음, 에러난 주소로 이동 후 하나 위의 주소 SP를 어셈블리에 있는 SP랑 맞게 설정(ALT+K), 안될 시 - 부호에서 +로 디컴파일 시도