Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile...

28
M obile H acking Android

Transcript of Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile...

Page 1: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Mobile Hacking Android

Page 2: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Agenda

– Intern – Marko Winkler / Mobile Hacking - Android 2 15.02.2017

Einleitung

Ziele

Einführung Terminologie

Schwachstellen

Tools

Page 3: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Einführung - Terminologie

– Intern – Marko Winkler / Mobile Hacking - Android 4 15.02.2017

Activities

activity represents a single screen with a user interface

email app might have one activity that shows a list of new emails

another activity to compose an email,

and another activity for reading emails

each one is independent of the others

different app can start any one of these activities (if the email app allows it)

camera app can start the activity in the email app that composes new mail, in order for the user to share a picture

Page 4: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Einführung - Terminologie

– Intern – Marko Winkler / Mobile Hacking - Android 5 15.02.2017

Services

service is a component that runs in the background to perform long-running operations or to perform work for remote processes

does not provide a user interface

service might play music in the background while the user is in a different app

might fetch data over the network without blocking user interaction with an activity

another component, such as an activity, can start the service and let it run or bind to it in order to interact with it

Page 5: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Einführung - Terminologie

– Intern – Marko Winkler / Mobile Hacking - Android 6 15.02.2017

Content providers

content provider manages a shared set of app data

store the data in the file system, an SQLite database, on the web, or any other persistent storage location your app can access

through the content provider, other apps can query or even modify the data (if the content provider allows it)

Android system provides a content provider that manages the user's contact information. As such, any app with the proper permissions can query part of the content provider (such as ContactsContract.Data) to read and write information about a particular person

Page 6: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Einführung - Terminologie

– Intern – Marko Winkler / Mobile Hacking - Android 7 15.02.2017

Broadcast receivers

broadcast receiver is a component that responds to system-wide broadcast announcements

broadcast announcing that the screen has turned off, the battery is low, or a picture was captured

let other apps know that some data has been downloaded to the device and is available for them to use

although broadcast receivers don't display a user interface

More commonly, though, a broadcast receiver is just a "gateway" to other components and is intended to do a very minimal amount of work

broadcast receiver is implemented as a subclass of BroadcastReceiver and each broadcast is delivered as an Intent object

Page 7: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Einführung - Terminologie

– Intern – Marko Winkler / Mobile Hacking - Android 8 15.02.2017

Intents

activities, services, and broadcast receivers—are activated by an asynchronous message called an intent

Intents bind individual components to each other at runtime

An intent is created with an Intent object, which defines a message to activate either a specific component or a specific type of component—an intent can be either explicit or implicit, respectively

For activities and services, an intent defines the action to perform

for example, to "view" or "send" something

may specify the URI of the data to act on

among other things that the component being started might need to know

Page 8: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Einführung - Terminologie

– Intern – Marko Winkler / Mobile Hacking - Android 9 15.02.2017

Zusammenfassung

Activity:

different app can start any one of these activities (if the email app allows it)

Service:

another component, such as an activity, can start the service and let it run or bind to it in order to interact with it

Content providers:

through the content provider, other apps can query or even modify the data (if the content provider allows it)

Broadcast receivers:

More commonly, though, a broadcast receiver is just a "gateway" to other components

Quelle: https://developer.android.com/guide/components/fundamentals.html

Page 9: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Einführung - Terminologie

– Intern – Marko Winkler / Mobile Hacking - Android 10 15.02.2017

Zusammenfassung

Activity:

different app can start any one of these activities (if the email app allows it)

Service:

another component, such as an activity, can start the service and let it run or bind to it in order to interact with it

Content providers:

through the content provider, other apps can query or even modify the data (if the content provider allows it)

Broadcast receivers:

More commonly, though, a broadcast receiver is just a "gateway" to other components

Quelle: https://developer.android.com/guide/components/fundamentals.html

Page 10: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Einführung - Terminologie

– Intern – Marko Winkler / Mobile Hacking - Android 11 15.02.2017

Android Manifest

system must know that the component exists by reading the app's AndroidManifest.xml

Identify any user permissions the app requires, such as Internet access or read-access to the user's contacts.

Declare the minimum API Level required by the app, based on which APIs the app uses.

Declare hardware and software features used or required by the app, such as a camera, bluetooth services, or a multitouch screen.

API libraries the app needs to be linked against (other than the Android framework APIs), such as the Google Maps library.

And more

Page 11: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

15.02.2017 12

DAS SETUP / Schärfe deine Tools

– Intern – Marko Winkler / Mobile Hacking - Android

Page 12: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

15.02.2017 13

DAS SETUP / Schärfe deine Tools

– Intern – Marko Winkler / Mobile Hacking - Android

Page 13: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

15.02.2017 14

Schwachstellen

– Intern – Marko Winkler / Mobile Hacking - Android

Page 14: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Activity Exported

– Intern – Marko Winkler / Mobile Hacking - Android 15 15.02.2017

Activity

Page 15: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Activity Exported

– Intern – Marko Winkler / Mobile Hacking - Android 16 15.02.2017

Activity

Page 16: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Activity Exported

– Intern – Marko Winkler / Mobile Hacking - Android 17 15.02.2017

Activity

Page 17: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Broadcast Receiver

– Intern – Marko Winkler / Mobile Hacking - Android 18 15.02.2017

Broadcast

Page 18: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Broadcast Receiver

– Intern – Marko Winkler / Mobile Hacking - Android 19 15.02.2017

Broadcast

Page 19: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Broadcast Receiver

– Intern – Marko Winkler / Mobile Hacking - Android 20 15.02.2017

Broadcast

Page 20: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Content Providers

– Intern – Marko Winkler / Mobile Hacking - Android 21 15.02.2017

Page 21: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Content Providers

– Intern – Marko Winkler / Mobile Hacking - Android 22 15.02.2017

Page 22: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Intents

– Intern – Marko Winkler / Mobile Hacking - Android 23 15.02.2017

Intent Sniffing

Page 23: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Intents

– Intern – Marko Winkler / Mobile Hacking - Android 24 15.02.2017

Intent Sniffing

Page 24: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Sensitive Data

– Intern – Marko Winkler / Mobile Hacking - Android 25 15.02.2017

Hardcoded Strings

http://resources.infosecinstitute.com/android-hacking-security-part-9-insecure-local-storage-shared-preferences/

Page 25: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

Tools

– Intern – Marko Winkler / Mobile Hacking - Android 26 15.02.2017

Analyse

https://ibotpeaches.github.io/Apktool/

reverse engineering Android apk files

https://github.com/skylot/jadx

Dex to Java Decompiler

https://bitbucket.org/pxb1988/dex2jar/downloads

Read/write the Dalvik Executable (.dex) file

Convert .dex file to .class files

disassemble dex to smali files and assemble dex from smali files

SCA

https://github.com/linkedin/qark

QARK is an easy to use tool capable of finding common security vulnerabilities in Android applications

Page 28: Mobile Hacking Android - OWASP · Einführung - Terminologie – Intern – Marko Winkler / Mobile Hacking - Android 15.02.2017 5 Services service is a component that runs in the

F R A G E N