EvilZone

Hacking and Security => Mobile Hacking => Android => : Axon January 17, 2013, 12:34:34 AM

: See Source Code of Android Apps
: Axon January 17, 2013, 12:34:34 AM
Just found this article while browsing some hacking related sites,


http://rajhackingarticles.blogspot.com/2013/01/android-reverse-engineering-see-source.html
: Re: See Source Code of Android Apps
: Stackprotector January 17, 2013, 12:44:17 AM
Yeah i can confirm this. Google sucks at protecting the application. So if you want to be sure people pay for your app. You better get going to implement licensing systems and crypted/obfusticated code.
: Re: See Source Code of Android Apps
: Satan911 January 17, 2013, 04:08:36 AM
It is not entirely Google's fault. Android is an open platform running Java applications so if you have root access to your phone it's normal you can find the app .apk. Since it's java it is also normal you can "decompile" the code without too much trouble (android or desktop application). Where Google could do something is encrypt the file .class files a second time during the .apk packaging phase but I guess they had some reasons to not do it. After all if your phone is not rooted you don't have access to the apk files.
: Re: See Source Code of Android Apps
: p_2001 January 17, 2013, 04:31:07 AM
It is not entirely Google's fault. Android is an open platform running Java applications so if you have root access to your phone it's normal you can find the app .apk. Since it's java it is also normal you can "decompile" the code without too much trouble (android or desktop application). Where Google could do something is encrypt the file .class files a second time during the .apk packaging phase but I guess they had some reasons to not do it. After all if your phone is not rooted you don't have access to the apk files.

not exactly. You don't need root to extract apk filles. There is no need to root your phone to get the apk files.

: Re: See Source Code of Android Apps
: iTpHo3NiX January 17, 2013, 04:59:45 AM
It is not entirely Google's fault. Android is an open platform running Java applications so if you have root access to your phone it's normal you can find the app .apk. Since it's java it is also normal you can "decompile" the code without too much trouble (android or desktop application). Where Google could do something is encrypt the file .class files a second time during the .apk packaging phase but I guess they had some reasons to not do it. After all if your phone is not rooted you don't have access to the apk files.

You can download APKs off the internet no problem
: Re: See Source Code of Android Apps
: p_2001 January 17, 2013, 05:05:19 AM
You can download APKs off the internet no problem
haha...
he meant that someone has to root to get the apk.
On the net sometime had to root his phone, extract apk and upload it :P...
You don't need to do that. Apk can be extracted without root.
: Re: See Source Code of Android Apps
: Satan911 January 17, 2013, 06:40:36 AM
Learned something today. I have no idea why I was sure root was needed to extract apk files. Guess it is the programmers task to obfuscate the code then even though you probably won't get 100% working code using the technics in that article.
: Re: See Source Code of Android Apps
: Kulverstukas January 17, 2013, 09:34:00 AM
That's where ProGuard comes in to obfuscate that code. And it sure makes it hard to read... also decompiled APK's never contain the full code in Java or XML format, and it is hard to make a compilable project again from what you decompiled...
And that blog post didn't say anything magical. He just ran dex2jar and that is it - there are many more techniques and software...
: Re: See Source Code of Android Apps
: Deque January 17, 2013, 05:44:32 PM
it is hard to make a compilable project again from what you decompiled...

If you just modify a single class to enter some malicious code, it is not that hard. You just have to recompile the files you actually changed.
I also recompiled a whole project once, because I had to embed it in an application and it was full of System.exit() calls that closed my program too. It took me about two hours to remove the calls and the errors from decompiling.
: Re: See Source Code of Android Apps
: Kulverstukas January 17, 2013, 06:55:39 PM
If you just modify a single class to enter some malicious code, it is not that hard. You just have to recompile the files you actually changed.
I also recompiled a whole project once, because I had to embed it in an application and it was full of System.exit() calls that closed my program too. It took me about two hours to remove the calls and the errors from decompiling.
But you get whole Java code only if you're lucky. Some blocks of code get written as weird ASM instructions. I don't think Java can compile such stuff... or am I wrong?
: Re: See Source Code of Android Apps
: artymig January 21, 2013, 11:51:14 PM
How about NDK? How would that work in terms of being decompilable?
: Re: See Source Code of Android Apps
: Deque January 22, 2013, 09:28:37 AM
But you get whole Java code only if you're lucky. Some blocks of code get written as weird ASM instructions. I don't think Java can compile such stuff... or am I wrong?

Mh, usually bytecode can be decompiled without any problems. If there are ASM instructions, it means that you didn't have only bytecode to decompile.
I just assumed that android would use the bytecode, but I may be wrong at this point.
: Re: See Source Code of Android Apps
: p_2001 January 22, 2013, 09:48:34 AM
But you get whole Java code only if you're lucky. Some blocks of code get written as weird ASM instructions. I don't think Java can compile such stuff... or am I wrong?

not possible, at least it does not seem so.
Java code is meant to run on different architectures where each has it's own jvm, which converts the bytecode to executable code.

if you get ASM instructions then how will that code run on different machines?(with different instruction set or opcode) Java code cannot have asm code if it is supposed to be cross platform.
: Re: See Source Code of Android Apps
: WirelessDesert January 28, 2013, 03:20:38 PM
Kewl, can't wait till I get home.
Thx for the share!