64
MAN IN THE BINDER: MONSTERS UNDER THE HOOD Michael Shalyt Malware Research Team Leader @ Check Point Idan Revivo Mobile Malware Researcher @ Check Point

Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Embed Size (px)

Citation preview

Page 1: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

MAN IN THE BINDER: MONSTERS UNDER THE HOOD Michael Shalyt   Malware Research Team Leader @ Check Point

Idan Revivo   Mobile Malware Researcher @ Check Point

Page 2: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A  Hack  in  Three  Acts  

Act  I  –  Know  Your  Droid  Act  II  –  A8ack  Your  Droid  Act  III  –  Prepare  Your  Droid  

Page 3: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint
Page 4: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Nitay  Artenstein   Idan  Revivo   Michael  Shalyt    

Page 5: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Name:  Ki9y  Bank  Occupa?on:  Bank  Applica?on    “U  want  KitCoins  –  we  haz  it”  

Page 6: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Name:  Ki9y-­‐ninja  Occupa?on:  Script  kiddy    “Mommy,  can  I  rob  this  bank?”  

Page 7: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Name:  Paw  of  Death  Occupa?on:  Black  belt  ninja  hacker    “To  rob  a  bank,  you  must  first  become  the  bank”  

Page 8: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Name:  System  Service  Occupa?on:  SiQng  and  wai?ng  to  serve  your  needs      These  things  run  Android!  

Page 9: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Name:  $  echo  `uname  –r`  Occupa?on:  Holding  the  world  on  its  shoulders  since  1.1.1970    Feeling  neglected  now  that  system  services  get  all  the  a9en?on  on  Android  

Page 10: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Name:  The  Binder  Occupa?on:  All  Powerful  Mystery    Character       ?  

Page 11: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint
Page 12: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

An  Applica<on’s  Life  On  Windows  

Syscalls  

Page 13: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

An  Applica<on’s  Life  On  Android  

Syscalls  

Syscalls  

Syscalls  

Page 14: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Android  –  The  Real  Picture  

Syscalls  

Syscalls  

Page 15: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

/dev/binder   /dev/9y0  

libbinder.so  

kernel  /system/libbinder.so  

/system/lib*.so  

DalvikVM   DalvikVM  

syscall  parcel   parcel  

Bank  Applica?on  Process   System  Service  Process  

applica?on  

 System  services  

proxy    

libandroid_run?me.so  

libandroid_run?me.so  

System  Service  

•  Binder  has  a  userland  component  and  a  kernel  one  

•  The  driver  receives  the  Parcel  via  an  ioctl  syscall  and  sends  it  to  the  target  processes  

Page 16: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What’s  a  Parcel?  

Page 17: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Playing  MP3  

Page 18: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

libbinder.so  

DalvikVM  

Ki9y  Player  App  

Parcels  

Syscalls  

Parcels  

Audio  Manager  

/dev/binder  

/system/  

libbinder.so  

kernel  

A  short  recap  

Page 19: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint
Page 20: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint
Page 21: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Round  I  Key  Logging    

Page 22: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A  n00b  A8acker’s  View  of  The  System  

Page 23: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  n00b  A8acker  Do?  

Page 24: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  n00b  A8acker  Do?  

Page 25: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  n00b  A8acker  Do?  

Page 26: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A  Ninja  A8acker’s  View  of  The  System  

Page 27: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  Ninja  A8acker  Do?  

Page 28: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Key  Logger  Demo  

Page 29: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  Ninja  A8acker  Do?  

Page 30: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Round  II  Data  Manipula<on  

Page 31: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A  n00b  A8acker’s  View  of  The  System  

Ac?vity   Ac?vity   Ac?vity  

Page 32: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

In-­‐app  Ac<vity  Ini<aliza<on    

Page 33: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  n00b  A8acker  Do?  Bye  Ki8y  Bank  ,  Hello  Shi**y  Bank  

Page 34: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  n00b  A8acker  Do?  Bye  Ki8y  Bank  ,  Hello  Shi**y  Bank  

Page 35: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A  Ninja  A8acker’s  View  of  The  System  Ac?vity  Manager  

Page 36: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

In-­‐app  data  goes  through  Binder???  

Page 37: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A  Ninja  A8acker’s  View  of  The  System  Ac?vity  Manager  

Page 38: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  Ninja  A8acker  Do?  Ac?vity  Manager  

Page 39: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A  trillion  dollars,  anyone?  

Page 40: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Data  Manipula<on  Demo  

Page 41: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  Ninja  A8acker  Do?  

Page 42: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Round  III  Intercep<ng  SMS    

Page 43: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A  n00b  A8acker’s  View  of  The  System  

Telephony  Manager  

Page 44: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  n00b  A8acker  Do?  

Page 45: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  n00b  A8acker  Do?  

Page 46: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A  Ninja  A8acker’s  View  of  The  System  

Page 47: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  Ninja  A8acker  Do?  

Page 48: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

SMS  internals  •  The  Telephony  Manager  no?fies  the  SMS  app  whenever  an  SMS  is  received.  

 •  The  app  queries  the  TM’s  database.  

•  Under  the  hood,  the  response  is  just  a  Unix  fd.    

Page 49: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

SMS  internals  •  The  Telephony  Manager  no?fies  the  SMS  app  whenever  an  SMS  is  received  

 •  The  app  queries  the  TM’s  database  via  Binder:  

Page 50: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

SMS  internals  •  But  what’s  a  Cursor  object?  

•  It’s  a  messy  abstrac?on  of  a  response  to  a  query  

Page 51: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

SMS  internals  •  Surprise:  Under  the  hood,  it’s  just  a  Unix  fd    •  Now  we’re  in  business!  

Page 52: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  Would  The  Ninja  A8acker  Do?  

Page 53: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Summary  What  Just  Happened?  

Page 54: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A8acking  The  Binder  

•  Hook  libbinder.so  at  the  point  where  it  sends  an  ioctl  to  the  kernel  

•  Stealth:  dozens  of  places  to  hook  •  But  don’t  you  need  root?  

Page 55: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

A8acking  The  Binder  

Vulnerable  to  known  roo?ng  exploits  

Page 56: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Consider  The  Possibili?es    

Page 57: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Summary  Features:  •  Versa?lity:  one  hook  –  mul?ple  func?onali?es.  •  App  agnos?c:  no  need  to  RE  apps.  •  Stealth:  the  Android  security  model  limits  3rd  party  security  apps  just  like  any  other  app.    

Page 58: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Summary  •  This  is  NOT  a  vulnerability.  It’s  like  man-­‐in-­‐the-­‐

browser,  but  for  literally  everything  on  Android.  •  Root  is  assumed.  Roo?ng  won’t  go  away  any  

?me  soon.  

Page 59: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Rumors  (You  didn’t  hear  it  from  me…)  

Page 60: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint
Page 61: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Solu<ons  –  for  developers    •  Take  control  of  your  own  process  memory  space.  

 • Minimize  the  amount  of  data  going  to  IPC,  and  encrypt  what  has  to  go.  

Page 62: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Solu<ons  –  for  security  industry  •  Scan  files  like  it’s  the  90’s.  •  Be  brave  –  get  root  yourself:  

•  Run?me  process  scanning  and  monitoring.  •  Sofware  firewall  (like  Avast).  •  Binder  firewall/anomaly  detec?on.  •  Etc.  

Page 63: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

Further  Reading  [1]  White  paper:  “Man  in  the  Binder”,  Artenstein  and  Revivo    [2]  “On  the    Reconstruc?on  of  Android  Malware  Behaviors”,  Fatori,  Tam  et  al    [3]  “Binderwall:  Monitoring  and  Filtering  Android  Interprocess  Communica?on”,  Hausner  

Page 64: Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint

What  are  you  trying  to  tell  me?  That  I  can  get  all  permissions  on  

a  device?    No.  

I’m  trying  to  tell  you  that  when  you’re  ready,  you  won’t  have  to