Project

General

Profile

Does Replicant also encrypt the internal storage?

Added by Daniel Kulesz almost 10 years ago

Hi,

today I had some bad experience with an android phone not supported by Replicant (from the Xperia series): System encryption was enabled, but after too many attempts to enter the password the system rebooted and wiped all data. At least I thought so. It seems like the SD card was internally mounted as /storage/sdcard0 and was neither wiped, nor were its contents affected by the encryption. So after simply triggering a data wipe by entering the wrong password too often, any attacker could have accessed all contents from this partition (and camera apps store the taken images and videos there by default).

Therefore my question: Does Replicant encrypt the internal sdcard (partition) as well?

Thanks for clarifying this!


Replies (13)

RE: Does Replicant also encrypt the internal storage? - Added by Drtan Samos almost 10 years ago

Hi Daniel,

I use internal storage encryption on Galaxy Nexus and the latest version of Replicant. I enabled it once installed Replicant and it works fine. I haven't tried to enter wrong password more than two or three times.

RE: Does Replicant also encrypt the internal storage? - Added by Daniel Kulesz almost 10 years ago

Hi,

what do you actually mean by "it works fine"? Have you verified that the contents of the internal SD card are actually encrypted and not just the contents of the data partition?

RE: Does Replicant also encrypt the internal storage? - Added by Thomas Kitchin almost 10 years ago

Hello. I recently completed an encryption on my replicant device. I can confirm to you that in the version of replicant (4.2.003) I am using, encryption does protect the /storage/sdcard0 partition.

RE: Does Replicant also encrypt the internal storage? - Added by Paul Kocialkowski almost 10 years ago

Indeed, encryption is applied to both the applications data (/data) and internal storage (/storage/sdcard0, /sdcard).

RE: Does Replicant also encrypt the internal storage? - Added by Daniel Kulesz almost 10 years ago

Thank you! It seems then like Replicant is behaving differently than CM in this respect. Have you additionally patched in this behavior? And could someone please post the output of "mount" from a device with encryption applied?

RE: Does Replicant also encrypt the internal storage? - Added by Paul Kocialkowski almost 10 years ago

It seems then like Replicant is behaving differently than CM in this respect.

I very much doubt that.

Have you additionally patched in this behavior?

Nope.

RE: Does Replicant also encrypt the internal storage? - Added by My Self almost 10 years ago

I haven't tried to enter wrong password more than two or three times.

I did.
After 10 wrong password entries you have to wait 30 seconds to enter a new password try. After that you could enter the next 10 times wrong passwords (without delay) and have to wait 30 seconds again. Nothing more happens, and in my eyes this behavior is not that bad.
Why?
The functionality of wiping the device is enabled on my business phone, for example. It seems to be a bad prank under colleagues, to type 4 times wrong passwords on devices of people, which are gone to the toilet for a minute. So I don't really miss this feature ;-)

As a workaround for your case, you could change the encryption password to a stronger one, (instead of just using the unlock PIN/password), for example over this app:

Indeed, encryption is applied to both the applications data (/data) and internal storage (/storage/sdcard0, /sdcard).

I wanted to proof that, but I can't, ad hoc.

"disk free" shows every mount point as a seperated one:

I've tried the following inside the Terminal Emulator app (as root):
touch /storage/sdcard0/teest
find / -name 'teest'

I hoped I will see the 'teest'-file anywhere inside the /data structure, but that was not the case.

Pretty much because the keyword here is vold (=Volume Deamon http://vold.sourceforge.net/)
and I have not fully understood the functionality of that, at the moment.

The only way to retrace the encryption of /storage/sdcard0 for me was, that I can't mount that mount point over CWM recovery, after encryption anymore.

If anybody could explain or proof that behavior in detail, please feel free to give me a hint.
Finally, something for the paranoid people, related to the topic:
http://www.extremetech.com/computing/150536-how-to-bypass-an-android-smartphones-encryption-and-security-put-it-in-the-freezer

could someone please post the output of "mount" from a device with encryption applied?

RE: Does Replicant also encrypt the internal storage? - Added by Daniel Kulesz almost 10 years ago

Thank you for taking the time to investigate this. I observed the "x-times before wipe" on a stock rom, therefore I was just curious if Replicant has the same behavior or not. Regarding the encrypted storage: On many pre-Android 4.1 or 4.2 devices, the internal sdcard and userdata partitions are separated in flash (even if you upgrade such a device it will keep the old partition layout). Thus, encrypting such a device will normally lead to sdcard not being encrypted. The Nexus-S seems to be an exception here, though.

For example, look at this fstab for the Nexus 4:

https://github.com/CyanogenMod/android_device_lge_mako/blob/cm-12.0/fstab.mako

And compare it with one for some ICS Sony device:

https://github.com/CyanogenMod/android_device_sony_hikari/blob/cm10.1/recovery.fstab

Imho, vold is pretty complicated and not well documented - the docs as published by Google do not really work for me. I played around with the init scripts and XMLs to force a different mounting behavior, but this turned out to be quite frustrating. If you want, boot to recovery, mount your sdcard directory and check what data is actually on the partitions.

Regarding security in general: I am aware of the freezer attack (works only on devices with open bootloader), but you certainly don't want to shut down your phone after a number of unsuccessful password entry attempts. If you run your phone encrypted, you better do not enter your encryption password if you find your device turned off and someone could have gained physical access to it. An attacker could have dumped your data and installed any sniffer to pick up and send your password the next time you power it on. But this is a general issue with untrusted boot chains, unlocked bootloaders und unprotected recoveries.

RE: Does Replicant also encrypt the internal storage? - Added by Paul Kocialkowski almost 10 years ago

Imho, vold is pretty complicated and not well documented - the docs as published by Google do not really work for me.

Just read the source then. It's not complicated code.

All the details about how Android encrypts devices can be figured out from there as well. I don't think that looking at mountpoints will show much.

RE: Does Replicant also encrypt the internal storage? - Added by dl lud almost 9 years ago

Paul Kocialkowski wrote:

It seems then like Replicant is behaving differently than CM in this respect.

I very much doubt that.

Have you additionally patched in this behavior?

Nope.

If nothing was patched then Replicant, as CyanogenMod, is not encrypting the internal sdcard (/storage/sdcard0). Take a look at this post: i9100 emulated sdcard, partition resizing and full disk encryption

As the author says:

Cyanogenmod by default only encrypts the /data partition. Newer models emulate the sdcard storage and save the data to /data/media, so everything gets encrypted. However, being an older phone [i9100] there is still a separate sdcard-partition on the phone which is physically and directly mounted and which will not be touched by encryption.

Besides i9100, I bet most Replicant-supported phones feature a "separate sdcard-partition".

The strange thing though, is that when I enable encryption I'm unable to mount sdcard0 in both CWMR and when in Android while waiting for password input. Could someone post the output of "mount" without encryption applied?

RE: Does Replicant also encrypt the internal storage? - Added by Anonymous over 8 years ago

There you go:

rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/fuse tmpfs rw,relatime,mode=775,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/mmcblk0p9 /system ext4 ro,noatime,user_xattr,barrier=1,data=ordered 0 0
/dev/block/mmcblk0p7 /cache ext4 rw,nosuid,nodev,noatime,errors=panic,user_xattr,barrier=1,journal_async_commit,data=ordered 0 0
/dev/block/mmcblk0p1 /efs ext4 rw,nosuid,nodev,noatime,errors=panic,user_xattr,barrier=1,journal_async_commit,data=ordered 0 0
/dev/block/mmcblk0p10 /data ext4 rw,nosuid,nodev,noatime,errors=panic,user_xattr,barrier=1,journal_async_commit,data=ordered,noauto_da_alloc,discard 0 0
/dev/block/mmcblk0p12 /preload ext4 ro,nosuid,nodev,noatime,user_xattr,barrier=1,data=ordered 0 0
/sys/kernel/debug /sys/kernel/debug debugfs rw,relatime 0 0
/dev/block/vold/259:3 /storage/sdcard0 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/259:3 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /storage/sdcard0/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
/dev/block/dm-0 /mnt/asec/org.safermobile.intheclear-1 ext4 ro,dirsync,nosuid,nodev,noatime,user_xattr,barrier=1 0 0
/dev/block/dm-1 /mnt/asec/info.lamatricexiste.network-1 ext4 ro,dirsync,nosuid,nodev,noatime,user_xattr,barrier=1 0 0

RE: Does Replicant also encrypt the internal storage? - Added by dl lud over 8 years ago

Thanks Leopold.

That confirms everything. Only /data mount source changes. /storage/sdcard0 is mounted in the same way, thus it is not encrypted.

    (1-13/13)