Security Testing
Android
with Mercury
Daniel Bradberry

9th April 2013
Who is this guy?
Daniel Bradberry
Head of Security Tools Development at MWR


We build tools for security assessment and
assurance.
Agenda


•   Introduction
•   Android (In)Security
•   Mercury
•   Performing an Assessment
•   Summary
Android Security

• Code runs in a Dalvik VM
• Apps are constrained by a “Sandbox”:
  – one Unix user per app
  – granular permissions.


• Apps interact through Inter-Process
  Communication (IPC)
Android Insecurity


•   ‘Normal’ Coding Issues
•   Use of Native Code
•   Use of the SD Card
•   Misuse of IPC
•   Apps shipped with Debugging enabled
Android IPC
• Apps export features to
  share:                                        com.ex.app1
   –   activities
   –   broadcast receivers
   –   content providers
                                       Binder
   –   services


• The ‘Binder’ routes
                             com.ex.app2
  messages between
  apps.
Android IPC
<activity android:name=“.MainActivity”
          android:exported=“true”>
   <intent-filter>
     <action
       name="android.search.action.MAIN" />
     <category
       name="android.intent.category
               .LAUNCHER" />
   </intent-filter>
</activity>
Tools to Help


•   adb
•   aapt
•   Custom Scripts
•   Decompilers
Mercury
Security Assessment
Framework for Android

• Dynamic Analysis
• Rapid Iteration
• Does not require
  debugging
• Can be used over the
  Internet
mwr.to/mercury
How it Works
• Agent
  – single permission                  Mobile
    Android app              Agent
                                       Device
  – runs on your device or
    emulator.
• Console
  – command-line interface
    to interact with the     Console      PC
    Agent
  – runs on your PC.
Performing an Assessment



                   Investigate
  Identify the                         Find
                     Potential                       Exploit
 Attack Surface                    Vulnerabilities
                  Attack Vectors
Let’s Do It!


• Sieve is a Password Manager

• It’s installed in an Android 4.1.2 emulator,
  along with the Mercury Agent.
Demo Time
Summary

• We seem to have largely forgotten security
  when developing Android apps.
• These vulnerabilities expose our users and
  businesses to risk.

• We can use Mercury to discover all sorts of
  Android vulnerabilities.
mwr.to/mercury
Questions?
               @droidhg
Mwri security testing-android-with-mercury-2013-04-02

Mwri security testing-android-with-mercury-2013-04-02

  • 1.
  • 2.
    Who is thisguy? Daniel Bradberry Head of Security Tools Development at MWR We build tools for security assessment and assurance.
  • 3.
    Agenda • Introduction • Android (In)Security • Mercury • Performing an Assessment • Summary
  • 4.
    Android Security • Coderuns in a Dalvik VM • Apps are constrained by a “Sandbox”: – one Unix user per app – granular permissions. • Apps interact through Inter-Process Communication (IPC)
  • 5.
    Android Insecurity • ‘Normal’ Coding Issues • Use of Native Code • Use of the SD Card • Misuse of IPC • Apps shipped with Debugging enabled
  • 6.
    Android IPC • Appsexport features to share: com.ex.app1 – activities – broadcast receivers – content providers Binder – services • The ‘Binder’ routes com.ex.app2 messages between apps.
  • 7.
    Android IPC <activity android:name=“.MainActivity” android:exported=“true”> <intent-filter> <action name="android.search.action.MAIN" /> <category name="android.intent.category .LAUNCHER" /> </intent-filter> </activity>
  • 8.
    Tools to Help • adb • aapt • Custom Scripts • Decompilers
  • 9.
    Mercury Security Assessment Framework forAndroid • Dynamic Analysis • Rapid Iteration • Does not require debugging • Can be used over the Internet
  • 10.
  • 11.
    How it Works •Agent – single permission Mobile Android app Agent Device – runs on your device or emulator. • Console – command-line interface to interact with the Console PC Agent – runs on your PC.
  • 12.
    Performing an Assessment Investigate Identify the Find Potential Exploit Attack Surface Vulnerabilities Attack Vectors
  • 13.
    Let’s Do It! •Sieve is a Password Manager • It’s installed in an Android 4.1.2 emulator, along with the Mercury Agent.
  • 14.
  • 15.
    Summary • We seemto have largely forgotten security when developing Android apps. • These vulnerabilities expose our users and businesses to risk. • We can use Mercury to discover all sorts of Android vulnerabilities.
  • 16.