SlideShare a Scribd company logo
Brief Tour about
           Android Security



Jim Huang ( 黃敬群 ) <jserv@0xlab.org>
Developer, 0xlab
                                      Oct 4, 2012
Rights to copy
                                                                   © Copyright 2012 0xlab
                                                                          http://0xlab.org/
                                                                           contact@0xlab.org
Attribution – ShareAlike 3.0
                                               Corrections, suggestions, contributions and translations
You are free                                                                             are welcome!
   to copy, distribute, display, and perform the work
   to make derivative works                                                 Latest update: Oct 4, 2012
   to make commercial use of the work
Under the following conditions
      Attribution. You must give the original author credit.
      Share Alike. If you alter, transform, or build upon this work, you may distribute the
      resulting work only under a license identical to this one.
   For any reuse or distribution, you must make clear to others the license terms of this work.
   Any of these conditions can be waived if you get permission from the copyright holder.
Your fair use and other rights are in no way affected by the above.
License text: http://creativecommons.org/licenses/by-sa/3.0/legalcode
About Myself

• Contributor, Android Open Source Project
  50+ contributions in AOSP
• Consultant, MediaTek, Inc.
• Maintainer of Chewing ( 新酷音 ) Input Method
• Background:
   – Consumer electronics (smatphone, digital TV,
     feature phone, GPS navigator, medical devices),
     RTOS/Microkernel designs, Compiler optimizations,
     embedded systems
Agenda   (1) Security in Action
         (2) Android Security
         Architecture
         (3) Protection & Prevention
Security in Action
Mobile Devices

• Mobile computers:
  – Mainly smartphones, tablets
  – Sensors: GPS, camera,
    accelerometer, etc.
  – Computation: powerful
    CPUs (≥ 1 GHz, multi-core)
  – Communication: cellular/4G,
    Wi-Fi, near field
    communication (NFC), etc.
• Many connect to cellular
  networks: billing system        Organization
Mobile Threats and Attacks

• Mobile devices make attractive targets:
  – People store much personal info on them: email, calendars,
    contacts, pictures, etc.
  – Sensitive organizational info too…
  – Can fit in pockets, easily lost/stolen
  – Built-in billing system: SMS/MMS (mobile operator), in-app
    purchases (credit card), etc.
     • Many new devices have near field communications
       (NFC), used for contactless payments, etc.
     • Your device becomes your credit card
• Much Android malware, much less for iOS
• NFC-based billing system vulnerabilities
Android: DroidDream Malware

• Infected 58 apps on Android
  Market, March 2011
• 260,000 downloads in 4 days
• How it worked:
  – Rooted phone via Android
    Debug Bridge (adb) vulnerability
  – Sent premium-rate SMS
    messages at night ($$$)

• Google removed apps 4 days
  after release, banned 3
  developers from Market
• More malware found since
Android: Fake Angry Birds Space

• Bot, Trojan
• Masquerades as game
• Roots Android 2.3 devices
  using “Gingerbreak” exploit
• Device joins botnet
Security Philosophy

• Finite time and resources
• Humans are hard to understand risk
• Safer to assume that
  – Most developers do not understand security
  – Most users do not understand security

• Security philosophy cornerstones need to...
  – prevent security breaches from occurring
  – minimize the impact of a security breach
  – detect vulnerabilities and security breaches
  – react to vulnerabilities and security breaches swiftly
Prevent

•   5 million new lines of code
•   Uses almost 100 open source libraries
•   Android is open source ⇒ can't rely on obscurity
•   Concentrated on high risk areas
     – Remote attacks
     – Media codecs
     – New/custom security features
• Low-effort/high-benefit features
   – ProPolice stack overflow protection
   – Heap protection in dlmalloc
Minimize

• We cannot rely on prevention alone
  – Vulnerabilities happen
•   Users will install malware
•   Code will be buggy
•   How can we minimize the impact of a security issue?
•   My webmail cannot access my banking web app
    – Same origin policy
• Why can malware access my browser? my banking
  info?
• Extend the web security model to the OS
Detect

• A lesser-impact security issue is still a security issue
• Internal detection processes
   – Developer education
   – Code audits
   – Fuzzing
   – Honeypot

• Everyone wants security ⇒ allow everyone to detect
  issues
   – Users
   – Developers
   – Security Researchers
React

• Autoupdaters are the best security tool since
  Diffie-Hellman
• Every modern operating system should be responsible
  for:
  – Automatically updating itself
  – Providing a central update system for third-party
    applications

• Android's Over-The-Air update system (OTA)
  – User interaction is optional
  – No additional computer or cable is required
  – Very high update rate
Android Security Architecture
Android Platform Security Architecture

  • Android  re-purposes traditional operating system
    security controls to
      – Protect data
      – Protect system resources (including network)
      – Provide Application isolation

  •   Mandatory application sandbox
  •   Secure interprocess communication
  •   Application signing
  •   Application-defined and user-granted permissions
Linux Security

• Linux is used in millions of security-sensitive
  environments.
   – constantly being researched, attacked, and fixed by
     thousands of developers,
   – Linux has become trusted by many
•   A user-ID-based permissions model
•   Process isolation
•   Extensible mechanism for secure IPC
•   The ability to remove unnecessary and potentially
    insecure parts of the kernel
Android Security Bascis

• Applications, by default, have no permissions
• Permissions list: Manifest.permission
• Applications statically declare the permissions they
  require
   – Android system prompts the user for consent at the time the
     application is installed
   – no mechanism for granting permissions dynamically (at
     run-time)
   – in AndroidManifest.xml, add one or more <uses-permission>
     tags
     <uses-permission android:name=
     "android.permission.RECEIVE_SMS" />
Security Enforcement

• Android protect application at system level and at the
  Inter-component communication (ICC) level. This
  article focus on the ICC level enforcement.
• Each application runs as a unique user identity, which
  lets Android limit the potential damage of programming
  flaws.
Security Enforcement

• Core idea : labels assignment to applications and
  components
• A reference monitor provides mandatory access
  control (MAC) enforcement of how applications access
  components.
• Access to each component is restricted by assigning it
  an access permission label; applications are assigned
  collections of permission labels.
Android Security Extra

• Hardware-based No eXecute (NX) to prevent code
  execution on the stack and heap
• ProPolice canaries to prevent stack buffer overruns
• safe-iop safe integer op lib for C
• Extensions to dlmalloc to prevent double free()
  vulnerabilities and to prevent heap exploits
• OpenBSD calloc to prevent integer overflows during
  memory allocation
• Linux mmap_min_addr() to mitigate null pointer
  dereference privilege escalation
dlmalloc
                 (written by Doug Lea)

• Heap consolidation attack
• Allocation meta-data is stored in
  band
• Heap overflow can perform 2
  arbitrary pointer overwrites
• To fix, check:
   – b->fd->bk == b
   – b->bk->fd == b
System Files

• The system partition
   – Android's kernel as well as the OS libraries,
     application runtime, application framework, and
     applications.
   – set to read-only
• When a user boots the device into Safe Mode
  – only core Android applications are available.
  – free of third-party software.
OS Protected APIs

• Cost-Sensitive APIs
  – Telephony
  – SMS/MMS
  – Network/Data connections
  – In-App Billing
  – NFC Access

• Sensitive Data Input Devices
  – Location data (GPS)
  – Camera functions
  – microphone

• Bluetooth functions
• Personal Information
IPC

• Standard IPC
   – file system, local sockets, or signals.
   – Linux permissions still apply.

• new IPC mechanisms:
• Binder: RPC mechanism for in-process and
  cross-process calls. Via a custom Linux driver.
• Services: interfaces directly accessible using binder.
• Intents: A message object that represents an
  "intention" to do something.
• ContentProviders: A data storehouse
Application Signing

• Why self signing?
  – Market ties identity to developer account
  – CAs have had major problems with fidelity in the past
  – No applications are trusted.  No "magic key"

• What does signing determine?
  – Shared UID for shared keys
  – Self-updates
Application Signing

• All .apk files must be signed with a certificate
   – identifies the author of the application.
   – does not need to be signed by a certificate authority

• allows the system to grant or deny applications
   – access to signature-level permissions
   – request to be given the same Linux identity as another
     application.

• If the public key matches the key used to sign any
  other APK, the new APK may request to share a UID
  with the other APK.
Device Administration

•   Since Android 3.0
•   Remote wipe
•   Require strong password
•   Full device encryption
•   Disable camera
Permissions

• Whitelist model
  – Allow minimal access by default
  – User accepted access

• Ask users fewer questions
• Make questions more understandable
• 194 permissions

  PERMISSION_GRANTED or PERMISSION_DENIED
  Context.checkCallingPermission() Arbitrarily
  fine-grained permissions
  Context.checkPermission(String, pid, uid)
Android Sandbox

• The sandbox is based on separation of
  – Processes
  – file permissions
  – Authenticated IPC

• Each application
  – is a different “user”; its own UID
  – runs in its own Linux process
  – its own Dalvik VM

• Sandboxes native code and sys applications
Android Sandbox

• Place access controls close to the resource, not in the
  VM
   – Smaller perimeter ⇒ easier to protect
•   Default Linux applications have too much power
•   Lock down user access for a "default" application
•   Fully locked down applications limit innovation
•   Relying on users making correct security decisions is
    tricky
File-system Encryption

•   full file system encryption
•   Android 3.0 and later
•   AES128
•   Password + random salt
Other Protections

• Mechanisms:
  – Android 1.5+: stack buffer, integer overflow protection;
    double free, chunk consolidation attack prevention
  – Android 2.3+: format string protection, NX, null pointer
    dereference mitigation
  – Android 4.0+: ASLR implemented
  – Android 4.1+: ASLR strengthened, plug kernel leaks
Rooting of Android Devices

• root
  – uid == 0 as in Linux
  – has full access to all
  – applications and all application data
  – System
  – the kernel and a few core applications

• Boot Loaders
  – embedded system boot techniques
  – “Locked”: Check a signature of the OS files being booted, or
    installed.
SIM Card Access

• Low level access to the SIM card is not available to
  third-party apps.
• The OS handles all communications with the SIM card
  including access to personal information (contacts) on
  the SIM card memory.
• Applications also cannot access AT commands, as
  these are managed exclusively by the Radio Interface
  Layer (RIL). The RIL provides no high level APIs for
  these commands.
GSM Vulnerabilities

• GSM
  – Largest Mobile network in the world
  – 3.8 billion phones on network
• David Hulton and Steve Muller developed method to
  quickly crack GSM encryption
   – Can crack encryption in under 30 seconds
   – Allows for undetectable evesdropping
• Similar exploits available for CDMA phones
SMS Vulnerabilities

• Short Messaging System
   – Very commonly used protocol
   – Used to send "Text Messages"
• GSM uses 2 signal bands, 1 for "control", the other for
  "data".
   – SMS operates entirely on the "control" band.
• High volume text messaging can disable the "control"
  band, which also disables voice calls.
• Can render entire city 911 services unresponsive.
MMS Vulnerabilities

• Unsecure data protocol for GSM
• Extends SMS, allows for WAP connectivity
• Exploit of MMS can drain battery 22x faster
• Multiple UDP requests are sent concurrently, draining
  the battery as it responds to request
• Does not expose data
• Does make phone useless
Case Study: Android SMS worm

• Worm spreads to all contacts via social engineering,
  sideloading, etc.
• Logger stored/forwarded all received SMS messages
• Only needed SEND_SMS, RECEIVE_SMS,
  READ_SMS permissions
• Can send 100 SMS messages/hour
• One group put SMS logger on Google Play
Bluetooth Vulnerabilities

• Short range wireless communication protocol
• Used in many personal electronic devices
• Requires no authentication
• An attack, if close enough, could take over Bluetooth
  device.
• Attack would have access to all data on the Bluetooth
  enabled device
• Practice known as bluesnarfing
Case Study: Google Wallet
• Google Wallet enables smartphone payments
  – Uses NFC technology
• credit card info stored securely in secure element
   – Separate chip, SD card, SIM card
   – Unfortunately, other data are not stored as securely
Case Study: Google Wallet

• Some information can be recovered from databases
  on phone:
  – Name on credit card
  – Expiration date
  – Recent transactions

• Google Analytics tracking can reveal customer
  behavior from non-SSL HTTP GET requests
• NFC alone does not guarantee security
   – Radio eavesdropping, data modification possible
   – Relay attacks, spoofing possible with libnfc
Sophisticated NFC Attack in Android

 • Charlie Miller’s Black Hat 2012 presentation: Android
   phones can be hijacked via NFC
   – NFC/Android Beam on by default on Android 2.3+, Android
     4.0+
   – Place phone 3–4 cm away from NFC tag, other
     NFC-enabled phone
   – Attacker-controlled phone sends data to tag/device, can
     crash NFC daemon, Android OS
   – For Android 4.0–4.0.1, can remotely open device browser to
     attacker-controlled webpage
Information Misuse by Apps

• phone identifiers: phone number, IMEI (device
  identifier), IMSI (subscriber identifier), and ICC-ID
  (SIM card serial number).
• Phone identifiers are frequently leaked through
  plaintext requests.
• Phone identifiers are used as device fingerprints.
• Phone identifiers, specifically the IMEI, are used to
  track individual users.
• Not all phone identifier use leads to exfiltration.
• Phone identifiers are sent to advertisement and
  analytics servers.
Protections and Prevention
Information Leaking in Mobile Device

 • Types of mobile device information sources:
    – Internal to device (e.g., GPS location, IMEI, etc.)
    – External sources (e.g., CNN, Chase Bank, etc.)

 • Third-party mobile apps can leak info to external
   sources
    – Send out device ID (IMEI/EID), contacts, location, etc.
    – Apps ask permissions to access such info; users can ignore!
    – Apps can intercept info sent to a source, send to different
      destination!

 • Motives:
    – Monitor employees’ activity using accelerometers
    – Ads, market research (user location, behavior, etc.)
Information Tracking Flow (ITF)

• IFT tracks each information flow among internal,
  external sources
  – Each flow is tagged, e.g., “untrusted”
  – Tag propagated as information flows among internal,
    external sources
  – Sound alarm if data sent to third party

• Challenges
  – Reasonable runtime,
    space overhead
  – Many information sources
TaintDroid

• IFT system on Android 2.1
• System firmware (not app)
• Modifies Android’s Dalvik VM, tracks info flows across
  methods, classes, files
                     TaintDroid
• Tracks the following info:
   – Sensors: GPS, camera, accelerometer, microphone of taint
                      • TaintDroid is a system-wide integration
                               tracking into the Android platform
   – Internal info: contacts, phone #, IMEI, IMSI, Google acct
                               ‣ Variable tracking throughout Dalvik VM environment
   – External info: network, Patches state after native method invocation
                          ‣ SMS
                               ‣ Extends tracking between applications and to storage
• Notifies user of info leakage                            M e s s a g e -le v e l tra c k in g


                                              Application Code            Msg               Application Code

                                              Virtual                                      Virtual             V a ria b le -le v e l
                                              Machine                                      Machine             tra c k in g

                                                           Native System Libraries                             M e th o d -le v e l
                                                                                                               tra c k in g
                                                                                                               F ile -le v e l
                                                 Network Interface                  Secondary Storage
                                                                                                               tra c k in g
Bit #
                                                                                          TaintDroid
                                                                                             Tracks
  • Use a 32-bit tag structure                                                    31–             Unused
  • Set bit indicates an information flow                                         16
                                                                                  15           History sent out
     (or sensor in use)
                                                                                  14      Google account sent out
  • Tested 30 popular Android apps (Internet                                      13       Device serial # sent out
     permission)                                                                  12     ICCID (SIM card ID) sent
                                                                                                     out
  • 37/105 flagged network connections were                                       11     IMSI (subscriber ID) sent
     legitimate                                                                                      out
Application S tudy                                                                10      IMEI (device ID) sent out
  • 15/30 apps leaked data to ad/market                                            9            SMS sent out
 • Selected 30 applications with bias on popularity and
     research firms, (admob.com, flurry.com,                                       8        Accelerometer in use
   access to Internet, location,user
     etc.); not obvious to microphone, and camera                                  7           Camera in use
                                                                                   6       “Last” location sent out
                       applications                           #    permissions     5     Data sent out over network
   The Weather C hannel, C etos, Solitarie, Movies, Babble,                        4        GPS location sent out
   Manga Browser                                              6
                                                                                   3          Phone # sent out
   Bump,Wertago, Antivirus, ABC --- Animals,Traffic Jam,
   Hearts, Blackjack, Horoscope, 3001 W isdom Quotes Lite,                         2         Microphone in use
   Yellow Pages, Datelefonbuch, Astrid, BBC News Live         14                   1         Contacts sent out
   Stream, Ringtones
                                                                                   0          Location sent out
   Layer, Knocking, C oupons,Trapster, Spongebot Slide,
   ProBasketBall                                              6
   MySpace, Barcode Scanner, ixMAT                            3
   Evernote                                                   1
Realtime Protection

• Apps developed to monitor other applications
   – Lookout Security & Antivirus
   – Also monitors for privacy leaks
• Have the ability to monitor the inter process
  communication
• Monitor for malicious activity
Pre-installation Detection

• Kirin security tool
• Analyze security configuration from the package
  manifest before app installation
• Every application has a security configuration which
  tells the OS what inter-process communication (IPC)
  are going to be used
Reference
Reference

• Android Security Overview, source.android
  . com/tech/security/
• Nils, “Building Android Sandcastles in Android’s
  Sandbox,” Oct 2010, BlackHat
• William Enck, Damien Octeau, Patrick McDaniel, and
  Swarat Chaudhuri, “A Study of Android Application
  Security”, 20th USENIX Security, Aug 2011
http://0xlab.org

More Related Content

PPTX
Android sandbox
PDF
Deep Dive Into Android Security
PDF
Смирнов Александр, Security in Android Application
PPTX
Android Security
PDF
Android Camp 2011 @ Silicon India
PDF
Android Security Overview and Safe Practices for Web-Based Android Applications
PDF
Android Security - Common Security Pitfalls in Android Applications
PPT
Android Security
Android sandbox
Deep Dive Into Android Security
Смирнов Александр, Security in Android Application
Android Security
Android Camp 2011 @ Silicon India
Android Security Overview and Safe Practices for Web-Based Android Applications
Android Security - Common Security Pitfalls in Android Applications
Android Security

What's hot (20)

PPTX
Android security
PDF
Introduction to Android Development and Security
PDF
Android Security
PPTX
Android secure offline storage - CC Mobile
PPT
Analysis and research of system security based on android
PDF
Stealing sensitive data from android phones the hacker way
PPTX
Android security
PDF
Building Custom Android Malware BruCON 2013
PPTX
Understanding android security model
ODP
Android security in depth
PDF
Android security
PDF
Sperasoft talks: Android Security Threats
PDF
Security Testing Mobile Applications
PPT
Understanding Android Security
PDF
2015.04.24 Updated > Android Security Development - Part 1: App Development
PPTX
Mobile security
PPT
Mobile Application Security – Effective methodology, efficient testing!
PDF
Securing Android
PPT
Bypassing the Android Permission Model
PPTX
Android Device Hardening
Android security
Introduction to Android Development and Security
Android Security
Android secure offline storage - CC Mobile
Analysis and research of system security based on android
Stealing sensitive data from android phones the hacker way
Android security
Building Custom Android Malware BruCON 2013
Understanding android security model
Android security in depth
Android security
Sperasoft talks: Android Security Threats
Security Testing Mobile Applications
Understanding Android Security
2015.04.24 Updated > Android Security Development - Part 1: App Development
Mobile security
Mobile Application Security – Effective methodology, efficient testing!
Securing Android
Bypassing the Android Permission Model
Android Device Hardening
Ad

Viewers also liked (19)

PPTX
Android security model
PDF
Android system security
PDF
Explore Android Internals
PDF
Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...
PDF
Low Level View of Android System Architecture
PDF
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...
PDF
Android Security & Penetration Testing
PDF
2016 年春季嵌入式作業系統課程說明
PDF
Testing Android Security Codemotion Amsterdam edition
PDF
Android Security Development
PDF
Making Linux do Hard Real-time
PPTX
Security testing of mobile applications
PDF
Embedded Android Workshop at AnDevCon IV
PDF
Android Security, From the Ground Up
PDF
Android N Security Overview - Mobile Security Saturday at Ciklum
PPTX
Untitled 1
PDF
Firebase analytics for_android _ i_os
PDF
Security in Android Application, Александр Смирнов, RedMadRobot, Москва
PPTX
Android security model
Android system security
Explore Android Internals
Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...
Low Level View of Android System Architecture
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...
Android Security & Penetration Testing
2016 年春季嵌入式作業系統課程說明
Testing Android Security Codemotion Amsterdam edition
Android Security Development
Making Linux do Hard Real-time
Security testing of mobile applications
Embedded Android Workshop at AnDevCon IV
Android Security, From the Ground Up
Android N Security Overview - Mobile Security Saturday at Ciklum
Untitled 1
Firebase analytics for_android _ i_os
Security in Android Application, Александр Смирнов, RedMadRobot, Москва
Ad

Similar to Brief Tour about Android Security (20)

PPT
Securely Deploying Android Device - ISSA (Ireland)
PPTX
Mobile platform security models
PPTX
19-f15-mobile-security.pptx
PPTX
Hacker Halted 2014 - Reverse Engineering the Android OS
PDF
Mediating Applications on the Android System
PPT
network security for mobile and others types
PDF
CodeMotion tel aviv 2015 - burning marshmallows
PPTX
Mobile security
PPTX
128-ch4.pptx
PPTX
Android village @nullcon 2012
PDF
CNIT 128 Ch 4: Android
PDF
Reading Group Presentation: Why Eve and Mallory Love Android
PDF
Maemo 6 Platform Security
PDF
CNIT 128 Ch 1: The mobile risk ecosystem
PDF
Android Attacks
PDF
Mobile Securty - An Oxymoron?
PPTX
Android OS & Security.pptx
PPTX
Android security
PDF
DEF CON 24 - Dinesh and Shetty - practical android application exploitation
PPT
Outsmarting SmartPhones
Securely Deploying Android Device - ISSA (Ireland)
Mobile platform security models
19-f15-mobile-security.pptx
Hacker Halted 2014 - Reverse Engineering the Android OS
Mediating Applications on the Android System
network security for mobile and others types
CodeMotion tel aviv 2015 - burning marshmallows
Mobile security
128-ch4.pptx
Android village @nullcon 2012
CNIT 128 Ch 4: Android
Reading Group Presentation: Why Eve and Mallory Love Android
Maemo 6 Platform Security
CNIT 128 Ch 1: The mobile risk ecosystem
Android Attacks
Mobile Securty - An Oxymoron?
Android OS & Security.pptx
Android security
DEF CON 24 - Dinesh and Shetty - practical android application exploitation
Outsmarting SmartPhones

More from National Cheng Kung University (20)

PDF
PyPy's approach to construct domain-specific language runtime
PDF
Interpreter, Compiler, JIT from scratch
PDF
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
PDF
Construct an Efficient and Secure Microkernel for IoT
PDF
The Internals of "Hello World" Program
PDF
How A Compiler Works: GNU Toolchain
PDF
Virtual Machine Constructions for Dummies
PDF
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
PDF
從線上售票看作業系統設計議題
PDF
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
PDF
Xvisor: embedded and lightweight hypervisor
PDF
Making Linux do Hard Real-time
PDF
Implement Runtime Environments for HSA using LLVM
PDF
Priority Inversion on Mars
PDF
Develop Your Own Operating Systems using Cheap ARM Boards
PDF
Lecture notice about Embedded Operating System Design and Implementation
PDF
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
PDF
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
PDF
Open Source from Legend, Business, to Ecosystem
PDF
Summer Project: Microkernel (2013)
PyPy's approach to construct domain-specific language runtime
Interpreter, Compiler, JIT from scratch
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
Construct an Efficient and Secure Microkernel for IoT
The Internals of "Hello World" Program
How A Compiler Works: GNU Toolchain
Virtual Machine Constructions for Dummies
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
從線上售票看作業系統設計議題
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
Xvisor: embedded and lightweight hypervisor
Making Linux do Hard Real-time
Implement Runtime Environments for HSA using LLVM
Priority Inversion on Mars
Develop Your Own Operating Systems using Cheap ARM Boards
Lecture notice about Embedded Operating System Design and Implementation
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
Open Source from Legend, Business, to Ecosystem
Summer Project: Microkernel (2013)

Recently uploaded (20)

PDF
Modernizing your data center with Dell and AMD
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Cloud computing and distributed systems.
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Network Security Unit 5.pdf for BCA BBA.
PPT
Teaching material agriculture food technology
PPTX
A Presentation on Artificial Intelligence
PDF
Encapsulation theory and applications.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Big Data Technologies - Introduction.pptx
Modernizing your data center with Dell and AMD
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Review of recent advances in non-invasive hemoglobin estimation
Cloud computing and distributed systems.
Understanding_Digital_Forensics_Presentation.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25 Week I
MYSQL Presentation for SQL database connectivity
Diabetes mellitus diagnosis method based random forest with bat algorithm
Network Security Unit 5.pdf for BCA BBA.
Teaching material agriculture food technology
A Presentation on Artificial Intelligence
Encapsulation theory and applications.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Unlocking AI with Model Context Protocol (MCP)
Encapsulation_ Review paper, used for researhc scholars
Big Data Technologies - Introduction.pptx

Brief Tour about Android Security

  • 1. Brief Tour about Android Security Jim Huang ( 黃敬群 ) <jserv@0xlab.org> Developer, 0xlab Oct 4, 2012
  • 2. Rights to copy © Copyright 2012 0xlab http://0xlab.org/ contact@0xlab.org Attribution – ShareAlike 3.0 Corrections, suggestions, contributions and translations You are free are welcome! to copy, distribute, display, and perform the work to make derivative works Latest update: Oct 4, 2012 to make commercial use of the work Under the following conditions Attribution. You must give the original author credit. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. License text: http://creativecommons.org/licenses/by-sa/3.0/legalcode
  • 3. About Myself • Contributor, Android Open Source Project 50+ contributions in AOSP • Consultant, MediaTek, Inc. • Maintainer of Chewing ( 新酷音 ) Input Method • Background: – Consumer electronics (smatphone, digital TV, feature phone, GPS navigator, medical devices), RTOS/Microkernel designs, Compiler optimizations, embedded systems
  • 4. Agenda (1) Security in Action (2) Android Security Architecture (3) Protection & Prevention
  • 6. Mobile Devices • Mobile computers: – Mainly smartphones, tablets – Sensors: GPS, camera, accelerometer, etc. – Computation: powerful CPUs (≥ 1 GHz, multi-core) – Communication: cellular/4G, Wi-Fi, near field communication (NFC), etc. • Many connect to cellular networks: billing system Organization
  • 7. Mobile Threats and Attacks • Mobile devices make attractive targets: – People store much personal info on them: email, calendars, contacts, pictures, etc. – Sensitive organizational info too… – Can fit in pockets, easily lost/stolen – Built-in billing system: SMS/MMS (mobile operator), in-app purchases (credit card), etc. • Many new devices have near field communications (NFC), used for contactless payments, etc. • Your device becomes your credit card • Much Android malware, much less for iOS • NFC-based billing system vulnerabilities
  • 8. Android: DroidDream Malware • Infected 58 apps on Android Market, March 2011 • 260,000 downloads in 4 days • How it worked: – Rooted phone via Android Debug Bridge (adb) vulnerability – Sent premium-rate SMS messages at night ($$$) • Google removed apps 4 days after release, banned 3 developers from Market • More malware found since
  • 9. Android: Fake Angry Birds Space • Bot, Trojan • Masquerades as game • Roots Android 2.3 devices using “Gingerbreak” exploit • Device joins botnet
  • 10. Security Philosophy • Finite time and resources • Humans are hard to understand risk • Safer to assume that – Most developers do not understand security – Most users do not understand security • Security philosophy cornerstones need to... – prevent security breaches from occurring – minimize the impact of a security breach – detect vulnerabilities and security breaches – react to vulnerabilities and security breaches swiftly
  • 11. Prevent • 5 million new lines of code • Uses almost 100 open source libraries • Android is open source ⇒ can't rely on obscurity • Concentrated on high risk areas – Remote attacks – Media codecs – New/custom security features • Low-effort/high-benefit features – ProPolice stack overflow protection – Heap protection in dlmalloc
  • 12. Minimize • We cannot rely on prevention alone – Vulnerabilities happen • Users will install malware • Code will be buggy • How can we minimize the impact of a security issue? • My webmail cannot access my banking web app – Same origin policy • Why can malware access my browser? my banking info? • Extend the web security model to the OS
  • 13. Detect • A lesser-impact security issue is still a security issue • Internal detection processes – Developer education – Code audits – Fuzzing – Honeypot • Everyone wants security ⇒ allow everyone to detect issues – Users – Developers – Security Researchers
  • 14. React • Autoupdaters are the best security tool since Diffie-Hellman • Every modern operating system should be responsible for: – Automatically updating itself – Providing a central update system for third-party applications • Android's Over-The-Air update system (OTA) – User interaction is optional – No additional computer or cable is required – Very high update rate
  • 16. Android Platform Security Architecture • Android  re-purposes traditional operating system security controls to – Protect data – Protect system resources (including network) – Provide Application isolation • Mandatory application sandbox • Secure interprocess communication • Application signing • Application-defined and user-granted permissions
  • 17. Linux Security • Linux is used in millions of security-sensitive environments. – constantly being researched, attacked, and fixed by thousands of developers, – Linux has become trusted by many • A user-ID-based permissions model • Process isolation • Extensible mechanism for secure IPC • The ability to remove unnecessary and potentially insecure parts of the kernel
  • 18. Android Security Bascis • Applications, by default, have no permissions • Permissions list: Manifest.permission • Applications statically declare the permissions they require – Android system prompts the user for consent at the time the application is installed – no mechanism for granting permissions dynamically (at run-time) – in AndroidManifest.xml, add one or more <uses-permission> tags <uses-permission android:name= "android.permission.RECEIVE_SMS" />
  • 19. Security Enforcement • Android protect application at system level and at the Inter-component communication (ICC) level. This article focus on the ICC level enforcement. • Each application runs as a unique user identity, which lets Android limit the potential damage of programming flaws.
  • 20. Security Enforcement • Core idea : labels assignment to applications and components • A reference monitor provides mandatory access control (MAC) enforcement of how applications access components. • Access to each component is restricted by assigning it an access permission label; applications are assigned collections of permission labels.
  • 21. Android Security Extra • Hardware-based No eXecute (NX) to prevent code execution on the stack and heap • ProPolice canaries to prevent stack buffer overruns • safe-iop safe integer op lib for C • Extensions to dlmalloc to prevent double free() vulnerabilities and to prevent heap exploits • OpenBSD calloc to prevent integer overflows during memory allocation • Linux mmap_min_addr() to mitigate null pointer dereference privilege escalation
  • 22. dlmalloc (written by Doug Lea) • Heap consolidation attack • Allocation meta-data is stored in band • Heap overflow can perform 2 arbitrary pointer overwrites • To fix, check: – b->fd->bk == b – b->bk->fd == b
  • 23. System Files • The system partition – Android's kernel as well as the OS libraries, application runtime, application framework, and applications. – set to read-only • When a user boots the device into Safe Mode – only core Android applications are available. – free of third-party software.
  • 24. OS Protected APIs • Cost-Sensitive APIs – Telephony – SMS/MMS – Network/Data connections – In-App Billing – NFC Access • Sensitive Data Input Devices – Location data (GPS) – Camera functions – microphone • Bluetooth functions • Personal Information
  • 25. IPC • Standard IPC – file system, local sockets, or signals. – Linux permissions still apply. • new IPC mechanisms: • Binder: RPC mechanism for in-process and cross-process calls. Via a custom Linux driver. • Services: interfaces directly accessible using binder. • Intents: A message object that represents an "intention" to do something. • ContentProviders: A data storehouse
  • 26. Application Signing • Why self signing? – Market ties identity to developer account – CAs have had major problems with fidelity in the past – No applications are trusted.  No "magic key" • What does signing determine? – Shared UID for shared keys – Self-updates
  • 27. Application Signing • All .apk files must be signed with a certificate – identifies the author of the application. – does not need to be signed by a certificate authority • allows the system to grant or deny applications – access to signature-level permissions – request to be given the same Linux identity as another application. • If the public key matches the key used to sign any other APK, the new APK may request to share a UID with the other APK.
  • 28. Device Administration • Since Android 3.0 • Remote wipe • Require strong password • Full device encryption • Disable camera
  • 29. Permissions • Whitelist model – Allow minimal access by default – User accepted access • Ask users fewer questions • Make questions more understandable • 194 permissions PERMISSION_GRANTED or PERMISSION_DENIED Context.checkCallingPermission() Arbitrarily fine-grained permissions Context.checkPermission(String, pid, uid)
  • 30. Android Sandbox • The sandbox is based on separation of – Processes – file permissions – Authenticated IPC • Each application – is a different “user”; its own UID – runs in its own Linux process – its own Dalvik VM • Sandboxes native code and sys applications
  • 31. Android Sandbox • Place access controls close to the resource, not in the VM – Smaller perimeter ⇒ easier to protect • Default Linux applications have too much power • Lock down user access for a "default" application • Fully locked down applications limit innovation • Relying on users making correct security decisions is tricky
  • 32. File-system Encryption • full file system encryption • Android 3.0 and later • AES128 • Password + random salt
  • 33. Other Protections • Mechanisms: – Android 1.5+: stack buffer, integer overflow protection; double free, chunk consolidation attack prevention – Android 2.3+: format string protection, NX, null pointer dereference mitigation – Android 4.0+: ASLR implemented – Android 4.1+: ASLR strengthened, plug kernel leaks
  • 34. Rooting of Android Devices • root – uid == 0 as in Linux – has full access to all – applications and all application data – System – the kernel and a few core applications • Boot Loaders – embedded system boot techniques – “Locked”: Check a signature of the OS files being booted, or installed.
  • 35. SIM Card Access • Low level access to the SIM card is not available to third-party apps. • The OS handles all communications with the SIM card including access to personal information (contacts) on the SIM card memory. • Applications also cannot access AT commands, as these are managed exclusively by the Radio Interface Layer (RIL). The RIL provides no high level APIs for these commands.
  • 36. GSM Vulnerabilities • GSM – Largest Mobile network in the world – 3.8 billion phones on network • David Hulton and Steve Muller developed method to quickly crack GSM encryption – Can crack encryption in under 30 seconds – Allows for undetectable evesdropping • Similar exploits available for CDMA phones
  • 37. SMS Vulnerabilities • Short Messaging System – Very commonly used protocol – Used to send "Text Messages" • GSM uses 2 signal bands, 1 for "control", the other for "data". – SMS operates entirely on the "control" band. • High volume text messaging can disable the "control" band, which also disables voice calls. • Can render entire city 911 services unresponsive.
  • 38. MMS Vulnerabilities • Unsecure data protocol for GSM • Extends SMS, allows for WAP connectivity • Exploit of MMS can drain battery 22x faster • Multiple UDP requests are sent concurrently, draining the battery as it responds to request • Does not expose data • Does make phone useless
  • 39. Case Study: Android SMS worm • Worm spreads to all contacts via social engineering, sideloading, etc. • Logger stored/forwarded all received SMS messages • Only needed SEND_SMS, RECEIVE_SMS, READ_SMS permissions • Can send 100 SMS messages/hour • One group put SMS logger on Google Play
  • 40. Bluetooth Vulnerabilities • Short range wireless communication protocol • Used in many personal electronic devices • Requires no authentication • An attack, if close enough, could take over Bluetooth device. • Attack would have access to all data on the Bluetooth enabled device • Practice known as bluesnarfing
  • 41. Case Study: Google Wallet • Google Wallet enables smartphone payments – Uses NFC technology • credit card info stored securely in secure element – Separate chip, SD card, SIM card – Unfortunately, other data are not stored as securely
  • 42. Case Study: Google Wallet • Some information can be recovered from databases on phone: – Name on credit card – Expiration date – Recent transactions • Google Analytics tracking can reveal customer behavior from non-SSL HTTP GET requests • NFC alone does not guarantee security – Radio eavesdropping, data modification possible – Relay attacks, spoofing possible with libnfc
  • 43. Sophisticated NFC Attack in Android • Charlie Miller’s Black Hat 2012 presentation: Android phones can be hijacked via NFC – NFC/Android Beam on by default on Android 2.3+, Android 4.0+ – Place phone 3–4 cm away from NFC tag, other NFC-enabled phone – Attacker-controlled phone sends data to tag/device, can crash NFC daemon, Android OS – For Android 4.0–4.0.1, can remotely open device browser to attacker-controlled webpage
  • 44. Information Misuse by Apps • phone identifiers: phone number, IMEI (device identifier), IMSI (subscriber identifier), and ICC-ID (SIM card serial number). • Phone identifiers are frequently leaked through plaintext requests. • Phone identifiers are used as device fingerprints. • Phone identifiers, specifically the IMEI, are used to track individual users. • Not all phone identifier use leads to exfiltration. • Phone identifiers are sent to advertisement and analytics servers.
  • 46. Information Leaking in Mobile Device • Types of mobile device information sources: – Internal to device (e.g., GPS location, IMEI, etc.) – External sources (e.g., CNN, Chase Bank, etc.) • Third-party mobile apps can leak info to external sources – Send out device ID (IMEI/EID), contacts, location, etc. – Apps ask permissions to access such info; users can ignore! – Apps can intercept info sent to a source, send to different destination! • Motives: – Monitor employees’ activity using accelerometers – Ads, market research (user location, behavior, etc.)
  • 47. Information Tracking Flow (ITF) • IFT tracks each information flow among internal, external sources – Each flow is tagged, e.g., “untrusted” – Tag propagated as information flows among internal, external sources – Sound alarm if data sent to third party • Challenges – Reasonable runtime, space overhead – Many information sources
  • 48. TaintDroid • IFT system on Android 2.1 • System firmware (not app) • Modifies Android’s Dalvik VM, tracks info flows across methods, classes, files TaintDroid • Tracks the following info: – Sensors: GPS, camera, accelerometer, microphone of taint • TaintDroid is a system-wide integration tracking into the Android platform – Internal info: contacts, phone #, IMEI, IMSI, Google acct ‣ Variable tracking throughout Dalvik VM environment – External info: network, Patches state after native method invocation ‣ SMS ‣ Extends tracking between applications and to storage • Notifies user of info leakage M e s s a g e -le v e l tra c k in g Application Code Msg Application Code Virtual Virtual V a ria b le -le v e l Machine Machine tra c k in g Native System Libraries M e th o d -le v e l tra c k in g F ile -le v e l Network Interface Secondary Storage tra c k in g
  • 49. Bit # TaintDroid Tracks • Use a 32-bit tag structure 31– Unused • Set bit indicates an information flow 16 15 History sent out (or sensor in use) 14 Google account sent out • Tested 30 popular Android apps (Internet 13 Device serial # sent out permission) 12 ICCID (SIM card ID) sent out • 37/105 flagged network connections were 11 IMSI (subscriber ID) sent legitimate out Application S tudy 10 IMEI (device ID) sent out • 15/30 apps leaked data to ad/market 9 SMS sent out • Selected 30 applications with bias on popularity and research firms, (admob.com, flurry.com, 8 Accelerometer in use access to Internet, location,user etc.); not obvious to microphone, and camera 7 Camera in use 6 “Last” location sent out applications # permissions 5 Data sent out over network The Weather C hannel, C etos, Solitarie, Movies, Babble, 4 GPS location sent out Manga Browser 6 3 Phone # sent out Bump,Wertago, Antivirus, ABC --- Animals,Traffic Jam, Hearts, Blackjack, Horoscope, 3001 W isdom Quotes Lite, 2 Microphone in use Yellow Pages, Datelefonbuch, Astrid, BBC News Live 14 1 Contacts sent out Stream, Ringtones 0 Location sent out Layer, Knocking, C oupons,Trapster, Spongebot Slide, ProBasketBall 6 MySpace, Barcode Scanner, ixMAT 3 Evernote 1
  • 50. Realtime Protection • Apps developed to monitor other applications – Lookout Security & Antivirus – Also monitors for privacy leaks • Have the ability to monitor the inter process communication • Monitor for malicious activity
  • 51. Pre-installation Detection • Kirin security tool • Analyze security configuration from the package manifest before app installation • Every application has a security configuration which tells the OS what inter-process communication (IPC) are going to be used
  • 53. Reference • Android Security Overview, source.android . com/tech/security/ • Nils, “Building Android Sandcastles in Android’s Sandbox,” Oct 2010, BlackHat • William Enck, Damien Octeau, Patrick McDaniel, and Swarat Chaudhuri, “A Study of Android Application Security”, 20th USENIX Security, Aug 2011