Password Managers Stephan Huber, Siegfried Rasthofer, Steven Arzt - - PowerPoint PPT Presentation

password managers
SMART_READER_LITE
LIVE PREVIEW

Password Managers Stephan Huber, Siegfried Rasthofer, Steven Arzt - - PowerPoint PPT Presentation

Extracting All Your Secrets: Vulnerabilities in Android Password Managers Stephan Huber, Siegfried Rasthofer, Steven Arzt Fraunhofer SIT Stephan Siegfried Mobile Security Researcher at Malware and Vulnerability Fraunhofer SIT


slide-1
SLIDE 1

Extracting All Your Secrets: Vulnerabilities in Android Password Managers

Stephan Huber, Siegfried Rasthofer, Steven Arzt Fraunhofer SIT

slide-2
SLIDE 2

2

Stephan

  • Mobile Security Researcher at

Fraunhofer SIT

  • Enjoys teaching students in

Android (app) hacking

  • Twitter: @teamsik

Siegfried

  • Malware and Vulnerability

Researcher at Fraunhofer SIT

  • Founder of CodeInspect
  • Web: www.rasthofer.info
  • Twitter: @teamsik
slide-3
SLIDE 3

Acknowledgements

  • Benedikt Hiemenz
  • Daniel Hitzel
  • Daniel Magin
  • Joseph Varghese
  • Julien Hachenberger
  • Max Kolhagen
  • Michael Tröger
  • Philipp Roskosch
  • Wittmann Andreas

3

slide-4
SLIDE 4

90 Accounts*

*https://thycotic.com

slide-5
SLIDE 5

Public Key Crypto Biometric Password Manager Pictures ... Notebook

slide-6
SLIDE 6

Password Manager

Source: https://www.getkeepsafe.com/about.html

slide-7
SLIDE 7

7

slide-8
SLIDE 8

8

App GooglePlay Downloads Keeper 10 – 50 m Keepsafe 10 – 50 m 1Password 1 – 5 m Dashlane 1 – 5 m Lastpass 1 – 5 m Avast 0.5 – 1 m MyPasswords 0.5 – 1 m F-Secure 100 – 500 k PasswordManger 50 – 100 k

slide-9
SLIDE 9

9

Password Manager Autofill Secure Synchronization Confidential Password Storage Custom Browser Comfort Feature (PIN login)

slide-10
SLIDE 10

10

Internet App Account Manager (master password) File (master password) PW-Manager App

user1:pw1 user2:pw2 ...

Database

PC

slide-11
SLIDE 11

11

Internet App Account Manager (master password) File (master password) PW-Manager App

user1:pw1 user2:pw2 ...

Database

PC “No-root scenario“

slide-12
SLIDE 12

12

Internet App Account Manager (master password) File (master password) PW-Manager App

user1:pw1 user2:pw2 ...

Database

PC

slide-13
SLIDE 13

13

Manual Filling Automatically Filling

slide-14
SLIDE 14

14

user **** user1 **** user2 **** user3 ****

Password Manager

Manual Filling

http://twitter.com/login

Clipboard

slide-15
SLIDE 15

15

Password Manager user:pass clipboard „sniffer“- app (no permissions required) user:pass Receiver Apps

Manual Filling - Attack

slide-16
SLIDE 16

16

user **** user1 **** user2 **** user3 ****

Password Manager

Automatically Filling

?

user1

****

slide-17
SLIDE 17

17

Accessibility Services

Source: https://developer.android.com

“An accessibility service is an application that provides user interface enhancements to assist users with disabilities, or who may temporarily be unable to fully interact with a

  • device. For example, users who are driving,

taking care of a young child or attending a very loud party might need additional or alternative interface feedback.“

slide-18
SLIDE 18

18

user **** user1 **** user2 **** user3 ****

Password Manager

Automatically Filling

?

Twitter-App (com.twitter.android)

slide-19
SLIDE 19

19

Automatically Filling

Twitter-App (com.twitter.android)

Password Manager

slide-20
SLIDE 20

Automatically Filling - Attack

reverse com.twitter com.twitter.twitterleak matches inject credentials find field

textPassword

20

prefix

slide-21
SLIDE 21

DEMO

DEMO TIME !

21

slide-22
SLIDE 22

22

File (master password) PW-Manager App

user1:pw1 user2:pw2 ...

Database

PC

slide-23
SLIDE 23

Use Backup Function

23

*

* https://github.com/nelenkov/android-backup-extractor

adb

adb

tar –xvf mybackup.tar cat KeyStorage.xml backup com.fsecure.key <string name="master_password">secretpass</string>

slide-24
SLIDE 24

24

File (master password) PW-Manager App

user1:pw1 user2:pw2 ...

Database

slide-25
SLIDE 25

25

API accessing browser elements credentials PW Manager

slide-26
SLIDE 26

26

API accessing browser elements credentials Pw Manager

slide-27
SLIDE 27

27

Password Manager

user **** user1 **** user2 **** user3 ****

Custom Browser

http://twitter.com/login

autofill

user1 ****

slide-28
SLIDE 28

28

Custom Browser

http://twitter.com/login

Password Manager local app folder

slide-29
SLIDE 29

Details about the Browser

  • Browser is part of the app
  • Running in the same process, part of the sandbox
  • Based on WebView API
  • Supports file:// URI *

29

*until Android 6

slide-30
SLIDE 30

NOT A COOKIE,CREDENTIALS !

30

slide-31
SLIDE 31

md5(„pincodeValue“) * base64(encr(key, PIN))

31

*obfuscated attribute values (for this example)

fi file:/// ///data/d /data/p /package.name/shared_p _prefs/p /passwor

  • rds_pref.xml
slide-32
SLIDE 32

32

slide-33
SLIDE 33

public abstract class LPCommon { //first part of the key protected static String aA = "ldT52Fjsnjdn4390"; //second part of the key protected static String aB = "89y23489h989fFFF";

Let‘s Look into the App Code

AES-Key: ldT52Fjsnjdn439089y23489h989fFFF

33

slide-34
SLIDE 34

34

Account Manager (master password) File (master password) PW-Manager App

user1:pw1 user2:pw2 ...

Database

slide-35
SLIDE 35

Android AccountManger

  • „This class provides access to a centralized registry

for the user‘s online accounts …“

  • SQLITE Database for storing tokens or temporary

Credentials

  • API provides access for Application

35

/data/system/users/0 # ls -l accounts.db

  • rw-rw---- system

system 241664 2017-04-03 10:58 accounts.db

slide-36
SLIDE 36

“With this in mind, you shouldn't pass the user's actual password to AccountManager.addAccountExplicitly(). Instead, you should store a cryptographically secure token that would be of limited use to an attacker. If your user credentials are protecting something valuable, you should carefully consider doing something similar.”

https://developer.android.com/training/id-auth/custom_auth.html

Quote google developer (AccountManager)

36

slide-37
SLIDE 37

DEMO TIME !

37

slide-38
SLIDE 38

AccountManager System accounts.db

38

slide-39
SLIDE 39

AccountManager System com.dashlane email:passwd Target App accounts.db account type

39

slide-40
SLIDE 40

AccountManager System com.dashlane email:passwd UID:123 Target App accounts.db email:passwd account type

40

slide-41
SLIDE 41

Attacker App AccountManager System com.dashlane email:passwd com.dashlane mail1:pass1 UID:123 Target App accounts.db email:passwd account type

41

*https://thenounproject.com/term/grab/121228/

*

account type

slide-42
SLIDE 42

Attacker App AccountManager System com.dashlane email:passwd com.dashlane mail1:pass1 UID:123 UID:456 Target App accounts.db email:passwd account type

42

COLLISION!

account type

slide-43
SLIDE 43

Attacker App AccountManager System com.dashlane mail1:pass1 accounts.db email:passwd

43

account type

slide-44
SLIDE 44

Attacker App AccountManager System com.dashlane email:passwd UID:456 accounts.db email:passwd

44

Read Account Data account type

slide-45
SLIDE 45

try { Account account = new Account("teamsiksm3@gmx.de ", "com.dashlane"); AccountManager acmanager = AccountManager.get(getApplicationContext()); //requires permission android.permission.AUTHENTICATE_ACCOUNTS acmanager.addAccountExplicitly(account, „DUMMY", null); } catch (Exception e) { Log.e(TAG, "Acc Exception " + e.getMessage()); }

try { AccountManager acmgr = AccountManager.get(getApplicationContext()); Account[] accounts = acmgr.getAccountsByType("com.dashlane"); for (Account a : accounts) { String password = AccountManager.get(getApplicationContext()).getPassword(a); … } catch (Exception e) { e.printStackTrace(); }

Reading form AccountManager Writing into AccountManager

45

catch collision

slide-46
SLIDE 46

Further Fails

  • Custom crypto-algorithm
  • AES in ECB mode for database encryption
  • Delivered browser do not consider subdomains in

form fields

  • Data leakage in browser
  • Custom transport security

46

slide-47
SLIDE 47

Improvements

  • Use Android KeyStore (since Android 6 AES key

support)

  • Use key derivation function (e.g. API PBKDF2, FB

conceal)

  • NO hardcoded keys
  • Use AES/CBC or AES/GCM
  • Do not abuse AccountManager

47

slide-48
SLIDE 48

48

Keeper Lastp 1Pass MyPass Avast F-Sec Keeps. PwMgr MyPass Dash Master/PIN

X X X X X X X X

Hardcoded Key

X X X X

Sandbox Bypass

X X X X X

Side channel

X X X X X

Subdomain

X X X X X X

Data leakage

X X X

Partial encryption

X

Broken sync.

X

www.sit4.me/pw-manager

slide-49
SLIDE 49

Summary

  • We showed several non root attacks on Android

password managers

  • Convenience functions weaken or destroy security
  • All findings were reported and fixed

49

slide-50
SLIDE 50

50

Stephan Huber Email: stephan.huber@sit.fraunhofer.de

  • Dr. Siegfried Rasthofer

Email: siegfried.rasthofer@sit.fraunhofer.de Twitter: @teamsik Website: www.team-sik.org