rapid android application security testing

20
Rapid Android Application Security Testing

Upload: nutan-kumar-panda

Post on 18-Jul-2015

71 views

Category:

Mobile


2 download

TRANSCRIPT

Page 1: Rapid Android Application Security Testing

Rapid Android Application Security Testing

Page 2: Rapid Android Application Security Testing

Agenda

• Introduction to Android Testing

– Static Analysis

– Dynamic Analysis

– Local Storage Inspection

• Challenge.txt

Page 3: Rapid Android Application Security Testing

Android Security Testing

• Can install apps on device and go hack the network.

• Can install the application in the emulator and test it.

Page 4: Rapid Android Application Security Testing

What’s inside?

• Android is a Linux kernel based OS.

• Dalvik VM (Dalvik Virtual Machine) makes the dex file (Dalvik Executables) reach execution.

• APK (Android Application Package) contains all the resources, i.e. manifest file, signatures, dex file, and other resources in a zipped manner.

Page 5: Rapid Android Application Security Testing

So what happens.

• Java source code is compiled to Java byte Code using Java Compiler

• Byte code is converted into Dalvik Code using Dex compiler

• Dalvik Executable (Dex file) goes to “Dalvik VM” and executes within it.

Page 6: Rapid Android Application Security Testing

…..Continued.

Dalvik VM

Dalvik Executable (Dex File)

Java Source Code

Java Byte CodeJava Compiler

Dalvik Code

Dex Compiler

Page 7: Rapid Android Application Security Testing

Pentest. How to do?

• Break the testing into three parts:

– Static Testing

– Dynamic Testing

– Local Storage

• Try to uncover issues in every phase.

Page 8: Rapid Android Application Security Testing

Static Analysis

• Get the .apk file.

• Reverse Engineer it.

• Decompile / Dis-assemble it.

• Dis-assemble it using– Dedexer gives assembly like output) or

– Baksmali (based on dedexer and gives code more easy to understand.

• Decompile it using – Dex2jar (dalvik code turns to Java byte code (jar file).

– Use jd-gui to view the java source codes.h

Page 9: Rapid Android Application Security Testing

What to look for?

• Look for api information, database connection strings, internal / external IP disclosures and ports, etc.

• If you are lucky, you might get a password too, Believe me developers are crazy.

• If you can go for social engineering stuff, lot of emails can be found.

• Tip: A pair of /* and */ holds a lot of information.

Page 10: Rapid Android Application Security Testing

m0bLiz3r Demo

https://github.com/nkpanda/Android-Testing

Page 11: Rapid Android Application Security Testing

Dynamic Analysis

• Load emulator.

• Set up an Interception Proxy

• Figure out SSL issues.

• And follow the generic logic test cases you follow in web applications.

Page 12: Rapid Android Application Security Testing

Proxy Setup

Page 13: Rapid Android Application Security Testing

Continued…

Page 14: Rapid Android Application Security Testing

Local Storage Inspection

• Check for sensitive data getting stored on client side.

• XML files, database files are most commonly found culprits.

• Inspect memory for information sensitive information > memdump

• Inspect generated logs for sensitive information > logcat.

• Uninstall and check if things remain in application folder.

Page 15: Rapid Android Application Security Testing

Where to look?

Page 16: Rapid Android Application Security Testing

How it look?

Page 17: Rapid Android Application Security Testing

Tools Of Trade

• Android SDK

• ADB

• BurpSuite

• APKtools

• Smali/baksmali

• Dex2jar

• Genymotion

• Appuse/Android Tamer.

Page 18: Rapid Android Application Security Testing

Challenges• AppUse is quite slow:

– Save time in loading your Emulator.– Save time in installing app.

• ADB always run behind device. If you are idle, adb don’t work, or restart your emulator.– Keep your ADB attached to device constantly.

• Commands for every push, apk installation, etc. – Get Drag and Drop feature.

• Organization might ask you to get application from play store. – Get Play Store.

• Genymotion

– give you all the above sweet cake.

– Supports Webcam, mike, GPS, etc. as well --------- Haven’t tested them however

– Not stable. --------- One bad out of six is never a bad.

Page 19: Rapid Android Application Security Testing

Time UP : What next?

• OWASP mobile TOP 10

• Drozer (for Inter Process Communication)

• Explore new tools all the time.

• Keep sharing.

Page 20: Rapid Android Application Security Testing

Questions?