Tushar Dalvi Sr. Security Engineer at LinkedIn Penetration Tester. Responsible for securing a large suite mobile apps



Similar documents
Pentesting Android Apps. Sneha Rajguru

Hacking your Droid ADITYA GUPTA

Mobile Application Hacking for Android and iphone. 4-Day Hands-On Course. Syllabus

AppUse - Android Pentest Platform Unified

Introduction to Android. CSG250 Wireless Networks Fall, 2008

WebView addjavascriptinterface Remote Code Execution 23/09/2013

Advanced ANDROID & ios Hands-on Exploitation

The OWASP Foundation

Android (in)security. Having fun with Android. Sarantis Makoudis

Deep Inside Android. OpenExpo Zurich September 25 th, Gilles Printemps - Senior Architect. Copyright 2007 Esmertec AG.

OWASP NZ Day 2011 Testing Mobile Applications

Enterprise Application Security Workshop Series

APPLICATION SECURITY: FROM WEB TO MOBILE. DIFFERENT VECTORS AND NEW ATTACK

Android Development. Marc Mc Loughlin

Beginners Guide to Android Reverse Engineering

Android Application Development

Getting started with Android and App Engine

Penetration Testing Android Applications

the cross platform mobile apps dream Click to edit Master title style Click to edit Master text styles Third level Fourth level» Fifth level

Graduate presentation for CSCI By Janakiram Vantipalli ( Janakiram.vantipalli@colorado.edu )

Understanding Android s Security Framework

Popular Android Exploits

Android Environment SDK

SYLLABUS MOBILE APPLICATION SECURITY AND PENETRATION TESTING. MASPT at a glance: v1.0 (28/01/2014) 10 highly practical modules

MASTER'S THESIS. Android Application Security with OWASP Mobile Top James King 2014

Bypassing SSL Pinning on Android via Reverse Engineering

Android For Java Developers. Marko Gargenta Marakana

Here to take you beyond Mobile Application development using Android Course details

Lab 4 In class Hands-on Android Debugging Tutorial

Android Geek Night. Application framework

Detecting Web Application Vulnerabilities Using Open Source Means. OWASP 3rd Free / Libre / Open Source Software (FLOSS) Conference 27/5/2008

OpenCV on Android Platforms

Android Application Development. Daniel Switkin Senior Software Engineer, Google Inc.

App Development for Android. Prabhaker Matet

Check list for web developers

Recon and Mapping Tools and Exploitation Tools in SamuraiWTF Report section Nick Robbins

SDK Quick Start Guide

Smartphone market share

Android (Basic + Advance) Application Development

Mercury User Guide v1.1

directory to "d:\myproject\android". Hereafter, I shall denote the android installed directory as

A Large-Scale Study of Mobile Web App Security

Braindumps.C questions

An Introduction to Android Application Development. Serdar Akın, Haluk Tüfekçi

Android Environment SDK

Login with Amazon Getting Started Guide for Android. Version 2.0

HP AppPulse Mobile. Adding HP AppPulse Mobile to Your Android App

How To Develop Android On Your Computer Or Tablet Or Phone

Getting Started with Android Programming (5 days) with Android 4.3 Jelly Bean

Web Application Security

Android app development course

Android Programming and Security

Securing ios Applications. Dr. Bruce Sams, OPTIMAbit GmbH

Out of the Fire - Adding Layers of Protection When Deploying Oracle EBS to the Internet

Android Security Basic Background

Google Web Toolkit. Introduction to GWT Development. Ilkka Rinne & Sampo Savolainen / Spatineo Oy

Cyber Security Challenge Australia 2014

Mobile Application Development

Programming Android Smart Phones. Tom Chothia Internet Computing Workshop

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

CompTIA Mobile App Security+ Certification Exam (Android Edition) Live exam ADR-001 Beta Exam AD1-001

Building an Android client. Rohit Nayak Talentica Software

The Top Web Application Attacks: Are you vulnerable?

Web Application Security. Vulnerabilities, Weakness and Countermeasures. Massimo Cotelli CISSP. Secure

Overview of CS 282 & Android

Blackbox Android. Breaking Enterprise Class Applications and Secure Containers. Marc Blanchou Mathew Solnik 10/13/

Running a Program on an AVD

Cracking the Perimeter via Web Application Hacking. Zach Grace, CISSP, CEH January 17, Mega Conference

Android Security for Enterprise App Developers Jon Preedy

Adobe Systems Incorporated

Overview. The Android operating system is like a cake consisting of various layers.

Android Programming: Installation, Setup, and Getting Started

Application Security Testing. Erez Metula (CISSP), Founder Application Security Expert

Independent Security. Prepared for:

UNRESTRICTED EXTERNAL

Android Security. Giovanni Russello

Measuring The End-to-End Value Of Your App. Neil Rhodes: Tech Lead, Mobile Analytics Nick Mihailovski: Developer Programs Engineer

Oracle FLEXCUBE Direct Banking Android Tab Client Installation Guide Release

Android Developer Fundamental 1

ABSTRACT' INTRODUCTION' COMMON'SECURITY'MISTAKES'' Reverse Engineering ios Applications

Web Application Vulnerability Testing with Nessus

Android Development Exercises Version Hands On Exercises for. Android Development. v

Google s Android: An Overview

Forensics II. Android reverse engineering Logs [repetition]

Web Application Hacking (Penetration Testing) 5-day Hands-On Course

Android 4.4 App Development Essentials

Developing Android Apps: Part 1

HackMiami Web Application Scanner 2013 PwnOff

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

Android Development Tutorial. Nikhil Yadav CSE40816/ Pervasive Health Fall 2011

Securing your Mobile Applications. Karson Chan Security Consultant

Mocean Android SDK Developer Guide

Fahim Uddin 1. Java SDK

Android Security Lab WS 2014/15 Lab 1: Android Application Programming

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

App Development for Smart Devices. Lec #2: Android Tools, Building Applications, and Activities

INTERMEDIATE ANDROID DEVELOPMENT Course Syllabus

ANDROID BASED MOBILE APPLICATION DEVELOPMENT and its SECURITY

Transcription:

Tony Trummer Staff Engineer, Information Security at LinkedIn Penetration tester and mobile security enthusiast #3 in Android Security Acknowledgements Tushar Dalvi Sr. Security Engineer at LinkedIn Penetration Tester Responsible for securing a large suite mobile apps

QARK QUICK ANDROID REVIEW KIT A new tool to test apps for vulnerabilities and automate exploitation

1. Review of reversing APKs 2. Review of Android app structure 3. Review of Android components 4. Review of attack surfaces and vectors 5. Review of current tools 6. QARK introduction and demonstration 7. Lab time for hands-on

Long-tail of supported versions Ship-once, own forever Pace of development Numerous inter-app communication methods Plenty of baked-in gotchas Poor documentation

The known app attack surface is relatively small and largely transparent The AndroidManifest.xml file reveals many of the potential vulnerabilities Java is a known quantity - plenty of tools to examine the Java code

APKs Reversing APKs Code Structure

APKs Compressed Compiled Signed

Reversing APKs apktool dex2jar JD-GUI

Reversing APKs apktool d foo.apk Provides readable AndroidManifest.xml

Reversing APKs cp foo.apk foo.zip unzip foo.zip Provides a classes.dex file This is Dalvik ByteCode/Smali

Reversing APKs dex2jar.sh classes.dex Gives you classes_dex2jar.jar Compressed Java

Reversing APKs Use JD-GUI to open classes_dex2jar.jar Choose Save All Sources from the File menu Creates classes_dex2jar.src.zip unzip classes_dex2jar.src.zip

Code Structure AndroidManifest.xml Java

AndroidManifest.xml android:name: fooactivity 1-to-1 Mapping Java class fooactivity.java

AndroidManifest.xml: Permissions Content Providers Services Activities Receivers Intent Filters Others: Pending Intents WebViews Local Files

AndroidManifest.xml Defines most of the attack surface minsdkversion tradeoff <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/ android" package="com.foo.android" android:installlocation="auto" android:versioncode="125" android:versionname="3.4.6" >

Permissions Protection Levels: normal dangerous signature signatureorsystem Can declare custom permissions Protect custom permissions with signatures Even signature based permissions can be stolen (pre-lollipop) <permission android:name="com.linkedin.android.permission.c2d_message" android:protectionlevel="signature" />

IPC Mechanisms Intents Explicit vs. Implicit Broadcast Used to start Activity, Service or deliver Broadcast Bundle/Extras AIDL Binder <intent-filter> <action android:name="android.accounts.accountauthenticator" /> </intent-filter>

Pending Intents Similar to callbacks Allow apps to act as one another final PendingIntent contentintent = PendingIntent.getBroadcast (this, notificationid, clickintent, PendingIntent.FLAG_CANCEL_CURRENT);

Intent Filters Not a security feature Often causes unintended exporting of features <intent-filter> <action android:name="android.accounts.accountauthenticator" /> </intent-filter>

Activities How users interact with the app <activity android:name="com.foobar.android.home.v2.shareactivity" android:configchanges="keyboardhidden orientation" android:screenorientation="portrait" android:windowsoftinputmode="statehidden adjustresize" > </activity>

Activity LifeCycle

Fragment LifeCycle

Services Processes that run in the background without a UI <service android:name="com.foobar.android.foo.authservice" android:exported="true > <intent-filter> <action android:name="com.foo.android.auth.do_stuff" /> </intent-filter> </service>

Service LifeCycle

Receivers Listen for events <receiver android:name=".authenticator.accountchangereceiver"> <intent-filter > <action android:name="android.accounts.login"/> </intent-filter> </receiver>

Content Providers Creates interface to app data Usually SQLite DB <provider android:name=".provider.foobarprovider" android:authorities="com.foobar.android" android:exported= true" android:label="@string/foobar_data" > </provider>

WebViews A horrible idea Build your own browser Can potentially access files and content providers Can potentially interact with Java classes Can run JavaScript and other plugins Same Origin Policy bypasses On-device HTML templates private WebView foowebview;

Malicious Apps Malicious Intents (injection attacks) Pending Intent addition Broadcast Intent interception Intent spoofing Implicit Intent interception Permission squatting

Malicious Web Content OWASP top 10 Deeplinking

Remote Attackers Insecure communications Improper certificate validation

Local Attackers! Per FTC, 50% of users don t set PIN (I m skeptical) Difference of perception (FUD + Media) FDE is available/default (now) Debugging enabled? Then, turn it off World readable files World writeable files injection

Java classes Unsafe URI Malicious Sites Exposed methods Insecure Content WebView Javascript Bridge

Local Files World readable SDCARDS World readable/writeable files World readable log files

Insecure WebView content Improper Certificate Validation Insecure URL handling Insecure Pending Intents Insecure Data Storage SQL Injection

Drozer: pretty good, reads manifest to determine attack surface, can be used for advanced exploitation ADB: A debugger, log viewer, provides a shell and can send Intents manually IDE: Can report some vulnerabilities during build and view logs

adb shell CLI shell adb push/pull move files adb root restarts daemon as root adb shell pm list packages shows installed apps adb shell pm path com.foo.bar

# specifying the action and data uri adb shell am start -a "android.intent.action.view" -d "http:// developer.android.com" # specifying the action, mime type and an extra string adb shell am start -a "android.intent.action.send" --es "android.intent.extra.text" "Hello World" -t "text/plain" # specifying an explicit component name adb shell am start -n "com.example.application/.mainactivity # specifying an explicit component name adb shell am startservice n "com.example.application/.backgroundservice" # specifying the action adb shell am broadcast a "android.intent.action.package_first_launch" -d "com.example.application" Thanks: http://xgouchet.fr/

A lazy tester s friend Attempts to improve on these tools Can be used for attacking or auditing Written in Python Combination of XML parser and Android (Java) SCA

Drozer Strengths Ease of (basic) use Exploitation options Weakness Not SDLC friendly Free version limited Unfamiliar to devs Poor Docs Requires Android knowledge COTS tools Thorough in theory Well maintained? Expen$ive Many are geared toward forensics Little/no POC support or exploit options

Strengths Automatic PoC exploit app generation Exploitation options SDLC friendly Learning Red & Blue Team Extensible Weakness CLI-only for now SQLMap integration still in the works Work in progress?

Python XML Parsing Java Parsing (PLYJ) Grep Regex Time Experience Googling Python-Adb Dex2jar Multiple rounds of decompilation Best effort error handling for decompilation

Processes Manifest Determines supported API versions and version specific vulnerabilities Identifies insecure app configurations Identifies all explicitly and implicitly exported interprocess communication processes (aka sources) Evaluates permissions and protections SCA-light for Android-specific weaknesses and vulnerabilities Source Sink tracking from Manifest to Class SDLC-friendly for use on raw source by Security or Devs Can be used by researchers on already published APKs, with the extraction and de-compilation occurring automatically Automatic generation of ADB exploit examples which are available in-app Automatic generation of WebView exploit files Automatic generation of APK to provide POC apps

Clear/Concise reporting of issues Reporting includes (or will soon) Severity Issue explanation References Exploit Instructions Customized exploit code / steps whenever possible Automatic POC APK generation Somewhere between Drozer and Metasploit for Android Apps

Your prayers are appreciated! All hail the mighty demo gods!!

GUI Additional output formats Enhanced SCA, with more source -> sink mapping Automate APK retrieval SQLMap for Content Provider sploiting Hosted version? Dealing with obfuscation?

Drozer-MWR Labs JSSEC-Android Application Secure Design/Secure Coding Guidebook Developer.android.com

Contact www.linkedin.com/in/tonytrummer @SecBro1 www.secbro.com www.linkedin.com/in/tushardalvi @tushardalvi