android pen test basics

25
Android Penetration Testing

Upload: owaspkerala

Post on 20-Jun-2015

438 views

Category:

Technology


1 download

DESCRIPTION

Android pen test basics By Vishnu P Presented at OWASP Kerala Meet September 2014

TRANSCRIPT

Page 1: Android pen test basics

Android Penetration Testing

Page 2: Android pen test basics

Topics covered

• Android Security Model• Android software stack• Content provider

Page 3: Android pen test basics

Android Software stack

Page 4: Android pen test basics
Page 5: Android pen test basics

Android Security Model

Page 6: Android pen test basics

Android security model

• Linux-based platform.• App programming – done in Java• App isolation.• OS software stack consists of Java apps

running on a Dalvik Virtual Machine. • Each app has its own DVM

Page 7: Android pen test basics

Android security model (contd)

• Data storage location: /data/data/<package-name>

• AndroidManifest.xml – very important– Contains information about package, components

like activities, services, content providers, etc– Responsible to protect the application by defining

permissions

Page 8: Android pen test basics

Content Provider

Page 9: Android pen test basics

Content providers

• Used to manage access to a structured set of data.

• Provide mechanism for defining data security.• Standard interface that connects data in one

process with code running in another process (Inter process communication)

Page 10: Android pen test basics
Page 11: Android pen test basics

Android debug bridge (ADB)

• Command line tool that lets you communicate with an android device/emulator.

~demo

Page 12: Android pen test basics

Structure of an apk file

Page 13: Android pen test basics

App security testing – how?

• Reverse engineering the apk file.• Examining permissions, services, activities, etc• Test sensitive data storage.

Page 14: Android pen test basics

Reverse engineering the apk

Page 15: Android pen test basics

Steps to reverse apk

1. Rename <file>.apk to <file>.zip2. Extract contents of zip3. Convert application code (Dalvik bytecode) to

Java bytecode using dex2jar4. Convert Java byte into Java source code

using JD-GUI

Page 16: Android pen test basics
Page 17: Android pen test basics

Testing

• Pre-requisites– PC with Android SDK installed– Genymotion Android emulator– Tools like apktool, dex2jar, etc

Page 18: Android pen test basics

~demo

Page 19: Android pen test basics

Common insecure practices

• Hardcoding sensitive information• Encrypting passwords• Lack of binary protection• Insecure data storage. (~demo)

Page 20: Android pen test basics

Application integrity challenges• Hackers/malwares gaining physical access to

application binaries.• “My application contains no programming

flaws”. But, application binaries are still open to reverse-engineering and hacking tools.

• Most commonly found attack scenario:• Attempt to insert malware and rebuild the original app(eg.

whatsapp, flappybird, etc) to create malicious apk. • Spread malicious apk through email, social

network/forums.• Victim installs apk and is compromised.

Page 21: Android pen test basics
Page 22: Android pen test basics

Examples

• Bypassing Android lock-screen• Insecure data storage

Page 23: Android pen test basics

Secure Coding Practices

• Code obfuscation• Symbol stripping• Symbol renaming• String encryption• Anti-debug

And much more

Page 24: Android pen test basics

References

• Google Developers• Mobile App Integrity Protection by Arxan• Learning PenTest for Android – Aditya Gupta

Page 25: Android pen test basics

Principle of least privilege