DeviceEncryption » History » Version 2
  Denis 'GNUtoo'  Carikli, 11/09/2020 06:17 PM 
  restructure a bit to fit the single page structure
| 1 | 1 | Denis 'GNUtoo' Carikli | h1. DeviceEncryption | 
|---|---|---|---|
| 2 | |||
| 3 | 2 | Denis 'GNUtoo' Carikli | {{toc}} | 
| 4 | 1 | Denis 'GNUtoo' Carikli | |
| 5 | 2 | Denis 'GNUtoo' Carikli | h2. Limitations | 
| 6 | |||
| 7 | 1 | Denis 'GNUtoo' Carikli | * On Replicant 6.0, the encryption scheme is specific to Android. Because of that if the device is broken, even if you have the passphrase, it's more complicated to recover the data. | 
| 8 | * Replicant doesn't have protections against "Evil maid attacks":https://en.wikipedia.org/wiki/Evil_maid_attack | ||
| 9 | |||
| 10 | h3. Full encryption | ||
| 11 | |||
| 12 | While that Android feature is called "Device encryption", it doesn't encrypt everything. | ||
| 13 | |||
| 14 | For instance, on a Galaxy SIII, enabling "Device encryption" only encrypts the USERDATA partition. | ||
| 15 | |||
| 16 | As the encrypted partitions have to be opened, and that the user need to type a password, code has to run to prompt user for the password and open the encrypted partition. That code cannot come from within the encrypted partition. | ||
| 17 | |||
| 18 | This is why "full disk encryption" or "device encryption" schemes often have parts that are unencrypted. | ||
| 19 | |||
| 20 | h3. Setting a device encryption password separate from the lockscreen password | ||
| 21 | |||
| 22 | By default on Android, the encryption password is the same as the lockscreen password. As users tend to use a simple PIN, password or pattern for the lockscreen, the encryption can be easily circumvented with a "brute-force attack":https://en.wikipedia.org/wiki/Brute-force_attack. | ||
| 23 | |||
| 24 | Replicant allows to set an encryption password that is not tied to the lockscreen: | ||
| 25 | # Encrypt your device (In the settings: *Security* -> *Encrypt phone*) | ||
| 26 | # After the phone has rebooted and the encryption is set up, select *Change encryption password* in the *Security* menu of the settings | ||
| 27 | # Choose a strong passphrase. You will only have to enter this passphrase once when the device boots. There is a section below that elaborates more on how to choose a strong passphrase. | ||
| 28 | # Reboot the device and verify that the encryption works properly by entering the previously chosen passphrase | ||
| 29 | |||
| 30 | If a separate encryption password is in place and a PIN or password is set for the lockscreen, another security measure is active: After five unsuccessful attempts to unlock the screen, the device is rebooted and the attacker is faced with the much stronger encryption passphrase. This makes brute-force attacks on the lockscreen much harder. | ||
| 31 | |||
| 32 | h3. Choosing a strong passphrase | ||
| 33 | |||
| 34 | As Android uses cryptsetup, most or all the "Cryptsetup FAQ":https://gitlab.com/cryptsetup/cryptsetup/-/wikis/FrequentlyAskedQuestions also apply to Replicant as well. | ||
| 35 | |||
| 36 | That FAQ has a "Security Aspects":https://gitlab.com/cryptsetup/cryptsetup/-/wikis/FrequentlyAskedQuestions#5-security-aspects section where it details the cost of breaking a passphrase in a table like this one: | ||
| 37 | |||
| 38 | |_. Passphrase entropy |_. Cost to break | | ||
| 39 | | 50 bit | EUR/USD 600k | | ||
| 40 | | 55 bit | EUR/USD 20M | | ||
| 41 | | 70 bit | EUR/USD 600B | | ||
| 42 | | 75 bit | EUR/USD 20T | | ||
| 43 | |||
| 44 | Be sure to look at the FAQ for potentially more up to date figures and the details that goes with them. | ||
| 45 | |||
| 46 | As for calculating the passphrase entropy, tools like keepassxc (which is available in Parabola) have a password generator that is able to calculate the entropy. At the time of writing, in keepassxc, this can be found in @Tools->Password generator@. | ||
| 47 | |||
| 48 | h3. Real example of a bad password | ||
| 49 | |||
| 50 | For instance if we use @Replicant@ as a password is a very bad idea for several reasons: | ||
| 51 | * Casual attackers knowing that the device is running Replicant and can simply try various variations on Replicant by hand. They'll most probably find it. | ||
| 52 | * Attackers can easily copy the encrypted partition and try entries from dictionaries, it will probably find it very fast too. | ||
| 53 | * Slightly more sophisticated attackers probably have optimized dictionaries that try variations on common words with accurate statistical models. It will probably find it very fast too. | ||
| 54 | * Even with brute-force it's way too easy to find: It's too short and not enough random. Using Keepasxc to calculate the entropy gives us 15.32 bits of entropy. That's about 20452 tries in average (1/2 * 2^(bits of entropy in passphrase, according to the cryptsetup FAQ). So even with a slow computer that only does 1 try per second, we only spend 5h40 to find it. | ||
| 55 | |||
| 56 | h3. Other tips | ||
| 57 | |||
| 58 | * Do not set the default keyboard (LatinIME) as a non-system app if you use encryption: it will prevent you from entering the password to open the encrypted storage. |