How to debug Dalvik and ARM code together?

 

안드로이드 동적 디버깅 시, SO파일을 동적 디버깅해야 하는 경우가 종종 생깁니다. (사실상 거의 필수...)

 

IDA에서 classes.dex파일과 so파일을 같이 디버깅하는 법은 다음과 같습니다.

 

먼저 아이다 설치 위치(default : C:\Program Files\IDA 7.0)의 dbgsrv 폴더 내 android_server파일을 단말기에 업로드 후 실행시켜 줍니다.

ex)

$ adb push android_server /data/local/tmp

$ adb forward tcp:23946 tcp:23946

$ adb shell

$ su

$ chmod 777 /data/local/tmp/android_server

$ /data/local/tmp/android_server &

실행 후, 디버깅하려는 dex파일과 so파일을 각각 IDA를 통해 로드하고 종단점을 설정합니다.

classes.dex파일을 로드한 IDA의 [Debugger] - [Debugger options..] 내 다음 내용을 입력합니다.

Activity는 앱 처음 실행 시 로드되는 activity명을 입력해주시면 됩니다.

Process Start (F9)하여 앱 실행시키고 종단점을 설정한 부분에서 대기하는 것을 확인합니다.

so파일을 로드한 IDA로 돌아와서, debugger를 Remote ARM Linux/Android debugger로 변경합니다.

[Debugger] - [Process options..]의 Hostname을 설정합니다. (default : 127.0.0.1)

[Debugger] - [Attach Process]를 통해 디버깅하려는 앱 선택 후 다음과 같은 화면이 나타나면 왼쪽 상단의 start버튼을 클릭합니다.

dex파일을 로드한 IDA로 돌아와 F8버튼으로 so파일 로드하는 함수를 실행하면 Running이라는 알람이 출력됩니다.

So파일을 로드한 IDA로 돌아오면 기존에 설정한 종단점에서 대기하는 것을 확인할 수 있습니다.

 

출처 : https://www.hexblog.com/?p=809

 

IDA Dalvik debugger: tips and tricks – Hex Blog

One of the new features of IDA 6.6 is the Dalvik debugger, which allows us to debug Dalvik binaries on the bytecode level. Let us see how it can help when analysing Dalvik files. Encoded strings Let us consider the package with the encrypted strings: STRIN

www.hexblog.com

 

'Mobile' 카테고리의 다른 글

odex to dex  (0) 2020.05.08
ro.debuggable 변경을 통한 동적 디버깅  (2) 2019.09.23
DVIA (Binary Patching)  (0) 2019.09.03
Cydia Impactor 에러 모음  (1) 2019.09.03
DVIA (Jailbreak Detection 2 ... Frida)  (0) 2019.08.28

+ Recent posts