SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
Deep	
  Dive	
  into	
  Android	
  Security	
  
        by	
  Aleksandar	
  Gargenta,	
  Marakana	
  Inc.	
  




                       video/slides	
  at	
  
               h>p://mrkn.co/andsec	
  
About	
  Aleksandar	
  (Saša)	
  Gargenta	
  
•  Developing	
  in	
  Java	
  since	
  1996	
  –	
  mostly	
  server-­‐side	
  
•  Hacking	
  Android	
  since	
  2008	
  –	
  from	
  the	
  SDK	
  to	
  the	
  kernel	
  
•  Teaching	
  Java,	
  Android,	
  etc.	
  at	
  Marakana	
  since	
  2005	
  
      –  h>p://marakana.com/	
  
•  Founder	
  &	
  Organizer	
  of	
  San	
  Francisco	
  Java	
  User	
  Group	
  	
  
      –  h>p://www.sXava.org/	
  
•  Founder	
  &	
  Organizer	
  of	
  San	
  Francisco	
  Android	
  User	
  Group	
  	
  
      –  h>p://www.sfandroid.org/	
  
•  Co-­‐founder	
  &	
  co-­‐organizer	
  of	
  San	
  Francisco	
  HTML5	
  User	
  Group	
  
      –  h>p://www.s[tml5.org/	
  
•  Wri]ng	
  Android	
  Internals	
  for	
  O'Reilly	
  (ETA?	
  yesterday)	
  
•  Worked	
  on	
  SMS,	
  MMS,	
  WAP	
  Push,	
  but	
  also	
  Linux	
  and	
  system	
  
   administra]on	
  in	
  past	
  life	
  
Overview	
  
•    Why	
  care?	
  
•    Android	
  Security	
  Model	
  
•    Permissions	
  on	
  Android	
  
•    Encryp]on	
  on	
  Android	
  
•    Device	
  Admin	
  
•    Roo]ng	
  Android	
  Devices	
  
•    An]-­‐roo]ng?	
  ASLR?	
  SE-­‐Linux?	
  Locking	
  bootloaders?	
  
•    Tap-­‐jacking	
  
•    Developer	
  Best	
  Prac]ces	
  
•    Other	
  concerns	
  
Why	
  Care?	
  
"   "Scary	
  Android	
  security	
  hole	
  in	
  99%	
  of	
  phones:	
  PANIC!"	
  
    –	
  Computerworld	
  
"   "HTC	
  promises	
  fix	
  for	
  massive	
  Android	
  security	
  flaw"	
  –	
  
    MobileBeat	
  
"   "Android	
  users	
  are	
  two	
  and	
  a	
  half	
  ]mes	
  as	
  likely	
  to	
  
    encounter	
  malware	
  today	
  than	
  6	
  months	
  ago…"	
  –	
  
    Lookout	
  Mobile	
  Threat	
  Report	
  
"   "Today’s	
  mobile	
  devices	
  are	
  a	
  mixed	
  bag	
  when	
  it	
  
    comes	
  to	
  security…	
  s]ll	
  vulnerable	
  to	
  many	
  tradi]onal	
  
    a>acks….”	
  -­‐	
  Carey	
  Nachenberg,	
  Symantec	
  
"   "Android	
  Security	
  Will	
  Be	
  Big	
  News	
  in	
  2011:	
  10	
  
    Reasons	
  Why"	
  -­‐	
  eWeek	
  
"   "The	
  growth	
  rate	
  in	
  malware	
  within	
  Android	
  is	
  huge;	
  in	
  
    the	
  future	
  there	
  will	
  definitely	
  be	
  more."	
  -­‐	
  Nikolay	
  
    Grebennikov,	
  CTO	
  of	
  Kaspersky	
  
"   "Any	
  ]me	
  a	
  technology	
  becomes	
  adopted	
  and	
  popular,	
  
    that	
  technology	
  will	
  be	
  targeted	
  by	
  the	
  bad	
  guys."	
  -­‐	
  Jay	
  
    Abbo>,	
  PricewaterhouseCoopers	
  LLP	
  
Founda]ons	
  of	
  Android	
  Security	
  	
  
•  Applica]on	
  Isola&on	
  and	
  Permission-­‐Control	
  
    –  Can	
  we	
  control	
  what	
  applica]ons	
  are	
  able	
  to	
  do?	
  
    –  Can	
  a	
  misbehaving	
  app	
  affect	
  the	
  rest	
  of	
  the	
  system?	
  
•  Applica]on	
  "Provenance"	
  
    –  Can	
  we	
  trust	
  the	
  author	
  of	
  an	
  app?	
  
    –  Can	
  we	
  trust	
  our	
  apps	
  to	
  be	
  tamper-­‐resistant?	
  
•  Data	
  Encryp&on	
  
    –  Is	
  our	
  data	
  safe	
  if	
  our	
  device	
  is	
  hacked/lost/stolen?	
  	
  
•  Device	
  Access	
  Control	
  
    –  Can	
  we	
  protect	
  our	
  device	
  against	
  unauthorized	
  use?	
  
Android	
  Stack	
  (revisited)	
  
                                   Applications

                                                                            Content
       Home         Contacts           Phone          Browser
                                                                           Providers



                               Application Framework

      Activity      Window             Vibrator            WiFi               Battery
      Service       Service            Service            Service             Service

     Package       Telephony          Resource            Location         Notification
     Service        Service           Manager             Service           Service



                                   Native Layer
    Surface        Media                                             Android Runtime
                                  SQLite           SSL
    Manager      Framework

                                                                        Core Libs
    OpenGL         vold            netd           WebKit

                                                                          Dalvik
     libwifi      libcamera         libgps          libc                    VM




       Display       Camera        Linux Kernel             GPS               Binder
       Driver         Driver                                Driver            Driver

       Keypad         WiFi                                  Audio             Power
        Driver        Driver                                Driver            Mgmt
Android	
  Applica]on	
  Isola]on	
  
Android	
  Applica]on	
  Isola]on	
  
•  By	
  default,	
  each	
  app	
  runs	
  in	
  a	
  separate	
  process	
  with	
  a	
  
   dis]nct	
  user/group	
  ID	
  (fixed	
  for	
  the	
  life]me	
  of	
  the	
  app)	
  
     –  Possible	
  for	
  mul]ple	
  apps	
  to	
  share	
  UID	
  and	
  process	
  
     –  Based	
  on	
  decades-­‐old,	
  well-­‐understood	
  UNIX	
  security	
  
        model	
  (processes	
  and	
  file-­‐system	
  permissions)	
  
•  Applica]on-­‐framework	
  services	
  also	
  run	
  in	
  a	
  separate	
  
   process	
  (system_server)	
  
•  Linux	
  kernel	
  is	
  the	
  sole	
  mechanism	
  of	
  app	
  sandboxing	
  
•  Dalvik	
  VM	
  is	
  not	
  a	
  security	
  boundary	
  
     –  Coding	
  in	
  Java	
  or	
  C/C++	
  code	
  –	
  no	
  difference	
  
     –  Enables	
  use	
  of	
  JNI	
  (unlike	
  JavaME!)	
  
•  Same	
  rules	
  apply	
  to	
  system	
  apps	
  
Default	
  Android	
  Permissions	
  Policy	
  
Default	
  Android	
  Permissions	
  Policy	
  
•  No	
  app	
  can	
  do	
  anything	
  to	
  adversely	
  affect	
  
     –  Other	
  apps	
  
     –  The	
  system	
  itself	
  
     –  The	
  user	
  of	
  the	
  device	
  
•  So,	
  by	
  default,	
  apps	
  cannot:	
  
     –  Read*/write	
  files	
  outside	
  their	
  own	
  directory	
  
     –  Install/uninstall/modify	
  other	
  apps	
  
     –  Use	
  other	
  apps'	
  private	
  components	
  
     –  Access	
  network	
  
     –  Access	
  user's	
  data	
  (contacts,	
  SMS,	
  email)	
  
     –  Use	
  cost-­‐sensi]ve	
  APIs	
  (make	
  phone	
  calls,	
  send	
  SMS,	
  NFC)	
  
     –  Keep	
  device	
  awake,	
  automa]cally	
  start	
  on	
  boot,	
  etc.	
  
Escaping	
  The	
  Sandbox	
  
•  Actually,	
  apps	
  can*	
  talk	
  to	
  
   other	
  apps	
  via	
  
    –  Intents	
  
    –  IPC	
  (a.k.a.	
  Binder)	
  
    –  ContentProviders	
  
•  Otherwise,	
  to	
  escape	
  our	
  
   sandbox,	
  we	
  need	
  to	
  use	
  
   permissions	
  
    –  Some	
  permissions	
  are	
  only	
  	
  
       available	
  to	
  system	
  apps	
  
Built-­‐in	
  Android	
  Permissions	
  
ACCESS_FINE_LOCATION,	
  ACCESS_NETWORK_STATE,	
  
ACCESS_WIFI_STATE,	
  ACCOUNT_MANAGER,	
  
BLUETOOTH,	
  BRICK,	
  CALL_PHONE,	
  CAMERA,	
  
CHANGE_WIFI_STATE,	
  DELETE_PACKAGES,	
  
INSTALL_PACKAGES,	
  INTERNET,	
  MANAGE_ACCOUNTS,	
  
MASTER_CLEAR,	
  READ_CONTACTS,	
  READ_LOGS,	
  
READ_SMS,	
  RECEIVE_SMS,	
  RECORD_AUDIO,	
  
SEND_SMS,	
  VIBRATE,	
  WAKE_LOCK,	
  WRITE_CONTACTS,	
  
WRITE_SETTINGS,	
  WRITE_SMS,	
  …	
  
h>p://developer.android.com/reference/android/Manifest.permission.html	
  
Example:	
  Buddy	
  Tickler	
  App	
  
•  For	
  example,	
  an	
  app	
  that	
  vibrates	
  your	
  phone	
  any	
  
   ]me	
  you	
  get	
  in	
  close	
  vicinity	
  to	
  a	
  friend	
  would	
  
   need	
  to	
  use	
  at	
  least	
  the	
  following	
  permissions:
•  App's	
  AndroidManifest.xml:
   <manifest package="com.marakana.android.trackapp" …>
    <uses-permission
      android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission
      android:name="android.permission.INTERNET" />
    <uses-permission
      android:name="android.permission.VIBRATE" />
    …
   </manifest>
Logical	
  Permission	
  Enforcement	
  
          FooUsingApp                                             system_server


               Dalvik VM                                            Dalvik VM
                                             Android
                                            Permission
      FooConsumingActivity                    Check                FooService




    FooNative        FooManager                                     FooNative




    libfoo_jni                              Provides                libfoo_jni
                                            UID/PID


      libfoo                                                          libfoo




                                                             File Permission Granted
                                    File Permission Denied


                                                                     /dev/foo
                      /dev/binder                                       or
                                                                 /sys/foo/enable
                                                Kernel
Permission	
  Enforcement	
  Example	
  
•  Only	
  the	
  system	
  user	
  (i.e.	
  SS	
  proc)	
  can	
  write	
  to	
  the	
  vibrator	
  driver:
     $ adb shell ls -l /sys/class/timed_output/vibrator/enable
     -rw-r--r-- system   system       4096 2011-09-30 23:23 enable

•  Only	
  apps	
  with	
  android.permission.VIBRATE	
  permissions	
  can	
  
   access VibratorSevice.vibrate(…)	
  method:
     frameworks/base/services/java/com/android/server/VibratorService.java
     package com.android.server;
     …
     public class VibratorService extends IVibratorService.Stub {
       …
       public void vibrate(long milliseconds, IBinder token) {
         if (mContext.checkCallingOrSelfPermission(
               android.Manifest.permission.VIBRATE)
                 != PackageManager.PERMISSION_GRANTED) {
           throw new SecurityException(
             "Requires VIBRATE permission");
         }
         …
       }
       …
     }
Kernel	
  Permission	
  Enforcement	
  
•  Some	
  Android	
  permissions	
  directly	
  map	
  to	
  group	
  IDs,	
  which	
  are	
  then	
  
   enforced	
  by	
  the	
  kernel/FS:	
  
    /system/etc/permissions/platform.xml:	
  
    <permissions>
      …
      <permission name="android.permission.INTERNET" >
        <group gid="inet" />
      </permission>
      <permission name="android.permission.CAMERA" >
         <group gid="camera" />
      </permission>
      <permission name="android.permission.READ_LOGS" >
         <group gid="log" />
      </permission>
      <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
         <group gid="sdcard_rw" />
      </permission>
      …
    </permissions>
•  Interes]ng	
  example:	
  android.permission.INTERNET -> inet
   -> 3003 -> ANDROID_PARANOID_NETWORK	
  (kernel	
  patch)	
  
Permission	
  Gran]ng	
  
•  Permissions	
  are	
  granted	
  once,	
  at	
  the	
  
   applica]on	
  install	
  ]me	
  
     –  Ok,	
  updates	
  too	
  
     –  One	
  excep]on,	
  URI	
  permissions	
  
•  All-­‐or-­‐nothing!	
  
•  But,	
  can	
  a	
  novice	
  any	
  user	
  tell	
  whether	
  
   the	
  combina]on	
  of	
  requested	
  
   permissions	
  is	
  OK?	
  (Can	
  you?)	
  
     –  Permissions	
  marked	
  as	
  "normal"	
  are	
  
        hidden	
  behind	
  "See	
  all"	
  
•  What	
  about	
  combo	
  of	
  permissions	
  
   across	
  different	
  apps	
  from	
  the	
  same	
  
   (malicious)	
  author?	
  (Apps	
  can	
  share)	
  
Permission	
  Gran]ng,	
  Alterna]ves?	
  
•  Switch	
  to	
  dynamically	
  gran]ng	
  permissions	
  on	
  
   use	
  or	
  on	
  start	
  of	
  each	
  app	
  ("session")?	
  
    –  Annoying	
  
    –  Hard	
  to	
  provide	
  seamless	
  app-­‐switching	
  
    –  Over-­‐promp]ng	
  leads	
  to	
  a	
  condi]oned-­‐response	
  
    –  Users	
  already	
  commi>ed	
  to	
  the	
  app	
  
•  Cannot	
  make	
  informed-­‐decisions	
  on	
  whether	
  to	
  
   grant	
  permissions?	
  Let	
  app	
  ra]ngs	
  +	
  comments	
  
   from	
  "sophis]cated"	
  users	
  on	
  Market	
  help	
  
Applica]on	
  Provenance	
  
•  Can	
  we	
  trust	
  the	
  developer	
  of	
  an	
  applica]on	
  
   we	
  are	
  about	
  to	
  install?	
  (mostly,	
  no)	
  
•  Can	
  we	
  trust	
  that	
  our	
  apps	
  are	
  resistant	
  to	
  
   tampering	
  once	
  installed?	
  (mostly,	
  yes)	
  
•  To	
  get	
  onto	
  Android	
  Market,	
  a	
  developer	
  just	
  
   needs	
  to	
  register	
  with	
  Google	
  and	
  pay	
  $25	
  
   with	
  a	
  valid	
  credit	
  card	
  
    –  A	
  mild	
  deterrent	
  against	
  authors	
  of	
  malicious	
  apps	
  
•  Apps	
  can	
  also	
  be	
  side-­‐loaded	
  (not	
  on	
  AT&T)	
  
Applica]on	
  Provenance	
  (Signing)	
  
•  All	
  apps	
  (.apk	
  files)	
  must	
  be	
  digitally	
  signed	
  prior	
  to	
  
   installa]on	
  on	
  a	
  device	
  (and	
  uploading	
  to	
  Android	
  
   Market)	
  
•  The	
  embedded	
  cer]ficate	
  can	
  be	
  self-­‐signed	
  (no	
  CA	
  
   needed!)	
  and	
  valid	
  for	
  25+	
  years	
  
•  App	
  signing	
  on	
  Android	
  is	
  used	
  to:	
  
     –  Ensure	
  the	
  authen]city	
  of	
  the	
  author	
  on	
  the	
  first	
  install	
  
     –  Ensure	
  the	
  authen]city	
  of	
  the	
  author	
  on	
  updates	
  
     –  Establish	
  trust	
  rela&onship	
  among	
  apps	
  signed	
  with	
  the	
  
        same	
  key	
  (share	
  permissions,	
  UID,	
  process)	
  
     –  Make	
  app	
  contents	
  tamper-­‐resistant	
  (moot	
  point)	
  
•  An	
  app	
  can	
  be	
  signed	
  with	
  mul]ple	
  keys	
  
Applica]on	
  Provenance	
  (Signing)	
  
•  Lost/expired	
  key?	
  No	
  way	
  to	
  
   update	
  the	
  app(s)	
  
•  Stolen	
  key?	
  No	
  way	
  to	
  revoke	
  
•  How	
  do	
  we	
  trust	
  the	
  author	
  on	
  
   the	
  first	
  install?	
  
    –  Is	
  this	
  the	
  real	
  author,	
  or	
  an	
  
       imposter?	
  Can	
  I	
  check	
  the	
  cert?	
  
    –  Has	
  this	
  app	
  been	
  ve>ed?	
  
    –  Go	
  by	
  the	
  number	
  of	
  installs?	
  
         •  Follow	
  the	
  sheep?	
  
Applica]on	
  Provenance	
  (Signing)	
  
•  The	
  result?	
  
    "   Android.Rootcager	
  
    "   Android.Pjapps	
  
    "   Android.Bgserv	
  
•  All	
  took	
  advantage	
  of	
  weak	
  trust	
  rela]onship	
  
    ①    Take	
  an	
  exis]ng	
  (popular)	
  app	
  
    ②    Inject	
  malicious	
  code	
  (e.g.	
  a	
  trojan)	
  
    ③    Re-­‐package	
  and	
  re-­‐sign	
  with	
  a	
  new	
  key/cert	
  
    ④    Upload	
  to	
  market	
  (or	
  distribute	
  via	
  web)	
  
    ⑤    Wait	
  for	
  the	
  "sheep"	
  to	
  come	
  (not	
  really	
  our	
  fault)	
  
Safeguarding	
  Apps'	
  Data	
  
•  Apps'	
  files	
  are	
  private	
  by	
  default	
  
    –  Owned	
  by	
  dis]nct	
  apps'	
  UIDs	
  
•  Excep]ons	
  
    –  Apps	
  can	
  create	
  files	
  that	
  are	
  
         •  MODE_WORLD_READABLE
         •  MODE_WORLD_WRITABLE
    –  Other	
  apps	
  (signed	
  with	
  the	
  same	
  key)	
  can	
  run	
  with	
  
       the	
  same	
  UID	
  –	
  thereby	
  gexng	
  access	
  to	
  shared	
  files	
  
    –  /mnt/sdcard	
  is	
  world-­‐readable	
  and	
  world-­‐writable	
  
       (with	
  WRITE_TO_EXTERNAL_STORAGE)	
  
Data	
  Encryp]on	
  
 VPN	
  (IPSEC)	
  with	
  3DES	
  and	
  AES	
  and	
  cert	
  auth.	
  
      VPN	
  Client	
  API	
  available	
  as	
  of	
  ICS/4.0	
  
 802.11	
  with	
  WPA/2	
  and	
  cert	
  auth.	
  
 OpenSSL	
  
 JCE	
  (based	
  on	
  BouncyCastle	
  provider)	
  
      Apache	
  HTTP	
  Client	
  (suppor]ng	
  SSL)	
  
      java.net.H>psUrlConnec]on	
  
     –  Using	
  encryp]on	
  well	
  is	
  non-­‐trivial	
  (e.g.	
  IV)	
  
     –  Does	
  not	
  help	
  if	
  the	
  key	
  is	
  stored	
  on	
  the	
  device	
  
 Keychain	
  API	
  –	
  apps	
  can	
  install	
  and	
  store	
  user	
  
  cer]ficates	
  and	
  CAs	
  securely	
  as	
  of	
  ICS/4.0	
  
 Whole-­‐disk	
  encryp]on	
  (requires	
  >=	
  3.0)	
  
Whole	
  Disk	
  Encryp]on	
  
•  Se/ngs	
  →	
  Loca3on	
  &	
  Security	
  →	
  Encryp3on	
  →	
  Encrypt	
  
   tablet	
  
     –  Requires	
  screen-­‐lock	
  password	
  
     –  Encrypts	
  /data	
  par]]on	
  with	
  AES128	
  with	
  CBC	
  and	
  
        ESSIV:SHA256	
  (password	
  combined	
  with	
  salt	
  then	
  SHA1'd)	
  
     –  Disabling	
  encryp]on	
  requires	
  device	
  master	
  reset	
  	
  
•  Based	
  on	
  Linux'	
  dm-­‐crypt	
  kernel	
  feature	
  	
  
     –  /data	
  as	
  an	
  encrypted	
  block	
  device	
  (/dev/block/dm-0)	
  
•  User-­‐password	
  used	
  directly	
  (change	
  requires	
  re-­‐encrypt!)	
  
•  Not	
  hardware-­‐accelerated:	
  54%	
  degrada]on	
  in	
  I/O	
  read	
  
   performance	
  on	
  Samsung	
  Galaxy	
  Tab	
  10.1	
  
•  Vulnerable	
  to	
  "Evil	
  maid	
  a>ack"	
  and	
  cold-­‐boot	
  a>acks	
  
Digital	
  Rights	
  Management	
  
•  Android	
  provides	
  a	
  
   pluggable	
  DRM	
  
   framework	
  (API	
  >=	
  11)	
  
•  Actual	
  schemes	
  
   provided	
  by	
  OEMs	
  
•  Hides	
  complexity	
  of	
  	
  
   DRM	
  when	
  accessing	
  
   rights-­‐protected	
  (or	
  
   plain)	
  content	
  under	
  
   various	
  schemes	
  
[Physical]	
  Access	
  Control	
  
•  Screen	
  unlock	
  pa>ern,	
  pin,	
  
   password	
  
•  More	
  op]ons	
  with	
  device	
  admin	
  
   (including	
  password	
  expira]on,	
  
   encryp]on,	
  auto-­‐device-­‐wipe,	
  etc.)	
  
•  Low-­‐level	
  access	
  to	
  SIM	
  card	
  is	
  not	
  
   available	
  to	
  apps	
  
•  But:	
  
     "   SIM/SD	
  Card	
  can	
  be	
  simply	
  ejected,	
  
         bypassing	
  screen	
  unlock	
  
     "   Cold-­‐boot	
  a>acks	
  
 Taking	
  Android	
  To	
  Work:	
  Device	
  Admin	
  
Roo]ng	
  
•  Why	
  root?	
  
     –  Access	
  to	
  custom	
  ROMs	
  
     –  Reuse	
  old	
  hardware	
  
     –  Remove	
  offending	
  system	
  apps	
  
     –  Get	
  more	
  speed	
  
     –  Get	
  be>er	
  looks	
  
     –  Because	
  it's	
  cool	
  
     –  Rootkit	
  	
  
•  But,	
  it	
  comes	
  at	
  a	
  price	
  	
  
Roo]ng:	
  How-­‐to	
  
1.  Exploit	
  a	
  weakness	
  of	
  the	
  
    exis]ng	
  ROM	
  to	
  gain	
  root	
  
2.  Flash	
  the	
  recovery	
  par]]on	
  
    with	
  an	
  alterna]ve	
  image	
  	
  
3.  Download	
  an	
  alterna]ve	
  compa]ble	
  ROM	
  
    (already	
  rooted)	
  onto	
  the	
  /sdcard
4.  Reboot	
  into	
  recovery,	
  and	
  flash	
  the	
  new	
  ROM	
  
5.  Get	
  root	
  at	
  any	
  ]me	
  with	
  Superuser.apk
    +	
  /system/bin/su
•  Or,	
  as	
  easy	
  as:	
  $ fastboot oem unlock
Gexng	
  Root	
  
•  exploid:	
  exploit	
  a	
  bug	
  in	
  udev	
  (on	
  Android	
  
   init/ueventd)	
  to	
  pass	
  a	
  fake	
  message	
  
   (NETLINK_KOBJECT_UEVENT)	
  with	
  
   executable	
  FIRMWARE	
  code	
  to	
  run	
  as	
  root	
  
•  rageagains<hecage:	
  exploit	
  a	
  race-­‐condi]on	
  in	
  
   adbd	
  to	
  preempt	
  its	
  call	
  to	
  setuid()	
  (to	
  shell	
  
   user)	
  leaving	
  it	
  running	
  as	
  root	
  
•  so>break/gingerbreak:	
  exploit	
  a	
  buffer-­‐overrun	
  
   condi]on	
  in	
  vold	
  (which	
  runs	
  as	
  root)	
  to	
  execute	
  
   arbitrary	
  code	
  as	
  root	
  
•  …	
  
Dangers	
  of	
  Roo]ng	
  
•    App	
  isola]on	
  
•    System/app	
  permissions	
  
•    Data-­‐safeguards	
  +	
  encryp]on	
  
•    Device	
  administra]on	
  
•    …	
  
     all	
  fall-­‐apart	
  when	
  we	
  allow	
  un-­‐trusted	
  code	
  to	
  run	
  
       as	
  root	
  (this	
  is	
  what	
  malicious	
  apps	
  do)	
  
Memory	
  Security	
  Protec]on	
  
•  Hardware-­‐based	
  No	
  eXecute	
  (NX)	
  to	
  prevent	
  code	
  
   execu]on	
  on	
  the	
  stack	
  and	
  heap	
  
•  ProPolice	
  to	
  prevent	
  stack	
  buffer	
  overruns	
  
•  safe_iop	
  to	
  reduce	
  integer	
  overflows	
  
•  Extensions	
  to	
  OpenBSD	
  dlmalloc	
  to	
  prevent	
  double	
  
   free()	
  vulnerabili]es	
  and	
  to	
  prevent	
  chunk	
  consolida]on	
  
   a>acks	
  (against	
  heap	
  corrup]on)	
  
•  OpenBSD	
  calloc	
  to	
  prevent	
  integer	
  overflows	
  during	
  
   memory	
  alloca]on	
  
•  Linux	
  mmap_min_addr()	
  to	
  mi]gate	
  null	
  pointer	
  
   dereference	
  privilege	
  escala]on	
  
•  But,	
  what	
  about	
  shared	
  libraries?	
  
Address	
  Space	
  Layout	
  Randomiza]on	
  
•  Shared	
  libraries	
  on	
  Android	
  are	
  pre-­‐linked*:	
  their	
  
   address	
  are	
  fixed,	
  for	
  performance	
  reasons	
  
•  Successful	
  memory	
  corrup]on	
  a>acks	
  can	
  easily	
  return	
  
   to	
  libc	
  (i.e.	
  execute	
  arbitrary	
  code)	
  
•  ASLR	
  on	
  Android	
  ( just	
  a	
  proposal	
  at	
  this	
  ]me):	
  
     –  Randomize	
  offsets	
  to	
  shared	
  libs	
  and	
  executables	
  at	
  system	
  
        upgrade-­‐]me	
  
     –  Record	
  offsets	
  to	
  undo	
  randomiza]on	
  for	
  OTA	
  updates	
  	
  
     –  Detect	
  brute-­‐force	
  guessing	
  with	
  cloud-­‐based	
  analysis	
  
•  h>p://bojinov.org/professional/wisec2011-­‐mobileaslr-­‐
   paper.pdf	
  
•  ASLR	
  is	
  finally	
  a	
  standard	
  in	
  ICS/4.0	
  (*	
  no	
  pre-­‐linking?)	
  
SE-­‐Linux	
  on	
  Android	
  
•  SELinux	
  allows	
  us	
  to	
  run	
  OS	
  services	
  with	
  
   minimum	
  privileges	
  (i.e.	
  not	
  root)	
  
     –  Heavy	
  use	
  on	
  the	
  desktop/server-­‐side	
  
•  SELinux	
  on	
  Android	
  is	
  possible,	
  but	
  hard	
  
     –  Slow	
  
     –  Requires	
  rethinking	
  on	
  the	
  security	
  model	
  for	
  easier	
  
        configura]on	
  
     –  Does	
  not	
  support	
  yaffs2	
  
•  Folks	
  at	
  Hitachi	
  got	
  it	
  to	
  work,	
  but	
  it	
  seems	
  stalled	
  
Tap-­‐Jacking	
  on	
  Android	
  
•  A	
  malicious	
  app	
  starts	
  a	
  security-­‐
   sensi]ve	
  (e.g.	
  system	
  sexngs)	
  ac]vity	
  
•  It	
  then	
  overlays	
  a	
  full-­‐screen	
  custom	
  
   no]fica]on	
  dialog	
  on	
  top	
  of	
  the	
  
   targeted	
  ac]vity	
  (like	
  a	
  game)	
  –	
  works	
  
   like	
  Toasts	
  
•  User	
  interacts	
  with	
  the	
  custom	
  
   no]fica]on	
  dialog,	
  but	
  her	
  touch	
  events	
  
   are	
  passed	
  down	
  to	
  the	
  legi]mate	
  
   ac]vity	
  
•  In	
  API	
  >=9	
  prevent	
  with	
  XML	
  a>r	
  on	
  UI	
  
   filterTouchesWhenObscured	
  
   (or	
  programma]cally)	
  
Developer	
  Best	
  Prac]ces	
  
•  Avoid	
  building	
  apps	
  that	
  require	
  root	
  
•  If	
  you	
  are	
  using	
  encryp]on,	
  be	
  sure	
  to	
  know	
  what	
  
   you	
  are	
  doing	
  (e.g.	
  use	
  IVs)	
  
•  Mark	
  your	
  applica]on's	
  components	
  as	
  
   android:exported="false"	
  unless	
  you	
  
   are	
  specifically	
  building	
  them	
  for	
  public	
  use	
  
    –  Don't	
  trust	
  Intent	
  inputs/results	
  (especially	
  pending)	
  
    –  Don't	
  leak	
  broadcast	
  events	
  you	
  are	
  sending	
  out	
  
    –  Use	
  custom	
  permissions	
  to	
  control	
  access	
  
Custom	
  Permissions	
  
<manifest … package="com.marakana.myapp" >
  <permission
    android:name="co.mrkn.perm.GET_PASSWORD"
    android:label="@string/get_password_label"
    android:description="@string/get_password_desc"
    android:permissionGroup=
      "android.permission-group.PERSONAL_INFO"
    android:protectionLevel="dangerous" />
  …
</manifest>
Requiring	
  Permissions	
  
•  Sta]cally,	
  in	
  AndroidManifest.xml	
  on	
  our	
  
   applica]on	
  components	
  via	
  a>ributes	
  
    –  android:permission	
  	
  
    –  android:readPermission
    –  android:writePermission
•  Dynamically,	
  on	
  broadcast	
  senders	
  via	
  
    –  aContext.registerReceiver(BroadcastReceiver,
       String, Handler)
•  Dynamically,	
  in	
  bound-­‐services	
  via	
  
    –  aContext.checkCallingPermission(String)	
  
    –  aContext.enforceCallingOrSelfPermission(String)
An]-­‐malware	
  
•  Use	
  PackageManager.getInstalledPackages(int)	
  for	
  
   the	
  ini]al	
  scan	
  of	
  apps/packages	
  against	
  a	
  known	
  black-­‐list	
  
      –  E.g.	
  check	
  for	
  package	
  names,	
  permissions,	
  signatures	
  
•  Listen	
  for	
  android.intent.action.PACKAGE_ADDED	
  
   broadcasts	
  and	
  verify	
  new	
  apps	
  
•  Once	
  a	
  malicious	
  app	
  is	
  found,	
  offer	
  the	
  user	
  a	
  chance	
  to	
  delete	
  it:	
  
   Uri packageURI =
       Uri.parse("package:com.malicous.app");
   Intent uninstallIntent =
       new Intent(
            Intent.ACTION_DELETE, packageURI);
   startActivity(uninstallIntent);	
  
•  For	
  personal	
  use,	
  consider	
  something	
  like:	
  	
  
      –  Lookout	
  Security	
  &	
  An3virus	
  
      –  Norton	
  Mobile	
  Security	
  
Other	
  Security	
  Concerns	
  
•    Push-­‐based	
  install	
  from	
  Android	
  Market	
  (GMail)	
  
•    Social-­‐engineering	
  
•    Firewall	
  
•    Encryp]on	
  of	
  communica]on	
  
•    Compromised	
  pla€orm	
  keys	
  
•    App	
  obfusca]on	
  
•    Protec]ng	
  bootloader/recovery	
  
•    Security	
  of	
  skins	
  
•    OEM/Carrier	
  OS	
  upgrade	
  cycles	
  
Thank	
  You!	
  
•  Ques]ons?	
  
•  More	
  info:	
  
    –  h>p://mrkn.co/andsec	
  (video	
  of	
  this	
  talk)	
  
    –  h>p://source.android.com/tech/encryp]on/
       android_crypto_implementa]on.html	
  
    –  h>p://www.symantec.com/about/news/release/
       ar]cle.jsp?prid=20110627_02	
  
•  Contact	
  Info:	
  
    –  h>p://marakana.com/	
  
    –  sasa@marakana.com	
  
    –  @agargenta	
  on	
  Twi>er	
  
    –  aleksandar.gargenta@gmail.com	
  on	
  Google+	
  

Weitere ähnliche Inhalte

Was ist angesagt?

Understanding Android Security
Understanding Android SecurityUnderstanding Android Security
Understanding Android SecurityAsanka Dilruk
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessNanik Tolaram
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
 
Understanding android security model
Understanding android security modelUnderstanding android security model
Understanding android security modelPragati Rai
 
ABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughBenjamin Zores
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with PieOpersys inc.
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Opersys inc.
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)Nanik Tolaram
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
Android Automotive
Android AutomotiveAndroid Automotive
Android AutomotiveOpersys inc.
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security InternalsOpersys inc.
 
Android Security & Penetration Testing
Android Security & Penetration TestingAndroid Security & Penetration Testing
Android Security & Penetration TestingSubho Halder
 

Was ist angesagt? (20)

Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Understanding Android Security
Understanding Android SecurityUnderstanding Android Security
Understanding Android Security
 
Android Security
Android SecurityAndroid Security
Android Security
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
 
Understanding android security model
Understanding android security modelUnderstanding android security model
Understanding android security model
 
ABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting Walkthrough
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?
 
Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Android Automotive
Android AutomotiveAndroid Automotive
Android Automotive
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security Internals
 
Android Security & Penetration Testing
Android Security & Penetration TestingAndroid Security & Penetration Testing
Android Security & Penetration Testing
 

Andere mochten auch

Permission in Android Security: Threats and solution
Permission in Android Security: Threats and solutionPermission in Android Security: Threats and solution
Permission in Android Security: Threats and solutionTandhy Simanjuntak
 
Testing Android Security Codemotion Amsterdam edition
Testing Android Security Codemotion Amsterdam editionTesting Android Security Codemotion Amsterdam edition
Testing Android Security Codemotion Amsterdam editionJose Manuel Ortega Candel
 
Android security model
Android security modelAndroid security model
Android security modelrrand1
 
Android Security - Common Security Pitfalls in Android Applications
Android Security - Common Security Pitfalls in Android ApplicationsAndroid Security - Common Security Pitfalls in Android Applications
Android Security - Common Security Pitfalls in Android ApplicationsBlrDroid
 
[Wroclaw #1] Android Security Workshop
[Wroclaw #1] Android Security Workshop[Wroclaw #1] Android Security Workshop
[Wroclaw #1] Android Security WorkshopOWASP
 
Analysis and research of system security based on android
Analysis and research of system security based on androidAnalysis and research of system security based on android
Analysis and research of system security based on androidRavishankar Kumar
 
Security threats in Android OS + App Permissions
Security threats in Android OS + App PermissionsSecurity threats in Android OS + App Permissions
Security threats in Android OS + App PermissionsHariharan Ganesan
 
Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...
Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...
Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...Cheng-Yi Yu
 
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...
Consulthink @ GDG Meets U -  L'Aquila2014  - Codelab: Android Security -Il ke...Consulthink @ GDG Meets U -  L'Aquila2014  - Codelab: Android Security -Il ke...
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...Consulthinkspa
 
2015.04.24 Updated > Android Security Development - Part 1: App Development
2015.04.24 Updated > Android Security Development - Part 1: App Development 2015.04.24 Updated > Android Security Development - Part 1: App Development
2015.04.24 Updated > Android Security Development - Part 1: App Development Cheng-Yi Yu
 
Android Security Development
Android Security DevelopmentAndroid Security Development
Android Security Developmenthackstuff
 
Android - Model Architecture
Android - Model ArchitectureAndroid - Model Architecture
Android - Model Architecturerendra toro
 
Security testing of mobile applications
Security testing of mobile applicationsSecurity testing of mobile applications
Security testing of mobile applicationsGTestClub
 
Keep calm and write reusable code in Android
Keep calm and write reusable code in AndroidKeep calm and write reusable code in Android
Keep calm and write reusable code in AndroidJuan Camilo Sacanamboy
 
Pentesting con android - Nipper Toolkit Web Scan
Pentesting con android - Nipper Toolkit Web ScanPentesting con android - Nipper Toolkit Web Scan
Pentesting con android - Nipper Toolkit Web ScanDylan Irzi
 

Andere mochten auch (19)

Permission in Android Security: Threats and solution
Permission in Android Security: Threats and solutionPermission in Android Security: Threats and solution
Permission in Android Security: Threats and solution
 
Android sandbox
Android sandboxAndroid sandbox
Android sandbox
 
Brief Tour about Android Security
Brief Tour about Android SecurityBrief Tour about Android Security
Brief Tour about Android Security
 
Testing Android Security Codemotion Amsterdam edition
Testing Android Security Codemotion Amsterdam editionTesting Android Security Codemotion Amsterdam edition
Testing Android Security Codemotion Amsterdam edition
 
Android security model
Android security modelAndroid security model
Android security model
 
Android Security - Common Security Pitfalls in Android Applications
Android Security - Common Security Pitfalls in Android ApplicationsAndroid Security - Common Security Pitfalls in Android Applications
Android Security - Common Security Pitfalls in Android Applications
 
[Wroclaw #1] Android Security Workshop
[Wroclaw #1] Android Security Workshop[Wroclaw #1] Android Security Workshop
[Wroclaw #1] Android Security Workshop
 
Android system security
Android system securityAndroid system security
Android system security
 
Analysis and research of system security based on android
Analysis and research of system security based on androidAnalysis and research of system security based on android
Analysis and research of system security based on android
 
Security threats in Android OS + App Permissions
Security threats in Android OS + App PermissionsSecurity threats in Android OS + App Permissions
Security threats in Android OS + App Permissions
 
Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...
Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...
Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...
 
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...
Consulthink @ GDG Meets U -  L'Aquila2014  - Codelab: Android Security -Il ke...Consulthink @ GDG Meets U -  L'Aquila2014  - Codelab: Android Security -Il ke...
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...
 
2015.04.24 Updated > Android Security Development - Part 1: App Development
2015.04.24 Updated > Android Security Development - Part 1: App Development 2015.04.24 Updated > Android Security Development - Part 1: App Development
2015.04.24 Updated > Android Security Development - Part 1: App Development
 
Android Security Development
Android Security DevelopmentAndroid Security Development
Android Security Development
 
Android - Model Architecture
Android - Model ArchitectureAndroid - Model Architecture
Android - Model Architecture
 
Security testing of mobile applications
Security testing of mobile applicationsSecurity testing of mobile applications
Security testing of mobile applications
 
PPT_Compiled
PPT_CompiledPPT_Compiled
PPT_Compiled
 
Keep calm and write reusable code in Android
Keep calm and write reusable code in AndroidKeep calm and write reusable code in Android
Keep calm and write reusable code in Android
 
Pentesting con android - Nipper Toolkit Web Scan
Pentesting con android - Nipper Toolkit Web ScanPentesting con android - Nipper Toolkit Web Scan
Pentesting con android - Nipper Toolkit Web Scan
 

Ähnlich wie Deep Dive Into Android Security

Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21dxsaki
 
Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)ClubHack
 
14180203 an-introduction-to-android
14180203 an-introduction-to-android14180203 an-introduction-to-android
14180203 an-introduction-to-androidNeha Jain
 
600.250 UI Cross Platform Development and the Android Security Model
600.250 UI Cross Platform Development and the Android Security Model600.250 UI Cross Platform Development and the Android Security Model
600.250 UI Cross Platform Development and the Android Security ModelMichael Rushanan
 
Java & The Android Stack: A Security Analysis
Java & The Android Stack: A Security AnalysisJava & The Android Stack: A Security Analysis
Java & The Android Stack: A Security AnalysisPragati Rai
 
When developer's api simplify user mode rootkits developing.
When developer's api simplify user mode rootkits developing.When developer's api simplify user mode rootkits developing.
When developer's api simplify user mode rootkits developing.Yury Chemerkin
 
Advanced malware analysis training session8 introduction to android
Advanced malware analysis training session8 introduction to androidAdvanced malware analysis training session8 introduction to android
Advanced malware analysis training session8 introduction to androidCysinfo Cyber Security Community
 
Android village @nullcon 2012
Android village @nullcon 2012 Android village @nullcon 2012
Android village @nullcon 2012 hakersinfo
 
Androidoverview 100405150711-phpapp01
Androidoverview 100405150711-phpapp01Androidoverview 100405150711-phpapp01
Androidoverview 100405150711-phpapp01Santosh Sh
 
Securely Deploying Android Device - ISSA (Ireland)
 Securely Deploying Android Device - ISSA (Ireland) Securely Deploying Android Device - ISSA (Ireland)
Securely Deploying Android Device - ISSA (Ireland)Angelill0
 
Android Seminar BY Suleman Khan.pdf
Android Seminar BY Suleman Khan.pdfAndroid Seminar BY Suleman Khan.pdf
Android Seminar BY Suleman Khan.pdfNomanKhan869872
 

Ähnlich wie Deep Dive Into Android Security (20)

Securing Android
Securing AndroidSecuring Android
Securing Android
 
Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)
 
14180203 an-introduction-to-android
14180203 an-introduction-to-android14180203 an-introduction-to-android
14180203 an-introduction-to-android
 
128-ch4.pptx
128-ch4.pptx128-ch4.pptx
128-ch4.pptx
 
600.250 UI Cross Platform Development and the Android Security Model
600.250 UI Cross Platform Development and the Android Security Model600.250 UI Cross Platform Development and the Android Security Model
600.250 UI Cross Platform Development and the Android Security Model
 
Java & The Android Stack: A Security Analysis
Java & The Android Stack: A Security AnalysisJava & The Android Stack: A Security Analysis
Java & The Android Stack: A Security Analysis
 
When developer's api simplify user mode rootkits developing.
When developer's api simplify user mode rootkits developing.When developer's api simplify user mode rootkits developing.
When developer's api simplify user mode rootkits developing.
 
Advanced malware analysis training session8 introduction to android
Advanced malware analysis training session8 introduction to androidAdvanced malware analysis training session8 introduction to android
Advanced malware analysis training session8 introduction to android
 
Android village @nullcon 2012
Android village @nullcon 2012 Android village @nullcon 2012
Android village @nullcon 2012
 
Andriod Pentesting and Malware Analysis
Andriod Pentesting and Malware AnalysisAndriod Pentesting and Malware Analysis
Andriod Pentesting and Malware Analysis
 
Androidoverview 100405150711-phpapp01
Androidoverview 100405150711-phpapp01Androidoverview 100405150711-phpapp01
Androidoverview 100405150711-phpapp01
 
Securely Deploying Android Device - ISSA (Ireland)
 Securely Deploying Android Device - ISSA (Ireland) Securely Deploying Android Device - ISSA (Ireland)
Securely Deploying Android Device - ISSA (Ireland)
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Android Seminar BY Suleman Khan.pdf
Android Seminar BY Suleman Khan.pdfAndroid Seminar BY Suleman Khan.pdf
Android Seminar BY Suleman Khan.pdf
 
Android platform
Android platform Android platform
Android platform
 
Android ppt
Android ppt Android ppt
Android ppt
 
Android Applications
Android ApplicationsAndroid Applications
Android Applications
 
Android ppt
Android pptAndroid ppt
Android ppt
 

Mehr von Marakana Inc.

Android Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar GargentaAndroid Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar GargentaMarakana Inc.
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven DevelopmentMarakana Inc.
 
Martin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMartin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMarakana Inc.
 
Why Java Needs Hierarchical Data
Why Java Needs Hierarchical DataWhy Java Needs Hierarchical Data
Why Java Needs Hierarchical DataMarakana Inc.
 
Pictures from "Learn about RenderScript" meetup at SF Android User Group
Pictures from "Learn about RenderScript" meetup at SF Android User GroupPictures from "Learn about RenderScript" meetup at SF Android User Group
Pictures from "Learn about RenderScript" meetup at SF Android User GroupMarakana Inc.
 
Android UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesAndroid UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesMarakana Inc.
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6Marakana Inc.
 
Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Marakana Inc.
 
Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Marakana Inc.
 
What's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationWhat's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationMarakana Inc.
 
jQuery State of the Union - Yehuda Katz
jQuery State of the Union - Yehuda KatzjQuery State of the Union - Yehuda Katz
jQuery State of the Union - Yehuda KatzMarakana Inc.
 
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...Marakana Inc.
 
Efficient Rails Test Driven Development (class 4) by Wolfram Arnold
Efficient Rails Test Driven Development (class 4) by Wolfram ArnoldEfficient Rails Test Driven Development (class 4) by Wolfram Arnold
Efficient Rails Test Driven Development (class 4) by Wolfram ArnoldMarakana Inc.
 
Efficient Rails Test Driven Development (class 3) by Wolfram Arnold
Efficient Rails Test Driven Development (class 3) by Wolfram ArnoldEfficient Rails Test Driven Development (class 3) by Wolfram Arnold
Efficient Rails Test Driven Development (class 3) by Wolfram ArnoldMarakana Inc.
 
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas Enebo
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas EneboLearn about JRuby Internals from one of the JRuby Lead Developers, Thomas Enebo
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas EneboMarakana Inc.
 
Replacing Java Incrementally
Replacing Java IncrementallyReplacing Java Incrementally
Replacing Java IncrementallyMarakana Inc.
 
Learn to Build like you Code with Apache Buildr
Learn to Build like you Code with Apache BuildrLearn to Build like you Code with Apache Buildr
Learn to Build like you Code with Apache BuildrMarakana Inc.
 
Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)Marakana Inc.
 
Learn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDBLearn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDBMarakana Inc.
 

Mehr von Marakana Inc. (20)

Android Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar GargentaAndroid Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar Gargenta
 
JRuby at Square
JRuby at SquareJRuby at Square
JRuby at Square
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
Martin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMartin Odersky: What's next for Scala
Martin Odersky: What's next for Scala
 
Why Java Needs Hierarchical Data
Why Java Needs Hierarchical DataWhy Java Needs Hierarchical Data
Why Java Needs Hierarchical Data
 
Pictures from "Learn about RenderScript" meetup at SF Android User Group
Pictures from "Learn about RenderScript" meetup at SF Android User GroupPictures from "Learn about RenderScript" meetup at SF Android User Group
Pictures from "Learn about RenderScript" meetup at SF Android User Group
 
Android UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesAndroid UI Tips, Tricks and Techniques
Android UI Tips, Tricks and Techniques
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6
 
Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6
 
Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)
 
What's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationWhat's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovation
 
jQuery State of the Union - Yehuda Katz
jQuery State of the Union - Yehuda KatzjQuery State of the Union - Yehuda Katz
jQuery State of the Union - Yehuda Katz
 
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...
 
Efficient Rails Test Driven Development (class 4) by Wolfram Arnold
Efficient Rails Test Driven Development (class 4) by Wolfram ArnoldEfficient Rails Test Driven Development (class 4) by Wolfram Arnold
Efficient Rails Test Driven Development (class 4) by Wolfram Arnold
 
Efficient Rails Test Driven Development (class 3) by Wolfram Arnold
Efficient Rails Test Driven Development (class 3) by Wolfram ArnoldEfficient Rails Test Driven Development (class 3) by Wolfram Arnold
Efficient Rails Test Driven Development (class 3) by Wolfram Arnold
 
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas Enebo
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas EneboLearn about JRuby Internals from one of the JRuby Lead Developers, Thomas Enebo
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas Enebo
 
Replacing Java Incrementally
Replacing Java IncrementallyReplacing Java Incrementally
Replacing Java Incrementally
 
Learn to Build like you Code with Apache Buildr
Learn to Build like you Code with Apache BuildrLearn to Build like you Code with Apache Buildr
Learn to Build like you Code with Apache Buildr
 
Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)
 
Learn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDBLearn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDB
 

Kürzlich hochgeladen

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Kürzlich hochgeladen (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Deep Dive Into Android Security

  • 1. Deep  Dive  into  Android  Security   by  Aleksandar  Gargenta,  Marakana  Inc.   video/slides  at   h>p://mrkn.co/andsec  
  • 2. About  Aleksandar  (Saša)  Gargenta   •  Developing  in  Java  since  1996  –  mostly  server-­‐side   •  Hacking  Android  since  2008  –  from  the  SDK  to  the  kernel   •  Teaching  Java,  Android,  etc.  at  Marakana  since  2005   –  h>p://marakana.com/   •  Founder  &  Organizer  of  San  Francisco  Java  User  Group     –  h>p://www.sXava.org/   •  Founder  &  Organizer  of  San  Francisco  Android  User  Group     –  h>p://www.sfandroid.org/   •  Co-­‐founder  &  co-­‐organizer  of  San  Francisco  HTML5  User  Group   –  h>p://www.s[tml5.org/   •  Wri]ng  Android  Internals  for  O'Reilly  (ETA?  yesterday)   •  Worked  on  SMS,  MMS,  WAP  Push,  but  also  Linux  and  system   administra]on  in  past  life  
  • 3. Overview   •  Why  care?   •  Android  Security  Model   •  Permissions  on  Android   •  Encryp]on  on  Android   •  Device  Admin   •  Roo]ng  Android  Devices   •  An]-­‐roo]ng?  ASLR?  SE-­‐Linux?  Locking  bootloaders?   •  Tap-­‐jacking   •  Developer  Best  Prac]ces   •  Other  concerns  
  • 4. Why  Care?   "   "Scary  Android  security  hole  in  99%  of  phones:  PANIC!"   –  Computerworld   "   "HTC  promises  fix  for  massive  Android  security  flaw"  –   MobileBeat   "   "Android  users  are  two  and  a  half  ]mes  as  likely  to   encounter  malware  today  than  6  months  ago…"  –   Lookout  Mobile  Threat  Report   "   "Today’s  mobile  devices  are  a  mixed  bag  when  it   comes  to  security…  s]ll  vulnerable  to  many  tradi]onal   a>acks….”  -­‐  Carey  Nachenberg,  Symantec   "   "Android  Security  Will  Be  Big  News  in  2011:  10   Reasons  Why"  -­‐  eWeek   "   "The  growth  rate  in  malware  within  Android  is  huge;  in   the  future  there  will  definitely  be  more."  -­‐  Nikolay   Grebennikov,  CTO  of  Kaspersky   "   "Any  ]me  a  technology  becomes  adopted  and  popular,   that  technology  will  be  targeted  by  the  bad  guys."  -­‐  Jay   Abbo>,  PricewaterhouseCoopers  LLP  
  • 5. Founda]ons  of  Android  Security     •  Applica]on  Isola&on  and  Permission-­‐Control   –  Can  we  control  what  applica]ons  are  able  to  do?   –  Can  a  misbehaving  app  affect  the  rest  of  the  system?   •  Applica]on  "Provenance"   –  Can  we  trust  the  author  of  an  app?   –  Can  we  trust  our  apps  to  be  tamper-­‐resistant?   •  Data  Encryp&on   –  Is  our  data  safe  if  our  device  is  hacked/lost/stolen?     •  Device  Access  Control   –  Can  we  protect  our  device  against  unauthorized  use?  
  • 6. Android  Stack  (revisited)   Applications Content Home Contacts Phone Browser Providers Application Framework Activity Window Vibrator WiFi Battery Service Service Service Service Service Package Telephony Resource Location Notification Service Service Manager Service Service Native Layer Surface Media Android Runtime SQLite SSL Manager Framework Core Libs OpenGL vold netd WebKit Dalvik libwifi libcamera libgps libc VM Display Camera Linux Kernel GPS Binder Driver Driver Driver Driver Keypad WiFi Audio Power Driver Driver Driver Mgmt
  • 8. Android  Applica]on  Isola]on   •  By  default,  each  app  runs  in  a  separate  process  with  a   dis]nct  user/group  ID  (fixed  for  the  life]me  of  the  app)   –  Possible  for  mul]ple  apps  to  share  UID  and  process   –  Based  on  decades-­‐old,  well-­‐understood  UNIX  security   model  (processes  and  file-­‐system  permissions)   •  Applica]on-­‐framework  services  also  run  in  a  separate   process  (system_server)   •  Linux  kernel  is  the  sole  mechanism  of  app  sandboxing   •  Dalvik  VM  is  not  a  security  boundary   –  Coding  in  Java  or  C/C++  code  –  no  difference   –  Enables  use  of  JNI  (unlike  JavaME!)   •  Same  rules  apply  to  system  apps  
  • 10. Default  Android  Permissions  Policy   •  No  app  can  do  anything  to  adversely  affect   –  Other  apps   –  The  system  itself   –  The  user  of  the  device   •  So,  by  default,  apps  cannot:   –  Read*/write  files  outside  their  own  directory   –  Install/uninstall/modify  other  apps   –  Use  other  apps'  private  components   –  Access  network   –  Access  user's  data  (contacts,  SMS,  email)   –  Use  cost-­‐sensi]ve  APIs  (make  phone  calls,  send  SMS,  NFC)   –  Keep  device  awake,  automa]cally  start  on  boot,  etc.  
  • 11. Escaping  The  Sandbox   •  Actually,  apps  can*  talk  to   other  apps  via   –  Intents   –  IPC  (a.k.a.  Binder)   –  ContentProviders   •  Otherwise,  to  escape  our   sandbox,  we  need  to  use   permissions   –  Some  permissions  are  only     available  to  system  apps  
  • 12. Built-­‐in  Android  Permissions   ACCESS_FINE_LOCATION,  ACCESS_NETWORK_STATE,   ACCESS_WIFI_STATE,  ACCOUNT_MANAGER,   BLUETOOTH,  BRICK,  CALL_PHONE,  CAMERA,   CHANGE_WIFI_STATE,  DELETE_PACKAGES,   INSTALL_PACKAGES,  INTERNET,  MANAGE_ACCOUNTS,   MASTER_CLEAR,  READ_CONTACTS,  READ_LOGS,   READ_SMS,  RECEIVE_SMS,  RECORD_AUDIO,   SEND_SMS,  VIBRATE,  WAKE_LOCK,  WRITE_CONTACTS,   WRITE_SETTINGS,  WRITE_SMS,  …   h>p://developer.android.com/reference/android/Manifest.permission.html  
  • 13. Example:  Buddy  Tickler  App   •  For  example,  an  app  that  vibrates  your  phone  any   ]me  you  get  in  close  vicinity  to  a  friend  would   need  to  use  at  least  the  following  permissions: •  App's  AndroidManifest.xml: <manifest package="com.marakana.android.trackapp" …> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.VIBRATE" /> … </manifest>
  • 14. Logical  Permission  Enforcement   FooUsingApp system_server Dalvik VM Dalvik VM Android Permission FooConsumingActivity Check FooService FooNative FooManager FooNative libfoo_jni Provides libfoo_jni UID/PID libfoo libfoo File Permission Granted File Permission Denied /dev/foo /dev/binder or /sys/foo/enable Kernel
  • 15. Permission  Enforcement  Example   •  Only  the  system  user  (i.e.  SS  proc)  can  write  to  the  vibrator  driver: $ adb shell ls -l /sys/class/timed_output/vibrator/enable -rw-r--r-- system system 4096 2011-09-30 23:23 enable •  Only  apps  with  android.permission.VIBRATE  permissions  can   access VibratorSevice.vibrate(…)  method: frameworks/base/services/java/com/android/server/VibratorService.java package com.android.server; … public class VibratorService extends IVibratorService.Stub { … public void vibrate(long milliseconds, IBinder token) { if (mContext.checkCallingOrSelfPermission( android.Manifest.permission.VIBRATE) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException( "Requires VIBRATE permission"); } … } … }
  • 16. Kernel  Permission  Enforcement   •  Some  Android  permissions  directly  map  to  group  IDs,  which  are  then   enforced  by  the  kernel/FS:   /system/etc/permissions/platform.xml:   <permissions> … <permission name="android.permission.INTERNET" > <group gid="inet" /> </permission> <permission name="android.permission.CAMERA" > <group gid="camera" /> </permission> <permission name="android.permission.READ_LOGS" > <group gid="log" /> </permission> <permission name="android.permission.WRITE_EXTERNAL_STORAGE" > <group gid="sdcard_rw" /> </permission> … </permissions> •  Interes]ng  example:  android.permission.INTERNET -> inet -> 3003 -> ANDROID_PARANOID_NETWORK  (kernel  patch)  
  • 17. Permission  Gran]ng   •  Permissions  are  granted  once,  at  the   applica]on  install  ]me   –  Ok,  updates  too   –  One  excep]on,  URI  permissions   •  All-­‐or-­‐nothing!   •  But,  can  a  novice  any  user  tell  whether   the  combina]on  of  requested   permissions  is  OK?  (Can  you?)   –  Permissions  marked  as  "normal"  are   hidden  behind  "See  all"   •  What  about  combo  of  permissions   across  different  apps  from  the  same   (malicious)  author?  (Apps  can  share)  
  • 18. Permission  Gran]ng,  Alterna]ves?   •  Switch  to  dynamically  gran]ng  permissions  on   use  or  on  start  of  each  app  ("session")?   –  Annoying   –  Hard  to  provide  seamless  app-­‐switching   –  Over-­‐promp]ng  leads  to  a  condi]oned-­‐response   –  Users  already  commi>ed  to  the  app   •  Cannot  make  informed-­‐decisions  on  whether  to   grant  permissions?  Let  app  ra]ngs  +  comments   from  "sophis]cated"  users  on  Market  help  
  • 19. Applica]on  Provenance   •  Can  we  trust  the  developer  of  an  applica]on   we  are  about  to  install?  (mostly,  no)   •  Can  we  trust  that  our  apps  are  resistant  to   tampering  once  installed?  (mostly,  yes)   •  To  get  onto  Android  Market,  a  developer  just   needs  to  register  with  Google  and  pay  $25   with  a  valid  credit  card   –  A  mild  deterrent  against  authors  of  malicious  apps   •  Apps  can  also  be  side-­‐loaded  (not  on  AT&T)  
  • 20. Applica]on  Provenance  (Signing)   •  All  apps  (.apk  files)  must  be  digitally  signed  prior  to   installa]on  on  a  device  (and  uploading  to  Android   Market)   •  The  embedded  cer]ficate  can  be  self-­‐signed  (no  CA   needed!)  and  valid  for  25+  years   •  App  signing  on  Android  is  used  to:   –  Ensure  the  authen]city  of  the  author  on  the  first  install   –  Ensure  the  authen]city  of  the  author  on  updates   –  Establish  trust  rela&onship  among  apps  signed  with  the   same  key  (share  permissions,  UID,  process)   –  Make  app  contents  tamper-­‐resistant  (moot  point)   •  An  app  can  be  signed  with  mul]ple  keys  
  • 21. Applica]on  Provenance  (Signing)   •  Lost/expired  key?  No  way  to   update  the  app(s)   •  Stolen  key?  No  way  to  revoke   •  How  do  we  trust  the  author  on   the  first  install?   –  Is  this  the  real  author,  or  an   imposter?  Can  I  check  the  cert?   –  Has  this  app  been  ve>ed?   –  Go  by  the  number  of  installs?   •  Follow  the  sheep?  
  • 22. Applica]on  Provenance  (Signing)   •  The  result?   "   Android.Rootcager   "   Android.Pjapps   "   Android.Bgserv   •  All  took  advantage  of  weak  trust  rela]onship   ①  Take  an  exis]ng  (popular)  app   ②  Inject  malicious  code  (e.g.  a  trojan)   ③  Re-­‐package  and  re-­‐sign  with  a  new  key/cert   ④  Upload  to  market  (or  distribute  via  web)   ⑤  Wait  for  the  "sheep"  to  come  (not  really  our  fault)  
  • 23. Safeguarding  Apps'  Data   •  Apps'  files  are  private  by  default   –  Owned  by  dis]nct  apps'  UIDs   •  Excep]ons   –  Apps  can  create  files  that  are   •  MODE_WORLD_READABLE •  MODE_WORLD_WRITABLE –  Other  apps  (signed  with  the  same  key)  can  run  with   the  same  UID  –  thereby  gexng  access  to  shared  files   –  /mnt/sdcard  is  world-­‐readable  and  world-­‐writable   (with  WRITE_TO_EXTERNAL_STORAGE)  
  • 24. Data  Encryp]on    VPN  (IPSEC)  with  3DES  and  AES  and  cert  auth.    VPN  Client  API  available  as  of  ICS/4.0    802.11  with  WPA/2  and  cert  auth.    OpenSSL    JCE  (based  on  BouncyCastle  provider)    Apache  HTTP  Client  (suppor]ng  SSL)    java.net.H>psUrlConnec]on   –  Using  encryp]on  well  is  non-­‐trivial  (e.g.  IV)   –  Does  not  help  if  the  key  is  stored  on  the  device    Keychain  API  –  apps  can  install  and  store  user   cer]ficates  and  CAs  securely  as  of  ICS/4.0    Whole-­‐disk  encryp]on  (requires  >=  3.0)  
  • 25. Whole  Disk  Encryp]on   •  Se/ngs  →  Loca3on  &  Security  →  Encryp3on  →  Encrypt   tablet   –  Requires  screen-­‐lock  password   –  Encrypts  /data  par]]on  with  AES128  with  CBC  and   ESSIV:SHA256  (password  combined  with  salt  then  SHA1'd)   –  Disabling  encryp]on  requires  device  master  reset     •  Based  on  Linux'  dm-­‐crypt  kernel  feature     –  /data  as  an  encrypted  block  device  (/dev/block/dm-0)   •  User-­‐password  used  directly  (change  requires  re-­‐encrypt!)   •  Not  hardware-­‐accelerated:  54%  degrada]on  in  I/O  read   performance  on  Samsung  Galaxy  Tab  10.1   •  Vulnerable  to  "Evil  maid  a>ack"  and  cold-­‐boot  a>acks  
  • 26. Digital  Rights  Management   •  Android  provides  a   pluggable  DRM   framework  (API  >=  11)   •  Actual  schemes   provided  by  OEMs   •  Hides  complexity  of     DRM  when  accessing   rights-­‐protected  (or   plain)  content  under   various  schemes  
  • 27. [Physical]  Access  Control   •  Screen  unlock  pa>ern,  pin,   password   •  More  op]ons  with  device  admin   (including  password  expira]on,   encryp]on,  auto-­‐device-­‐wipe,  etc.)   •  Low-­‐level  access  to  SIM  card  is  not   available  to  apps   •  But:   "   SIM/SD  Card  can  be  simply  ejected,   bypassing  screen  unlock   "   Cold-­‐boot  a>acks  
  • 28.  Taking  Android  To  Work:  Device  Admin  
  • 29. Roo]ng   •  Why  root?   –  Access  to  custom  ROMs   –  Reuse  old  hardware   –  Remove  offending  system  apps   –  Get  more  speed   –  Get  be>er  looks   –  Because  it's  cool   –  Rootkit     •  But,  it  comes  at  a  price    
  • 30. Roo]ng:  How-­‐to   1.  Exploit  a  weakness  of  the   exis]ng  ROM  to  gain  root   2.  Flash  the  recovery  par]]on   with  an  alterna]ve  image     3.  Download  an  alterna]ve  compa]ble  ROM   (already  rooted)  onto  the  /sdcard 4.  Reboot  into  recovery,  and  flash  the  new  ROM   5.  Get  root  at  any  ]me  with  Superuser.apk +  /system/bin/su •  Or,  as  easy  as:  $ fastboot oem unlock
  • 31. Gexng  Root   •  exploid:  exploit  a  bug  in  udev  (on  Android   init/ueventd)  to  pass  a  fake  message   (NETLINK_KOBJECT_UEVENT)  with   executable  FIRMWARE  code  to  run  as  root   •  rageagains<hecage:  exploit  a  race-­‐condi]on  in   adbd  to  preempt  its  call  to  setuid()  (to  shell   user)  leaving  it  running  as  root   •  so>break/gingerbreak:  exploit  a  buffer-­‐overrun   condi]on  in  vold  (which  runs  as  root)  to  execute   arbitrary  code  as  root   •  …  
  • 32. Dangers  of  Roo]ng   •  App  isola]on   •  System/app  permissions   •  Data-­‐safeguards  +  encryp]on   •  Device  administra]on   •  …   all  fall-­‐apart  when  we  allow  un-­‐trusted  code  to  run   as  root  (this  is  what  malicious  apps  do)  
  • 33. Memory  Security  Protec]on   •  Hardware-­‐based  No  eXecute  (NX)  to  prevent  code   execu]on  on  the  stack  and  heap   •  ProPolice  to  prevent  stack  buffer  overruns   •  safe_iop  to  reduce  integer  overflows   •  Extensions  to  OpenBSD  dlmalloc  to  prevent  double   free()  vulnerabili]es  and  to  prevent  chunk  consolida]on   a>acks  (against  heap  corrup]on)   •  OpenBSD  calloc  to  prevent  integer  overflows  during   memory  alloca]on   •  Linux  mmap_min_addr()  to  mi]gate  null  pointer   dereference  privilege  escala]on   •  But,  what  about  shared  libraries?  
  • 34. Address  Space  Layout  Randomiza]on   •  Shared  libraries  on  Android  are  pre-­‐linked*:  their   address  are  fixed,  for  performance  reasons   •  Successful  memory  corrup]on  a>acks  can  easily  return   to  libc  (i.e.  execute  arbitrary  code)   •  ASLR  on  Android  ( just  a  proposal  at  this  ]me):   –  Randomize  offsets  to  shared  libs  and  executables  at  system   upgrade-­‐]me   –  Record  offsets  to  undo  randomiza]on  for  OTA  updates     –  Detect  brute-­‐force  guessing  with  cloud-­‐based  analysis   •  h>p://bojinov.org/professional/wisec2011-­‐mobileaslr-­‐ paper.pdf   •  ASLR  is  finally  a  standard  in  ICS/4.0  (*  no  pre-­‐linking?)  
  • 35. SE-­‐Linux  on  Android   •  SELinux  allows  us  to  run  OS  services  with   minimum  privileges  (i.e.  not  root)   –  Heavy  use  on  the  desktop/server-­‐side   •  SELinux  on  Android  is  possible,  but  hard   –  Slow   –  Requires  rethinking  on  the  security  model  for  easier   configura]on   –  Does  not  support  yaffs2   •  Folks  at  Hitachi  got  it  to  work,  but  it  seems  stalled  
  • 36. Tap-­‐Jacking  on  Android   •  A  malicious  app  starts  a  security-­‐ sensi]ve  (e.g.  system  sexngs)  ac]vity   •  It  then  overlays  a  full-­‐screen  custom   no]fica]on  dialog  on  top  of  the   targeted  ac]vity  (like  a  game)  –  works   like  Toasts   •  User  interacts  with  the  custom   no]fica]on  dialog,  but  her  touch  events   are  passed  down  to  the  legi]mate   ac]vity   •  In  API  >=9  prevent  with  XML  a>r  on  UI   filterTouchesWhenObscured   (or  programma]cally)  
  • 37. Developer  Best  Prac]ces   •  Avoid  building  apps  that  require  root   •  If  you  are  using  encryp]on,  be  sure  to  know  what   you  are  doing  (e.g.  use  IVs)   •  Mark  your  applica]on's  components  as   android:exported="false"  unless  you   are  specifically  building  them  for  public  use   –  Don't  trust  Intent  inputs/results  (especially  pending)   –  Don't  leak  broadcast  events  you  are  sending  out   –  Use  custom  permissions  to  control  access  
  • 38. Custom  Permissions   <manifest … package="com.marakana.myapp" > <permission android:name="co.mrkn.perm.GET_PASSWORD" android:label="@string/get_password_label" android:description="@string/get_password_desc" android:permissionGroup= "android.permission-group.PERSONAL_INFO" android:protectionLevel="dangerous" /> … </manifest>
  • 39. Requiring  Permissions   •  Sta]cally,  in  AndroidManifest.xml  on  our   applica]on  components  via  a>ributes   –  android:permission     –  android:readPermission –  android:writePermission •  Dynamically,  on  broadcast  senders  via   –  aContext.registerReceiver(BroadcastReceiver, String, Handler) •  Dynamically,  in  bound-­‐services  via   –  aContext.checkCallingPermission(String)   –  aContext.enforceCallingOrSelfPermission(String)
  • 40. An]-­‐malware   •  Use  PackageManager.getInstalledPackages(int)  for   the  ini]al  scan  of  apps/packages  against  a  known  black-­‐list   –  E.g.  check  for  package  names,  permissions,  signatures   •  Listen  for  android.intent.action.PACKAGE_ADDED   broadcasts  and  verify  new  apps   •  Once  a  malicious  app  is  found,  offer  the  user  a  chance  to  delete  it:   Uri packageURI = Uri.parse("package:com.malicous.app"); Intent uninstallIntent = new Intent( Intent.ACTION_DELETE, packageURI); startActivity(uninstallIntent);   •  For  personal  use,  consider  something  like:     –  Lookout  Security  &  An3virus   –  Norton  Mobile  Security  
  • 41. Other  Security  Concerns   •  Push-­‐based  install  from  Android  Market  (GMail)   •  Social-­‐engineering   •  Firewall   •  Encryp]on  of  communica]on   •  Compromised  pla€orm  keys   •  App  obfusca]on   •  Protec]ng  bootloader/recovery   •  Security  of  skins   •  OEM/Carrier  OS  upgrade  cycles  
  • 42. Thank  You!   •  Ques]ons?   •  More  info:   –  h>p://mrkn.co/andsec  (video  of  this  talk)   –  h>p://source.android.com/tech/encryp]on/ android_crypto_implementa]on.html   –  h>p://www.symantec.com/about/news/release/ ar]cle.jsp?prid=20110627_02   •  Contact  Info:   –  h>p://marakana.com/   –  sasa@marakana.com   –  @agargenta  on  Twi>er   –  aleksandar.gargenta@gmail.com  on  Google+