Log in

View Full Version : Android App Debugging? Anyone doing it?


FrankRizzo
January 12th, 2011, 23:52
Let's say that I have an APK, and I want to single step it using a debugger, presumably under the emulator. Has anyone done this yet? Is it possible?

Is there a handy dandy tutorial on getting it all set up?

digdugg
January 13th, 2011, 02:29
You mean something like this? http://source.android.com/porting/debugging_gdb.html

dELTA
January 13th, 2011, 12:30
You're supposed to check the CRCEKL before posting.

http://www.woodmann.com/collaborative/knowledge/Android_Reverse_Engineering_-_A_Kick_Start

http://www.woodmann.com/collaborative/knowledge/Primer_on_Android_OS_Reversing

BanMe
January 13th, 2011, 12:32
Interesting question..

Well you need the android sdk.

a review of the tools available:
http://developer.android.com/guide/developing/tools/adb.html

http://developer.android.com/guide/developing/tools/ddms.html

After breif review of the 'android' API it doesnt look like 'classical' deugging is possible, though I could be wrong.

12:49: Upon further thought and 'reading' this little piece http://codebrane.com/blog/?p=751
This essentially requires injection of 'code' into the APK. I've NO clue how to do this..Its just what 'comes' to me as the 'only' solution for debugging a APK that doesn't have the 'waitForDebugger()' call in it, Im still learning how to develop on droid myself, I want a Bandroid?

1:09: Can 1 app be genericly developed to debug other apps ?I asked myself this and off to the android SDK site I went. This feels like msdn to me all over again, a wealth of info,and hidden underneath it all are all the fun features.. :d

2:25:Apk 're' engineering http://code.google.com/p/android-apktool/
intersting stuff xD

regards BanMe

My timeline is lame because I was also researching asm opcodes concurrently to this. I hope this helps.

FrankRizzo
October 24th, 2011, 00:03
OK, I think enough time has passed.

Has anyone started tinkering with another process on the Android platform?

I was originally thinking of this in terms of cheating on games, but it could also be handy in the future for protections WHEN they appear.

I understand that each application that executes on the Dalvik VM runs in its own process, with its own copy of the VM.
But I'm thinking that using "normal" Linux tinkering we might be able to get to it.

I've been watching/listening to this while typing this message:
http://sites.google.com/site/io/dalvik-vm-internals

So, anyone doing any of this YET?

rendari
October 25th, 2011, 12:03
Hi Frank,

I just installed Android emulator, and have an Android phone lying around somewhere as well. Will be joining you in your quest soon, and will keep this thread updated

-rendari

rendari
October 25th, 2011, 21:59
Well, these have been an interesting couple of hours.

As it turns out, on Android it is pretty trivial to disassemble apps into Smali, decompile some apps into Java, to recompile and re-sign apps, and to attach the Netbeans debugger to apps running in the emulator.

Here are the links I used to learn all this.

Way of the Android Cracker (START HERE):
http://androidcracking.blogspot.com/p/way-of-android-cracker-lessons.html

Another introductory Android Cracking tutorial:
http://0x1337.in/

DDMS Tool Specs:
http://developer.android.com/guide/developing/debugging/ddms.html

DalvikVM To Java Converters:
http://undx.sourceforge.net/
http://code.google.com/p/dex2jar/ (What I use)

DalvikVM Debugger Support Described:
http://www.netmite.com/android/mydroid/2.0/dalvik/docs/debugger.html

Android Debugger called AndDebug (haven't used it yet):
https://github.com/swdunlop/AndBug

Whitebox debugging with Eclipse Debugger:
http://blog.doityourselfandroid.com/2010/12/07/debug-remote-android-proces-eclipse/

Native debugging out of Visual Studio (only for you if you're insane)
http://ian-ni-lewis.blogspot.com/2011/01/its-like-coming-home-again.html
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/
http://omappedia.org/wiki/Android_Debugging

Introduction to Android Reversing with Debugger:
http://forum.xda-developers.com/showthread.php?t=725870

The instructions and video I used to attach Netbeans debugger to Android app in emulator:
http://code.google.com/p/android-apktool/wiki/SmaliDebugging

Android antidebug:
http://androidcracking.blogspot.com/2011/06/protection-by-checking-for-debuggers.html


That should be all you need. Was enough for me Now I'm off for a happy night of serial fishing!

OHPen
October 28th, 2011, 04:00
You guys know that you can also use IDA Pro for android debugging, at least for debugging the underlying linux ?

Regards,
OHPen.

rendari
October 29th, 2011, 14:55
OHPen I've been looking around on how to do this for some time. Any tips would be appreciated, as I have little to no experience with IDA (Ollydbg fan).

-rendari

OHPen
November 7th, 2011, 10:27
Hi rendari,

sorry for my late answer. I missed your question...

If you have an valid license for ida pro you should find that stuff on the hex rays page

This was on February: http://twitoaster.com/country-es/lostinsecurity/next-ida-pro-version-will-support-android-native-code-debugger-it-will-support-both-armthumb-code-and-debug/

It's now contained in the newest version.

Regards,
OHPen

rendari
November 9th, 2011, 16:35
Thanks for the reply OHPen. Figured it out myself in the end ^^ Not much written on the subject of Android native debugging

rendari
November 16th, 2011, 03:14
Just a heads up to everyone using GDB for debugging native android apps,

the version of GDB google includes in their NDK for windows simply does not work. The boys from Nvidia fixed this for us by rebuilding GDB for cygwin. You can find the binaries here:
http://developer.nvidia.com/tegra-resources-archive

under GDB debugging guide. Please save the archive somewhere as it seems Nvidia will be taking that page offline soon. (Note you will need to install cygwin to run this version of GDB).

Cheers!

-rendari