AnSec2 0
AnSec2 0
AnSec2 0
Android Security
Jonathan Levin
http://NewAndroidBook.com
http://Technologeeks.com
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
About this talk
• Provides- tour
.
of Android security, and insecurity
• Updates Last Year’s talk
- Last year: Features This year: Vulnerabilities
- http://Technologeeks.com/files/AnSec2.0.pdf
– http://www.NewAndroidBook.com/ :
• Free and powerful tools, plus bonus materials
Attack Surface
• Threat models for mobiles consider three main vectors:
- Rogue applications (malware)
- Sandbox applications App Security
- Drive-By/Targetted REMOTE
User carelessness
Abuse system call
Mediaserver compromise
Attack Vectors (exploited)
HTML/Plugin/MIME/etc Malformed SMS/MMS
Suberted Trusted App
Mediaserver compromise
User carelessness
Abuse system call
Total Compromise
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Local Attacks (rogue app, malware) Remote Attacks (input channels) Mobile Security
Subverted Trusted App Remote attacks become local when arbitrary code can be
executed successfully in the context of some vulnerable app
CVEs
• “Common Vulnerability Exposure” index
• Publishes and standardized security vulnerabilities
• Goal: Uniquely define particular and specific bugs
• Main database is at http://cve.mitre.org *
• Searchable database is at http://www.cvedetails.com/
https://www.cvedetails.com/product/19997/Google-Android.html?vendor_id=1224
* - (pronounced: might-er)
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Android Security
A little history
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Android Security
Google Response
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Android Security
• Java Inheritance:
- Dalvik VM provides sandbox for applications
- Declarative security model for operations
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Android Security
Android Architecture
Applications
Contacts
PII
Dalvik Permissions Frameworks SMS
Most malware
Code Signatures Dalvik VM JNI .
Native
Binaries
Native Libraries
Unix permissions,
Capabilities HAL
Bionic System level attacks
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Android Security
Native Libraries
Unix permissions,
Capabilities HAL
Bionic
Scope of Vulnerabilities
• 3rd Party : Affects only devices with installed App
• AOSP:
AOSP : Affects ALL Android devices (global)
• Linux:
Linux : Universal (also desktops, servers)
- Recommended: Monoculture on back of envelope (Geer, Usenix 2005)
3rd Party
AOSP
Vendor
Linux
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Android Security
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Tour of Android Vulnerabilities
Code Injection
• Use-After-Free (ubiquitous)
– Example: char *c = malloc(..); free (c); *c =....;
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Code Injection
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Code Injection
Counter-
CounterMeasures for Code Injection
Opt-in, still not tight enough, keep praying
– isolation/sandboxing, pray SELinux works
Info Leaks, Feng Shui, sprays
– ASLR (ELF PIE + randomize_va_space)
– DEP Return Oriented Programming (ROP)
Directed overwrite
– Stack Canaries and compiler level protections.
– PXN (Privileged eXecute Never) Overflow in kernel
– Restrict dmesg and kernel pointers (via sysctl)
• kernel.kptr_restrict = 2 Info Leaks, sprays in kernel
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Top 3 Risks
– Countermeasures:
• Standard Code Injection Countermeasures
• SELinux
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Top 3 Risks
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Top 3 Risks
- Vector: Local
https://www.blackhat.com/docs/asia-
- Impact: 16/materials/asia-16-He-Hey-Your-Parcel-
Privilege Escalation – system,
Looks-Bad-Fuzzing-And-Exploiting-
likely root
Parcelization-Vulnerabilities-In-Android.pdf
- Reason: LOUSY NATIVE CODE, NO AIDL
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Top 3 Risks
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Top 3 Risks
• Solution: SELinux
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Untrustworthy TrustZone
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Untrustworthy TrustZone
HAL
com.android.application
TZ Daemon
gatekeeper (e.g. qseecomd)
SVC指令
HAL
Kernel
TZ Driver
3rd Party
Android SMC指令
Vendor
Linux
TZ OS
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Untrustworthy TrustZone
TrustZone Vulnerabilities
• Problem: TZ OS is often vendor defined, closed source
– Google trying to standardize with “Trusty OS”
– Qualcomm (most common) has own, and BUGGY
• http://bits-please.blogspot.com
– AMAZING detail of trustzone exploitation on MSM, step-by-step
– Particularly as of /2015/03/getting-arbitrary-code-execution-in.html
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Untrustworthy TrustZone
Android Vulnerabilities
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
Android Security
Hindsight is 20/20
• All the CVEs discussed are obvious, in retrospect:
“Reports that say that something hasn't happened are always interesting to
me, because as we know, there are known knowns; there are things we
know we know. We also know there are known unknowns; that is to say we
know there are some things we do not know. But there are also unknown
unknowns – the ones we don't know we don't know. And if one looks
throughout the history of our country and other free countries, it is the latter
category that tend to be the difficult ones.
D. Rumsfeld, 2002,
http://archive.defense.gov/Transcripts/Transcript.aspx?TranscriptID=2636
(C) 2016 Jonathan Levin & Technologeeks.com - Share freely, but please cite source!
So, overall..
• Technologeeks.com: http://Technologeeks.com/