exploring vulnerabilities in android 6.0 fingerprint ...delaat/rp/2015... · exploring...

34
Exploring vulnerabilities in Android 6.0 fingerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016 Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 1 / 34

Upload: others

Post on 07-Aug-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Exploring vulnerabilities in Android 6.0fingerprint authentication

Thom Does & Mike Maarse

KPMG

02-02-2016

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 1 / 34

Page 2: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Introduction

Motivation/relevance

Preferred authentication method by users

Growing number of mobile devices with fingerprint hardwareI 990 million in 2017 (Goode Intelligence)I Over 50% of all smartphones by 2019 (MarketResearch.com)

Used to protect sensitive data/transactions

Android 6.0 provides ”native” support through API

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 2 / 34

Page 3: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Introduction

Motivation/relevance

Preferred authentication method by users

Growing number of mobile devices with fingerprint hardwareI 990 million in 2017 (Goode Intelligence)I Over 50% of all smartphones by 2019 (MarketResearch.com)

Used to protect sensitive data/transactions

Android 6.0 provides ”native” support through API

Research question

Is it possible to bypass Android 6.0’s fingerprint authentication, bymodifying its vendor-independent software components, or by tamperingwith their interprocess communication?

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 3 / 34

Page 4: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Introduction

Motivation/relevance

Preferred authentication method by users

Growing number of mobile devices with fingerprint hardwareI 990 million in 2017 (Goode Intelligence)I Over 50% of all smartphones by 2019 (MarketResearch.com)

Used to protect sensitive data/transactions

Android 6.0 provides ”native” support through API

Research question

Is it possible to bypass Android 6.0’s fingerprint authentication, bymodifying its vendor-independent software components, or by tamperingwith their interprocess communication?

The short answer...

Yes, in both cases!

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 4 / 34

Page 5: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Results

1. False positive recognition

Fingerprints not enrolled can perform authentication

... or any capacitative body part (live demo)

2. Forced release of authentication protected keys

Allows attackers to perform cryptographic operationsI Decrypt sensitive data

Attacks possible within vendor specific time-frame

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 5 / 34

Page 6: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Impact

Determined by number of API implementations

Compromises apps handling sensitive dataI Financial transactionsI Personal data

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 6 / 34

Page 7: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Case study bol.com

First large Dutch web shop to use fingerprint authentication

Observations1 Triggers authentication on:

I checkoutI editing user profile

2 Trusts rooted device

3 Does not use the keystore

Figure 1: bol.com app dialog

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 7 / 34

Page 8: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Methodology - Equipment

Hardware

Figure 2: LG Nexus 5X

Software

Android 6.0 ”bullhead” (MDA89E)

Android SDK platform tools

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 8 / 34

Page 9: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Methodology - Approach

Explore the authentication system

Analyse source code

Replace software components

Intercept and manipulate IPC

Goal

Forcing a successful authentication by returning a positive result code.

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 9 / 34

Page 10: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Software components

Figure 3: Fingerprint authentication software

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 10 / 34

Page 11: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Software components

Figure 4: Communication components

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 11 / 34

Page 12: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Source code analysis

Finding the entry point...

FingerprintServiceI Managed (Java) codeI System serviceI Compiled as *.class

fingerprintdI Native (C/C++) codeI Separate processI Compiled as single executable

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 12 / 34

Page 13: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Source code analysis

FingerprintService checks return values

if fingerprint_id == 0

return false

else

return true

Problem?

No verification the fingerprint ID actually exists.

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 13 / 34

Page 14: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

False positive recognition

Method I - Replacing fingerprintd

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 14 / 34

Page 15: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Fake fingerprint ID

Figure 5: Result propagation

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 15 / 34

Page 16: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Fake fingerprint ID

Figure 6: False positive

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 16 / 34

Page 17: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

User warning

Figure 7: dm-verity warning

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 17 / 34

Page 18: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

False positive recognition

Method II - Manipulating IPC traffic

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 18 / 34

Page 19: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Binder IPC

Figure 8: Binder transaction flow

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 19 / 34

Page 20: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Manipulating IPC traffic

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 20 / 34

Page 21: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Comparing attack methods

Replacing fingerprintd Manipulating IPC

Requires root access Yes YesShows user warning Yes NoKey release Yes No1

Table 1: Method comparison

1Future work...Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 21 / 34

Page 22: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Forced release of authentication-gated keys

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 22 / 34

Page 23: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Key release

Figure 9: Keystore interaction

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 23 / 34

Page 24: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

HAT replay

Figure 10: Replay attack

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 24 / 34

Page 25: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Challenge implementation

Hardware Authentication Token2 security

64-bit ”random” challenge...

...prevents replay attacks?

Problem?

Value of challenge equal to crypto operation ID [1..19].

2Also referred to as ”AuthToken”Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 25 / 34

Page 26: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Attack feasibility

Attacks only possible with root

Can only be practically be exploited with physical access

Might trigger warnings on start-upI But this can be circumvented using Binder

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 26 / 34

Page 27: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Mitigation

Application developers

Use keystore

Do not trust rooted devices

OS developers

Randomise HAT challenge values (vendor’s responsibility?)

Erase HAT from memory after use

Why offer less secure method?

Protect Binder message integrity

End-users

Do not use fingerprint authentication on rooted device

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 27 / 34

Page 28: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Questions?

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 28 / 34

Page 29: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

FingerprintService.java

/frameworks/base/services/core.../java/com/android/server/fingerprint/FingerprintService.java

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 29 / 34

Page 30: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

FingerprintDaemonProxy.cpp

/system/core/fingerprintd/FingerprintDaemonProxy.cpp

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 30 / 34

Page 31: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Manipulating IPC traffic

Subverting the Binder

Capturing IPC trafficI Library injectionI Hooking IOCTL system callsI Dumping raw parcel data

Manipulating parcel contentI Select parcel by Interface Descriptor and Function CodeI Retrieve memory address of IPC data from parcel

Proves to be less detectable for end-usersI No warning is triggered on start-up

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 31 / 34

Page 32: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

IPC Traffic

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 32 / 34

Page 33: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

HAT Data Structure

Field Type Value

AuthToken Version 1 byte 0Challenge 64-bit unsigned integer 2User SID 64-bit unsigned integer 6642721394326884821Authenticator ID 64-bit unsigned integer3 13239196515636370186Authenticator type 64-bit unsigned integer1 33554432Timestamp 64-bit unsigned integer1 12838108872145108992AuthToken HMAC 256-bit blob 243-169-20-223-...

Table 2: AuthToken capture

3In network order (big endian)Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 33 / 34

Page 34: Exploring vulnerabilities in Android 6.0 fingerprint ...delaat/rp/2015... · Exploring vulnerabilities in Android 6.0 ngerprint authentication Thom Does & Mike Maarse KPMG 02-02-2016

Challenge ID

Logcat output

07:12:05.191 ... fingerprintd: authenticate(sid=15, gid=0)

07:12:10.533 ... fingerprintd: authenticate(sid=14, gid=0)

07:12:13.274 ... fingerprintd: authenticate(sid=13, gid=0)

07:12:15.975 ... fingerprintd: authenticate(sid=12, gid=0)

07:12:18.682 ... fingerprintd: authenticate(sid=11, gid=0)

07:12:21.707 ... fingerprintd: authenticate(sid=10, gid=0)

07:12:24.744 ... fingerprintd: authenticate(sid=9, gid=0)

Thom Does & Mike Maarse (KPMG) RP1 Presentation 02-02-2016 34 / 34