android 기기 IDA PRO를 이용해 원격디버깅 하기

 

Notice : 해당 자료가 저작권등에 의해서 문제가 있다면 바로 삭제하겠습니다.
연구목적으로 사용하지 않고 악의적인 목적으로 이용할 경우 발생할 수 있는 법적은 책임은 모두 본인에게 있습니다.

1. IDA PRO 설치 폴더 내 dbgsrv 디렉토리에 가보면 android_server 파일이 있다.
이 파일을 안드로이드 기기로 복사한다.

C:\Program Files (x86)\IDA 6.5\dbgsrv>adb push android_server /data/local/tmp
3871 KB/s (566944 bytes in 0.143s)

2. 복사한 android_server 파일에 권한을 주고 실행한다.

C:\>adb shell
root@android:/ # cd /data/local/tmp
cd /data/local/tmp
root@android:/data/local/tmp # chmod 755 android_server
chmod 755 android_server
root@android:/data/local/tmp # ./android_server
./android_server
IDA Android 32-bit remote debug server(ST) v1.17. Hex-Rays (c) 2004-2013
Listening on port #23946...

3. 새로운 cmd 을 띄우고 adb 사용해서 디버깅 포트를 포워딩한다.

C:\>adb forward tcp:23946 tcp:23946

4. IDA PRO를 띄우고 Debugger > Attach > Remote ARMLinux/Android debugger 메뉴를 실행한다.
ida-remote-debugger1

5. Android 단말기의 IP정보를 확인해서 원격 디버깅을 붙인다.

C:\>adb shell
root@android:/ # netcfg
netcfg
lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00
sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
ip6tnl0  DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
rmnet_usb0 DOWN                                   0.0.0.0/0   0x00000000 00:00:00:00:00:00
rmnet_usb1 DOWN                                   0.0.0.0/0   0x00000000 00:00:00:00:00:00
rmnet_usb2 DOWN                                   0.0.0.0/0   0x00000000 00:00:00:00:00:00
p2p0     UP                                     0.0.0.0/0   0x00001003 xx:xx:xx:xx:xx:xx
wlan0    UP                             192.168.137.175/24  0x00001043 xx:xx:xx:xx:xx:xx
root@android:/ #

ida-remote-debugger2

원격디버깅이 정삭적으로 붙으면 아래와 같은 메세지가 나온다.

root@android:/data/local/tmp # ./android_server
./android_server
IDA Android 32-bit remote debug server(ST) v1.17. Hex-Rays (c) 2004-2013
Listening on port #23946...
=========================================================
[1] Accepting connection from 192.168.137.1...

6. 디버깅할 프로세스를 선택한다.
ida-remote-debugger3

완료~

ida-remote-debugger4

와 신기~

근데 이제 ARM 어셈블리도 봐야 하는건가?

어떻게 BP를 걸어야 할지 막막…ㅠㅠ

참고 : http://forum.xda-developers.com/showthread.php?t=2050393
http://blog.spiderlabs.com/2013/06/debugging-android-libraries-using-ida.html

 

This entry was posted in Android, Security/Hacking and tagged , , , . Bookmark the permalink.

3 Responses to android 기기 IDA PRO를 이용해 원격디버깅 하기

댓글 남기기