際際滷

際際滷Share a Scribd company logo
Mysterious Crypto in Android
Biometrics
Responsible: Mr. Pongsakorn Sommalai
Version (Date): 1.0 (2019-10-02)
Confidentiality class: Public
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Mr. Pongsakorn (Bongtrop) Sommalai
Penetration Tester
Siam Thanat Hack Company Limited
Whoami
Its me.
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Overview
3
- Introduction
- Android Biometrics (Authentication) Security
- Android Keystore
- Cryptographic Library in Android
- Biometric Prompt
- Example Applications
- AndroidKeyStore
- The better way (let's discuss)
Introduction
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
What is Biometrics (Authentication)?
5
http://fintechnews.sg/18096/mobile-payment/singaporeans-interested-in-biometrics-authentication-and-payments/
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Password & PIN
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Password & PIN
000000
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
8
1 2
Celebs Opinion
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Todays Scenario
10
Scenario: The sophisticated threat actors or APT malware with access to the
victims device.
Not these:
Android Biometric
Implementation
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
What is Keystore ?
12
A safe box which can store cryptographic keys.
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
FriendZone Technology and the Trusted Execution Environment (TEE)
13
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
TrustZone Technology and the Trusted Execution Environment (TEE)
14
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
AndroidKeyStore and his Friend
15
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Key Material in AndroidKeyStore
16
- Generate in secure world
- Encrypt in secure world
- Decrypt in secure world
- XXX in secure world
Can you gimme a key? Can you decrypt for me?
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Cryptographic Library in Android
17
https://developer.android.com/guide/topics/security/cryptography
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Biometric Prompt
18
https://android-developers.googleblog.com/2018/06/better-biometrics-in-android-p.html
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Example Application #1
19
// For the "insecure" method, the app relies on onAuthenticationSucceeded function being called
btInsecureActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new BiometricPrompt(MainActivity.this, executor, new BiometricPrompt.AuthenticationCallback() {
@Override
public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) {
super.onAuthenticationSucceeded(result);
i = new Intent(MainActivity.this, InsecureActivity.class);
startActivity(i);
}
}).authenticate(promptInfo);
}
});
Lets play !!
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Example Application #1
20
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Example Application #2
21
KeyStore + Cryptographic + BiometricPrompt
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Example Application #2
22
Generate Key
Init Phrase
Encrypt a Secret Store it Somewhere
Fetch Key
Access Phrase
Authenticate Decrypt a Secret
Secure
World
Secure
World
Secure
World
Only
Object
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Example Application #2
23
Take a Look at the Source Code !!
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Interesting Property of a Key
24
- isInsideSecureHardware
- isInvalidatedByBiometricEnrollment
- isUserAuthenticationRequired
- isUserAuthenticationRequirementEnforcedBySecureHardware
- isUserAuthenticationValidWhileOnBody
- userAuthenticationValidityDurationSeconds
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Example Application #SDHMobile
25
Lets play with this scenario !!
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Store encrypted PIN or TOKEN for authentication.
Is it secure ?
26
Possible Attacks on
AndroidKeyStore
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
AndroidKeyStore Recap
28
- Generate in secure world
- Encrypt in secure world
- Decrypt in secure world
- XXX in secure world
Can you gimme a key? Can you decrypt it for me?
However, the key must be stored in somewhere right?
The better ways (lets discuss)
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Challenge Response Authentication (Symmetric)
30
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Responsible / Version: Mr. Pongsakorn Sommalai / 1.0 (2019-10-02)
Confidentiality class: Public
Challenge Response Authentication (Asymmetric)
31
Q & A
犖犖犖.犖犖∇顕犖÷犖犖園犢犖犖
Contact us:
pentest@sth.sh

More Related Content

Mysterious Crypto in Android Biometrics