SlideShare a Scribd company logo
1 of 61
MAN IN THE BINDER:
HE WHO CONTROLS IPC, CONTROLS THE DROID
A Hack in Three Acts
Act I – Know Your Droid
Act II – Attack Your Droid
Act III – Prepare Your Droid
Nitay Artenstein Idan Revivo Michael Shalyt
Name: Kitty Bank
Occupation: Bank Application
“U want KitCoins – we haz it”
Name: Kitty-ninja
Occupation: Script kiddy
“Mommy, can I rob this bank?”
Name: Paw of Death
Occupation: Black belt ninja hacker
“To rob a bank, you must first
become the bank”
Name: System Service
Occupation: Sitting and
waiting to serve your needs
These things run Android!
Name: $ echo `uname –r`
Occupation: Holding the world
on its shoulders since 1.1.1970
Feeling neglected now that
system services get all the
attention on Android
Name: The Binder
Occupation: All Powerful
Mystery Character
?
An Application’s Life On Windows
Syscalls
An Application’s Life On Android
Syscalls
Syscalls
Syscalls
Android – The Real Picture
Syscalls
Syscalls
/dev/binder /dev/tty0
libbinder.so
kernel
/system/libbinder.so
/system/lib*.so
DalvikVM DalvikVM
syscallparcel parcel
Bank Application Process System Service Process
application
System services
proxy
libandroid_runtime.so
libandroid_runtime.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
What’s a Parcel?
A Short Recap
libbinder.so
DalvikVM
Kitty Bank Process
Parcels
Syscalls
Parcels
Audio Manager
Round I
Key Logging
A n00b Attacker’s View of The System
What Would The n00b Attacker Do?
What Would The n00b Attacker Do?
What Would The n00b Attacker Do?
A Ninja Attacker’s View of The System
What Would The Ninja Attacker Do?
Key Logger Demo
What Would The Ninja Attacker Do?
Round II
Data Manipulation
A n00b Attacker’s View of The System
Activity Activity Activity
What Would The n00b Attacker Do?
Bye Kitty Bank , Hello Shi**y Bank
What Would The n00b Attacker Do?
Bye Kitty Bank , Hello Shi**y Bank
A Ninja Attacker’s View of The System
Activity Manager
In-app data goes through Binder???
A Ninja Attacker’s View of The System
Activity Manager
What Would The Ninja Attacker Do?
Activity Manager
A trillion dollars, anyone?
Data Manipulation
Demo
What Would The Ninja Attacker Do?
Round III
Intercepting SMS
A n00b Attacker’s View of The System
Telephony Manager
What Would The n00b Attacker Do?
What Would The n00b Attacker Do?
A Ninja Attacker’s View of The System
Telephony Manager
What Would The Ninja Attacker Do?
SMS internals
• The Telephony Manager notifies the SMS app
whenever an SMS is received
• The app queries the TM’s database via Binder:
SMS internals
• But what’s a Cursor object?
• It’s a messy abstraction of a response to a query
SMS internals
• Surprise: Under the hood, it’s just a Unix fd
• Now we’re in business!
What Would The Ninja Attacker Do?
Summary
What Just Happened?
Attacking 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?
Attacking The Binder
Vulnerable
to known
rooting
exploits
Consider The Possibilities
Summary
Features:
• Versatility: one hook – multiple functionalities.
• App agnostic: no need to RE apps.
• Stealth: the Android security model limits 3rd
party security apps just like any other app.
Summary
• This is NOT a vulnerability. It’s like man-in-the-
browser, but for literally everything on Android.
• Root is assumed. Rooting won’t go away any
time soon.
Rumors
(You didn’t hear it from me…)
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
Solutions – for developers
• Take control of your own process memory
space.
• Minimize the amount of data going to IPC, and
encrypt what has to go.
Solutions – for security industry
• Scan files like it’s the 90’s.
• Be brave – get root yourself:
• Runtime process scanning and monitoring.
• Software firewall (like Avast).
• Binder firewall/anomaly detection.
• Etc.
Further Reading
[1] White paper: “Man in the Binder”, Artenstein
and Revivo
[2] “On the Reconstruction of Android Malware
Behaviors”, Fatori, Tam et al
[3] “Binderwall: Monitoring and Filtering Android
Interprocess Communication”, Hausner

More Related Content

Similar to Man in the Binder

Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint
Man in the Binder - Michael Shalyt & Idan Revivo, CheckPointMan in the Binder - Michael Shalyt & Idan Revivo, CheckPoint
Man in the Binder - Michael Shalyt & Idan Revivo, CheckPointDroidConTLV
 
Man in the Binder
Man in the BinderMan in the Binder
Man in the Bindernitayart
 
Honeypots and honeynets
Honeypots and honeynetsHoneypots and honeynets
Honeypots and honeynetsRasool Irfan
 
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoTCSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoTCanSecWest
 
Our Data Ourselves, Pydata 2015
Our Data Ourselves, Pydata 2015Our Data Ourselves, Pydata 2015
Our Data Ourselves, Pydata 2015kingsBSD
 
Workshop on Cyber security and investigation
Workshop on Cyber security and investigationWorkshop on Cyber security and investigation
Workshop on Cyber security and investigationMehedi Hasan
 
Serverless Security: What's Left To Protect
Serverless Security: What's Left To ProtectServerless Security: What's Left To Protect
Serverless Security: What's Left To ProtectGuy Podjarny
 
Rootkit Hunting & Compromise Detection
Rootkit Hunting & Compromise DetectionRootkit Hunting & Compromise Detection
Rootkit Hunting & Compromise Detectionamiable_indian
 
Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?Guy Podjarny
 
LST Toolkit: Exfiltration Over Sound, Light, Touch
LST Toolkit: Exfiltration Over Sound, Light, TouchLST Toolkit: Exfiltration Over Sound, Light, Touch
LST Toolkit: Exfiltration Over Sound, Light, TouchDimitry Snezhkov
 
The hardcore stuff i hack, experiences from past VAPT assignments
The hardcore stuff i hack, experiences from past VAPT assignmentsThe hardcore stuff i hack, experiences from past VAPT assignments
The hardcore stuff i hack, experiences from past VAPT assignmentsn|u - The Open Security Community
 
Cazando Cibercriminales con: OSINT + Cloud Computing + Big Data
Cazando Cibercriminales con: OSINT + Cloud Computing + Big DataCazando Cibercriminales con: OSINT + Cloud Computing + Big Data
Cazando Cibercriminales con: OSINT + Cloud Computing + Big DataChema Alonso
 
Symantec_2-4-5 nov 2010
Symantec_2-4-5 nov 2010Symantec_2-4-5 nov 2010
Symantec_2-4-5 nov 2010Agora Group
 
Playing with fuzz bunch and danderspritz
Playing with fuzz bunch and danderspritzPlaying with fuzz bunch and danderspritz
Playing with fuzz bunch and danderspritzDeepanshu Gajbhiye
 
MobileMiner and NervousNet
MobileMiner and NervousNetMobileMiner and NervousNet
MobileMiner and NervousNetkingsBSD
 
Security Challenges in Emerging Technologies
Security Challenges in Emerging TechnologiesSecurity Challenges in Emerging Technologies
Security Challenges in Emerging TechnologiesSmart Assessment
 
Security Challenges in Emerging Technologies
Security Challenges in Emerging TechnologiesSecurity Challenges in Emerging Technologies
Security Challenges in Emerging TechnologiesPraveen Vackayil
 
Brick all the internet of things!(with notes)
Brick all the internet of things!(with notes)Brick all the internet of things!(with notes)
Brick all the internet of things!(with notes)Jimmy Shah
 

Similar to Man in the Binder (20)

Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint
Man in the Binder - Michael Shalyt & Idan Revivo, CheckPointMan in the Binder - Michael Shalyt & Idan Revivo, CheckPoint
Man in the Binder - Michael Shalyt & Idan Revivo, CheckPoint
 
Man in the Binder
Man in the BinderMan in the Binder
Man in the Binder
 
Honeypots and honeynets
Honeypots and honeynetsHoneypots and honeynets
Honeypots and honeynets
 
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoTCSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
 
Our Data Ourselves, Pydata 2015
Our Data Ourselves, Pydata 2015Our Data Ourselves, Pydata 2015
Our Data Ourselves, Pydata 2015
 
Workshop on Cyber security and investigation
Workshop on Cyber security and investigationWorkshop on Cyber security and investigation
Workshop on Cyber security and investigation
 
Serverless Security: What's Left To Protect
Serverless Security: What's Left To ProtectServerless Security: What's Left To Protect
Serverless Security: What's Left To Protect
 
Rootkit Hunting & Compromise Detection
Rootkit Hunting & Compromise DetectionRootkit Hunting & Compromise Detection
Rootkit Hunting & Compromise Detection
 
Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?
 
Cyber ppt
Cyber pptCyber ppt
Cyber ppt
 
LST Toolkit: Exfiltration Over Sound, Light, Touch
LST Toolkit: Exfiltration Over Sound, Light, TouchLST Toolkit: Exfiltration Over Sound, Light, Touch
LST Toolkit: Exfiltration Over Sound, Light, Touch
 
The hardcore stuff i hack, experiences from past VAPT assignments
The hardcore stuff i hack, experiences from past VAPT assignmentsThe hardcore stuff i hack, experiences from past VAPT assignments
The hardcore stuff i hack, experiences from past VAPT assignments
 
Cazando Cibercriminales con: OSINT + Cloud Computing + Big Data
Cazando Cibercriminales con: OSINT + Cloud Computing + Big DataCazando Cibercriminales con: OSINT + Cloud Computing + Big Data
Cazando Cibercriminales con: OSINT + Cloud Computing + Big Data
 
Symantec_2-4-5 nov 2010
Symantec_2-4-5 nov 2010Symantec_2-4-5 nov 2010
Symantec_2-4-5 nov 2010
 
Playing with fuzz bunch and danderspritz
Playing with fuzz bunch and danderspritzPlaying with fuzz bunch and danderspritz
Playing with fuzz bunch and danderspritz
 
MobileMiner and NervousNet
MobileMiner and NervousNetMobileMiner and NervousNet
MobileMiner and NervousNet
 
Security Challenges in Emerging Technologies
Security Challenges in Emerging TechnologiesSecurity Challenges in Emerging Technologies
Security Challenges in Emerging Technologies
 
Security Challenges in Emerging Technologies
Security Challenges in Emerging TechnologiesSecurity Challenges in Emerging Technologies
Security Challenges in Emerging Technologies
 
Brick all the internet of things!(with notes)
Brick all the internet of things!(with notes)Brick all the internet of things!(with notes)
Brick all the internet of things!(with notes)
 
MiraiBotnet.pptx
MiraiBotnet.pptxMiraiBotnet.pptx
MiraiBotnet.pptx
 

Man in the Binder

Editor's Notes

  1. Need to say something about our group what do we do and maybe a promo for ccc
  2. This is a serious bank application for transferring funds between accounts
  3. To attack a system, one must first understand the system. And to do first lets take a look at standard OS that we all know … and some of us like… I guess … windows
  4. Application on windows needs to know allot of information about the environment its operating in. Sound example needs to know: Kernel version Enumerate all the audio devices correct device descriptor syscall number for transmitting the data system is engineered in order to do anything specific It doesn’t mean that if you are a programmer and you open visual studio you don’t to know all that stuff but the compiler knows all that stuff for you , and he incorporate all this data into your binary file. And this makes your application really heavy. And this is exactly what the android designers wanted to avoid .
  5. They wanted to create an Object Oriented operating system And the way to do it is isolate the application from the kernel In android according to object oriented concept we have what's called system service . system services come prebuild inside the android operating system , Each system service had its own specific role: audio,video,etc… Basically they handle all the kernel communication for the application. So the android application can only talk to manger applications to request their services For example play sound (explain rpc) Ok so that’s a great approach ,everything is good , everyone is happy but we do have a problem here ,can anyone spot the problem ? (Windows example) application cant talk to the kernel so how exactly is send this request to manager application? And the answer is binder
  6. So you probably asking yourselves what is binder Binder is an inter-process commination mechanism that in charge on passing remote procedure calls from different process in the system. What this is actually means is that when our application needs to talk to a specific system service, the application will send a remote procedure call to the binder and the binder will pass it to the required system service, Basically what I’m trying to say is here is that basically “everything goes through the binder” now lets look at how android designers implemented binder
  7. So the binder is implemented in two parts, a userland framework which is loaded inside every application process and a kernel driver. userland framework part is responsible Taking remote procedure calls with their arguments and wrap the in special container. Sending the container to kernel via iocatl syscall. Unwrapping that data when it arrives at the target process. That's possible because the Binder framework is a core part of every process in Android, servers as well as application. So when you fork() a process to create a new one, that new process will also have a copy of the Binder framework in it's memory space. The kernel driver part responsible Passing the remote procedure calls between process it acts more like a router by receiving the container ,parses the destination address of that container, and copies the container data to the target process' address space. It then wakes up a designated thread in the target process which is supposed to listen for incoming calls from client applications. So what exactly is this container?
  8. The name of that container is parcel It’s a flexible and extensible data object that when send to the kernel via ioctl call it’s been marshells into a flat buffer and passed to the other process The parcel contains The name of the destination service in this case media player The function code of the procedure call it needs to invoke And the arguments for that function For example here we want to change the volume of the device So we have two arguments two floats for left and right speaker
  9. Ok now lets do a short recap. Just to make sure that everyone understand the concept . The wants to play sound It warps the arguments in this case an audio file descriptor in a parcel using the userland framework part then the the process sends an ioctl syscall to kernel with the parcel inside The kernel driver parses the destination address of that parcell, and ten copies the parcel data to the target process' address space then the rpc call is invoked and the audio manger trasnmits to kernel to play that audio file And the the response is sent to back the same way to the application proceess
  10. And now we see the real picture on Android. A group of client application, here represented as the green islands, constantly send request to system services via the Binder. On the other side, the system services receive the requests, talk to the hardware via the kernel, and return a reply to the application. This intricate web is what makes Android tick. And now you finally understand that ... “everything goes through the binder” .
  11. Now for the fun part of binder attacks I give you nitty
  12. A thread in an app sets up a listener When the user hits a key, the keyboard server sends a Parcel to an InputContext interface We sniff the Parcel as it goes through the Binder
  13. When the application process starts a new Activity, it calls the ActivityManager. Data that needs to be available to another Activity is sent in the parameters of StartActivity() All we need to do is sniff it in Binder