[Q] Serious problem with Android's built-in encryption? - Android Q&A, Help & Troubleshooting

I came across a problem with Android's built-in encryption function and typical sdcard data. I searched everywhere on the internet and this is what I could collect so far:
Also, from my research, while I cannot confirm this, I have read that prior to 4.2, external (public) storage in Android was /mnt/sdcard/ (if you are not familiar with the Android file system, "sdcard" refers to public storage that is internal...not necessarily an external sdcard), but this was just a symbolic link from the protected /data/ directory. At the time, Android only encrypted /data/, which was fine because the symbolic link would also encrypt any personal files in the public directory.
After 4.2, due to multiple profiles, the public storage was moved to /storage/emulated/legacy. That means if Android's "full disk encryption" only encrypted /data...then any sensitive data in the public directories is not encrypted (this could be downloads from work, private photos, etc).
Click to expand...
Click to collapse
Source and full topic: https://productforum...xus/Lzsje-4QfTQ
This can be OEM dependent indeed, but /mnt/sdcard is now just a symlink to
a 'virtual' SD card that lives under /data. So downloaded documents, media
etc. are encrypted along with private data, etc. From the boot script:
# create virtual SD card at /storage/sdcard0, based on the /data/media directory
# daemon will drop to user/group system/media_rw after initializing
# underlying files in /data/media will be created with user and group
media_rw (1023)
If one some device /mnt/sdcard (external storage) is independent from /data,
it might not get encrypted. But then again they may modify the
firmware to encrypt it.
Click to expand...
Click to collapse
Source and full topic: https://groups.googl...uss/-mE-XTot0Gg (This is also only referring to Android versions =< 4.0)
1.) I checked a CM 11 installation on a Huawei Ascend Y300 and I could find the same internal SD card data in
/internal_sd -> /storage/sdcard0 (fuse)
/mnt/internal_sd -> /storage/sdcard0 (fuse)
/mnt/media_rw/sdcard0 -> /mnt/media_rw/sdcard (vfat)
2.) /data/media does not contain the files as the others in 1.).
3.) /internal_sd is the only partition visible via TWRP file manager, which could mean that the others are created during the start of Android itself.
2012
So the actual physical storage place is still /data/media. /storage/sdcard0 is a "virtual" SD card. /sdcard and /mnt/sdcard are symbolic links of /storage/sdcard0.
Click to expand...
Click to collapse
I'd guess that the virtual sdcard exists because /data/media is part of an ext# partition, so they use fuse filesystem and virtual sdcard to make it look like fat to apps, many of which don't understand ext# filesystems.
Click to expand...
Click to collapse
2013
http://forum.xda-developers.com/galaxy-s3/general/info-flashed-4-2-sdcard-data-t2274218
Click to expand...
Click to collapse
I'd assume the actual physical storage place is /storage/sdcard0 now, but I'm not sure.
Conclusion: To make the encryption include typical "sdcard data" again, we would have to somehow change it back to this:
So the actual physical storage place is still /data/media. /storage/sdcard0 is a "virtual" SD card. /sdcard and /mnt/sdcard are symbolic links of /storage/sdcard0.
Click to expand...
Click to collapse
Are my thoughts on this correct so far or does anyone have an idea?
Does this mean older Android versions (pre-4.2) did not actually have this problem?

Related

Access to external SD card - Stock ROM (Rooted)

I've encountered problems trying to access the external SD card on my rooted Samsung Galaxy S3.
There are entries in /mnt/ for both internal and external storage, namely the following mount points:
/mnt/sdcard/ - internal
/mnt/extSdCard/ - external
The former is mounted onto the filesystem as /sdcard/. Ideally I'd like to mount the external card instead. Based on information elsewhere on the site, I checked the /etc/void.fstab file with the intention of making changes. However I didn't find what I was expecting. Here's the relevant part of the file:
Code:
{
supported_exfat = yes
}
dev_mount sdcard /mnt/extSdCard auto /devices/platform/s3c-sdhci.2/mmc_host/mmc1/
Based on this config I would have expected the external SD card to be mounted as /sdcard/. But clearly it isn't, and I don't understand why.
For the time being I am using Directory Bind to access external storage via /sdcard/external_sd/ but it would be easier to simply mount external storage as /sdcard/.
Anyone have any suggestions?

[Q] How to restore mount point of internal sdcard

Hello! I've installed the XXLSJ 4.1.2 leak over CM10 (with Odin, 3+1 files, reparted with the 16GB pit)
Now everything is fine, except that my internal sdcard is mounted at
Code:
/dev/block/vold/259:3 [B]/storage/sdcard0[/B]
I would like to ask; what is the best way to restore the mounting point of the internal sd to
Code:
[B]/mnt/sdcard[/B]
Now the original 3e recovery can't mount my internal storage, because it tries to mount mnt/sdcard or /sdcard.
Also should I care the address of the block? (Which is originally something like /dev/block/mmcblk0p...)
Thanks for the answers!
Edit: My system/etc/vold.fstab:
Code:
# internal sdcard
{
ums_sys_path = /sys/class/android_usb/f_mass_storage/lun0/file
secure_format = enable
discard = enable
supported_exfat = disable
}
dev_mount sdcard /storage/sdcard0 11 /devices/platform/dw_mmc/mmc_host/mmc0/mmc0 encryptable_nonremovable
Fw:Sdcard mount problem
After upgrading to 4.1, the sdcards mount directory changed.
Not only internal sdcard but also external one face the same problem.
the external sd mount dir changed from:
4.0:
/mnt/sdcard/external_sd or /sdcard/external_sd
Click to expand...
Click to collapse
to
4.1:
/storage/sdcard1 or /extSdCard
Click to expand...
Click to collapse
which is bad.
Anyone knows how to fix/change it?
Thanks for answers!

[Q] Emulated internal storage as sdcard

Hello everyone.
Yesterday I received my Huawei Honor 3C and I've installed MIUI ASAP instead of Emotion UI.
Everything's great but I have a problem with double SD Card, I mean: I have my own external card and the phone got his own by emulating it's internal storage as SD Card (it's a symlink to /storage/emulated/0 and it's the same as /storage/emulated/legacy, so this fake sd is eating up my storage, there are also other symlinks in /storage/, /mnt/ and even in root folder there is a symlink sdcard->/storage/emulated/legacy). Phone and apps are correctly seeing external card as SD Card but in reality the internal storage is being used for everything.
Because of this I have only about 5GB available instead of 64GB
Is there any way to terminate the emulation or changing it's target to sdcard2 so that I could use my card correctly? I've tried few things but nothing works. Symlinks are being recreated during boot so editing or deleting them does not work. Editing vold.fstab does nothing because ext is being mounted after boot while the emulation stars while in it - I guess that a proped ini script could do the work.
huaweiproblem said:
Hello everyone.
Yesterday I received my Huawei Honor 3C and I've installed MIUI ASAP instead of Emotion UI.
Everything's great but I have a problem with double SD Card, I mean: I have my own external card and the phone got his own by emulating it's internal storage as SD Card (it's a symlink to /storage/emulated/0 and it's the same as /storage/emulated/legacy, so this fake sd is eating up my storage, there are also other symlinks in /storage/, /mnt/ and even in root folder there is a symlink sdcard->/storage/emulated/legacy). Phone and apps are correctly seeing external card as SD Card but in reality the internal storage is being used for everything.
Because of this I have only about 5GB available instead of 64GB
Is there any way to terminate the emulation or changing it's target to sdcard2 so that I could use my card correctly? I've tried few things but nothing works. Symlinks are being recreated during boot so editing or deleting them does not work. Editing vold.fstab does nothing because ext is being mounted after boot while the emulation stars while in it - I guess that a proped ini script could do the work.
Click to expand...
Click to collapse
First thing I do to troubleshoot that stuff is to copy everything off the internal storage, then format it in recovery, then copy everything back when booted up.
Why do you think that wiping and installing the exact same stuff could help? If you're copying back the same files that were there before - then you're back at starting point.
I've tried also a few different things, mostly trying to modify inid.rc scripts.
I found an interesting script in init.ssd.rc, that is:
Code:
on init
# See storage config details at source.android.com/tech/storage/
# fix non-shell uid process can not access shared-sd
mkdir /mnt/shell 0700 shell shell
chmod 0750 /mnt/shell
chown shell sdcard_rw /mnt/shell
mkdir /mnt/shell/emulated 0700 shell shell
mkdir /mnt/shell/emulated/0 0700 shell shell
mkdir /storage/emulated 0555 root root
mkdir /storage/sdcard1 0000 system system
export EXTERNAL_STORAGE /storage/emulated/legacy
export SECONDARY_STORAGE /storage/sdcard1
export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
export EMULATED_STORAGE_TARGET /storage/emulated
mount tmpfs tmpfs /storage/emulated mode=0705,uid=1023,gid=1023
# Support legacy paths
symlink /storage/emulated/legacy /sdcard
symlink /storage/emulated/legacy /mnt/sdcard
symlink /storage/emulated/legacy /storage/sdcard0
symlink /mnt/shell/emulated/0 /storage/emulated/legacy
symlink /mnt/shell/emulated/0 /storage/emulated/0
symlink /storage/sdcard1 /mnt/sdcard2
and so I deleted those symlinks, packed up the ramdisk and flashed boot.img with those changes... still nothing, the symlinks are still being recreated every boot.
Damn, what a stupid thing. I've found a solution on 4pda forums. I was trying to do it the complicated way while I had everything in the system settings, in a hidden MIUI menu with some untranslated chinese marks.
Under battery settings there are options in chinese, I just had to choose the fifth chinese one and change the storage options :victory:
huaweiproblem said:
Damn, what a stupid thing. I've found a solution on 4pda forums. I was trying to do it the complicated way while I had everything in the system settings, in a hidden MIUI menu with some untranslated chinese marks.
Under battery settings there are options in chinese, I just had to choose the fifth chinese one and change the storage options :victory:
Click to expand...
Click to collapse
Glad you solved it. The reason I mentioned the wipe and all because it's not an uncommon issue when switching from some stock system to custom ones (like CM, etc) where they change the mount point of external from /sdcard to /sdcard0 and it will just copy everything from /sdcard/ to /sdcard0 and you'll have copies of everything which cuts the storage in half. Case in point: http://forum.xda-developers.com/showthread.php?p=51709918#post51709918

Swapping mount points

I have a cheapo DragonTouch Y88X. I'm not looking for a custom ROM or anything - its for the kids and honestly it does everything they need, with one exception: Disney Movies Anywhere can't download videos to the external SD card.
As near as I can tell, this is an application problem - hardwired looking for /mnt/sdcard instead of using the Google API to find where the SD card is mounted, and DragonTouch was brain dead and mounted part of the internal storage to /mnt/sdcard (the actual SD card gets mounted to /mnt/extsd).
OK, so I'm not going to get Disney to change the app (and there's no setting to change where it downloads to other than "Save To/Play From SD Card"), so I started poking around how to change the mount points. I'm reasonably familiar with linux, sys admin duties and the like. But the format and options on the fstab file are a bit unfamiliar to me... All I really want to do is make the external SD card be mounted at /mnt/sdcard (and maybe mount the internal partition to something useful - maybe app cache space or something?)
I managed to get root and installed ES File Explorer, and the fstab file (/fstab.sun8i to be specific) has the following lines that I think are relevant...:
Code:
...
/devices/virtual/block/nandk auto vfat defaults wait,check,noemulatedsd,voldmanaged=sdcard:auto
/devices/platform/sunxi-mmc.2/mmc_host auto vfat defaults wait,check,noemulatedsd,voldmanagedsd=sdcard:auto
/devices/platform/sunxi-mmc.0/mmc_host /mnt/extsd vfat rw,realtime,fmask=0000,dmask=0000,wait,check,voldm anaged=extsd:auto
/devices/platform/sunxi-mmc.1/mmc_host /mnt/extsd vfat rw,realtime,fmask=0000,dmask=0000,wait,check,voldm anaged=extsd:auto
...
I don't know quite enough about either fstab or Android/DragonTouch's variant of it to know why both sdcard and extsd have two entries each... Or exactly how to swap them. I could try to change the voldmanaged=[name] entry on each - would that be safe?
Is what I'm trying to do crazy, or should this work?
Thanks

Change TWRP /sdcard symlink location from /data/media/0 to /data/media

Hi, I recently compiled a TWRP for E506 plus, the problem is that the internal memory of the device is /data/media but the TWRP continues reading /data/media/0 also creating a new folder inside the internal memory called 0. In this way it is not possible to install zip from the internal memory if not manually browsing to /data/media, how can I solve?
I also tried to modify the fstab like this:
Code:
/sdcard auto /data/media
But it didn't work and I also tried to create a symlink but nothing.
Device Tree: https://github.com/XRedCubeX/twrp_device_E506plus
Thread closed per OP request.

Categories

Resources