Say a legitimate app makes use of either:
- No keystore
- Software-only keystore (for encryption/decryption of data)
- Hardware-backed keystore (for encryption/decryption of data)
For the following scenarios (assuming the device encrypted), I'm wondering if the following assertions are correct and if some questions can be answered.
No keystore
Attacker has physical access to locked device
- Attacker can't access legitimate app's data without additional exploits
Attacker has physical access to unlocked device
Attacker can physically use legitimate app
Attacker can't access the legitimate app's raw data (internal storage) without additional exploit to gain root privileges
Attacker has physical access to device + knowledge of PIN
Attacker can physically use legitimate app
Attacker can physically remove the device's drive and attach it to another device under the attacker's control. The attacker can then retrieve the drive's decryption key by using using the PIN (along with PBKDF2) and access the legitimate app's data.
Attacker has remote access through a malicious app without root access and without knowledge PIN
- Attacker can't access the legitimate app's data without additional exploits
Attacker has remote access through a malicious app + root access without knowledge of PIN
Attacker has full access to legitimate app's data
Attacker can easily gain access to all of the legitimate app's internal storage
Attacker has remote access through a malicious app + root access + knowledge of PIN
- Attacker has full access to legitimate app's data
Software-only keystore
Attacker has physical access to locked device
- Attacker can't access legitimate app's data
Attacker has physical access to unlocked device
Attacker can physically use legitimate app
Attacker can't access the app's raw data (internal storage) without an additional exploit to gain root privileges
Attacker has physical access to device + knowledge of PIN
Attacker can physically use legitimate app
Attacker can physically remove the device's drive and attach it to another device under the attacker's control. The attacker can then retrieve the drive's decryption key by using using the PIN (along with PBKDF2) and access the legitimate app's data.
Attacker has remote access through a malicious app without root access and without knowledge of pin
- Attacker can't access legitimate app's data
Attacker has remote access through a malicious app + root access without knowledge of PIN
Attacker can trick the keystore process into encrypting/decrypting the legitimate app's data.
Attacker can't access the legitimate app's data from another device without first obtaining the secrets from the keystore (which requires the PIN). However the attacker can easily install a keylogger to eventually obtain the PIN.
Attacker has remote access through a malicious app + knowledge of PIN without root access
- Attacker can't access legitimate app's data
Attacker has remote access through a malicious app + root access + knowledge of PIN
Attacker can trick the keystore process into encrypting/decrypting the legitimate app's data.
Attacker can also easily decrypt the legitimate app's keystore by using the PIN (along with PBKDF2). The legitimate app's data can then be accessed from any other device under the attacker's control.
Hardware-backed keystore
Attacker has physical access to locked device
- Attacker can't access legitimate app's data
Attacker has physical access to unlocked device
Attacker can physically use legitimate app
Attacker can't access the legitimate app's raw data (internal storage) without an additional exploit to gain root privileges
Attacker has physical access to device + knowledge of PIN
Attacker can physically use legitimate app
Attacker can easily gain root access but on some devices the process of doing so will wipe out the phone's data prior to unlocking the bootloader. If data isn't wiped, the attacker gets access to all of the legitimate app's internal storage
Attacker can't physically remove the device's drive and attach it to another device under the attacker's control since the keystore is hardware-backed.
Attacker has remote access through a malicious app without root access and without knowledge of PIN
- Attacker can't access the legitimate app's data without additional exploits
Attacker has remote access through a malicious app + root access without knowledge of PIN
- Attacker can trick the keystore process into encrypting/decrypting the legitimate app's data.
Attacker has remote access through a malicious app + knowledge of PIN without root access
- Attacker can't access legitimate app's data
Attacker has remote access through a malicious app + root access + knowledge of PIN
Attacker can trick the keystore process into encrypting/decrypting the legitimate app's data.
Attacker can't decrypt the legitimate app's private keys since the keys never leave the TEE. The attacker can only encrypt/decrypt data on the compromised device.
Questions / Observations
Is the above correct?
It seems like in all 3 cases (No keystore, software-only keystore, and hardware-backed):
If the attacker is remote and doesn't have root access, he/she cannot access the legitimate app's data
If the attacker is remote and does have root access, he/she can access the legitimate app's data.
If the above is correct, when considering a remote attacker:
What additional security does a software-only keystore provide over no keystore?
What additional security does a hardware-backed keystore provide over a software-only keystore? I understand that in the case of a hardware-backed keystore the attacker never actually obtains the legitimate app's private keys and must therefore rely on the compromised device to decrypt the legitimate app's data. But at the end the line the attacker still gets access to the legitimate app's data so it doesn't seem to make a difference)?