[HOW TO] ENSURE ANDROID DEVICE SECURITY, PRIVACY and DATA PROTECTION - Android Q&A, Help & Troubleshooting

NOTE:
This is a very basic guide only for newbies like me.
I'm not a developer or something even near to that. All information provided here is copied from different sources and according to the best of my knowledge. I'll not be responsible for any harm to you or your device. Try it on your own risk.
Any additions or corrections are welcomed.
Note: Unlocking Bootloader and Rooting breaks "Verified Boot". It can be dangerous.
Unlocking bootloader:
Disables signature checking of boot image and recovery image
Allows all fastboot commands to be executed
Zeros out /data partition i.e. filesystem is erased and then regenerated on next boot
To know further: BOOT PROCESS: ANDROID vs. LINUX
As compared to iOS, Android is considered less secure OS because it's an open source project and a large number of developers are involved contrary to iOS where things are kept secret. We can face two types of threats regarding mobile security:
Data theft or loss when using mobile phone.
Different types of malware (spyware, adware, bloatware, ransomware, worms, trojans, virus, cookies) or a hacker can directly attack your device to gain access to your personal data like contacts, pictures, credit card information or even can note your habits and then forcefully show you ads etc. Sometimes the purpose is just to harm you, rather than having some benefit. To avoid this:
Keep your phone as simple as possible. Avoid installing apps from unknown sources particularly KeyGens and cracked / pirated / hacked apps and MODs offered free of cost. Use an app store like PlayStore to install apps which provide security somewhat.
Some stock ROMs (manufacturer's operating systems) contain bloatware (unnecessary and suspicious apps) running as an app or in background. Try removing as much of these as possible by uninstalling or freezing or at least restrict their permissions and internet access.
In Android 6 and above, apps ask for permissions from user when run first time. Allow for these permissions carefully. Check your list of apps auto-starting up and running in background as well as accessing storage and phone / sms etc.
Permission regarded as "Normal" by Android cannot be revoked by simple means e.g. you can restrict an app's INTERNET permission. Either use a third party trustworthy permission manager or at least review the list of permissions requested by an app at install time.
Use some firewall app like AFWall+ to block hidden internet access of apps to internet.
If your phone is rooted, try to avoid granting root access to as less apps as possible particularly those from uncertain sources.
Use some anti-malware or commonly known antivirus app in mobile phone which can scan and filter apps, attachments, links, emails, sms and webpages etc. There are numerous paid and free apps available for the purpose, though most of them are themselves promoting some kind of malware for business purpose. av-test.org is a good place to start with selection.
Data theft or loss when phone is lost or stolen
In this thread I'm focussing this part and giving here a few technical tips and measures you should always take that can help you keep your data, device and yourself safe in case if your device is LOST or in case of THEFT. Otherwise your device and your data can be accessed and misused.
The very first vulnerability of our data to theft and misuse starts with the Unlocking of BootLoader which is locked by default for security on most of the new devices. Unlocking BL makes it easy to flash custom recoveries, kernels and ROMs. That's why, the internal storage can be accessed from any custom recovery or device is factory reset or new OS can be installed for a fresh use. Therefore vendors are making it harder and harder to unlock BL without proper authorization. Personal data is also prone to wrong hands due to insufficient security measures on device as explained below:
DATA PRIVACY
Always keep Screen Lock enabled (with PIN or Password or Pattern).
But keep in mind, this option alone is of no use. It takes only a minute or two to remove screen lock protection if a custom recovery is installed or BL is unlocked / unlockable.
Always use Internal Memory of Phone to store personal data like pictures, contacts etc.
External memory (SD cards) can be removed from device and easily accessed from computer or other devices. They aren't erased usually in case an app tries to erase data in case of theft. Also, Android doesn't offer encryption of SD cards by default. A few custom ROMs offer this feature or you have to use a third part app for encryption. Built-in kernel module dm-crypt is used by AOSP for full disk encryption (FDE). A similar service is needed which auto-mounts your memory card at OS boot. Good examples of encryption at filesystem level are EncFS and CryFS which offer a stackable transparent encryption with virtual filesystem. An easy way to implement EncFS on Android 5- is explained here.
However, in Android 6.0 and above, external memory swapping with internal memory is offered called adoptable storage. That's relatively more secure because it makes SD card not readable by other devices (at least not easily).
Old Devices with Low Internal Memory - in this case instead of putting personal data on SD card, try using SD card's 2nd partition to link apps & their data to SD card by Link2SD and keep your personal data on internal memory.
However, Link2SD may slow down your device or can be a battery hog. In this case, use Third Party Encryption apps to encrypt your targeted data instead of encrypting whole /data partition. There are numerous apps like KeepSafe which is more useful if you combine encryption with cloud backup or online synchronization. However, be careful while selecting app. The app can fail to protect your data online or it can itself misuse your data. Otherwise, any app like ES Explorer or Solid Explorer can be used to keep data encrypted.
In case of third party encryption software, you must be extra conscious of your data. Sometimes sensitive data is hidden (apps data or due to .nomedia) like WhatsApp Sent folders. You have to take care of all this manually. It's really a hectic job.
Encrypt Internal Memory (particularly if BL is unlocked).
It's because and attempt to unlock BL erases all personal data on internal memory (not external SD card). However, it may not always be true. So keeping Internal Memory Encrypted always promises more security. An un-encrypted internal memory can be easily accessed from custom recovery.
Performing these steps makes your data quite secure and not vulnerable to easy access.
DATA PROTECTION
Data Recoverable - use local / online backup of your data. Read here how to do that.
Wiping Data
Bootloader Locked - so that there is no chance of flashing custom recovery and then accessing data from there or through ADB. As stated above, unlocking BL will erase data but it's not always true. So, this option alone cannot be relied on.
There are chances of wiping data if you use some anti-theft app. Android Device Manager (ADM) is a built-in app on all Android devices that suffices the basic needs of an anti-theft app. A Google account on device is mandatory and ADM must be enabled from settings i.e. Device Administrator. You can use Google Find My Device anytime to Locate (Location services should be enabled on device), Play Sound, Lock or Erase your device. Obviously, device should be connected to internet for ADM to work.
However, you may use any third party app with rich features (also SMS based).
Rendering Data Useless - as stated above, using Encrypted Internal Memory only for personal data makes it secure and hard to read by others, even useless.
DEVICE SECURITY
Device Recoverable
As stated above, there are chances of device recovery if you use some anti-theft app.
Keep your phone's IMEI number safe. Your Mobile Network Operator along with the help of police can trace your device whenever it's switched on unless its IMEI is tempered.
Rendering Device Useless
Bootloader Locked - so that there is no chance of flashing custom recovery and then flashing new ROM.
OEM Unlocking disabled - so that Bootloader can't be unlocked without proper authorization.
It can be disabled from ROM settings menu on Android 5.0 and higher devices (if found).
Factory Reset Protection (FRP) - so that after resetting device from recovery, device can't be logged in without already linked Google account. This is implemented by a separate partition named FRP or CONFIG or PDB (on Intel devices) or something else which saves information of last logged in Google (or OEM) accounts. This partition is not reset on factory data reset by stock recovery. So, if bootloader is locked and set unlockable in Developer Options, one can't flash custom recovery to erase FRP partition. He will be stuck at login screen permanently.
So a working Google account on device is mandatory. It works on some Android devices with Lollipop 5.1 and higher. However all vendors don't implement this security feature in their devices. Some use their own similar feature e.g. XIAOMI links your device to MI account.
Additionally some OEM's don't allow unlocking of bootloader without permission from OEM to ensure more security i.e. contents of partition[/URL] "devinfo" are signed by the OEM and can't be modified without their approval. After having permission, an official method is provided to unlock BL using PC.

Related

Why Does Reading the SD Card Not Require Permission

Like the title says why are apps allowed to read the contents of files on the SD card without asking permission? Apps have to ask to read SMS, Calendar, and everything else. It seems like a huge security hole to me. Thoughts?
Anybody? No thoughts or reasons at all?
I believe that there's nothing secure that can be read from the SD card without explicit permissions. You need WRITE_SECURE_SETTINGS to read secure settings... all your calendar data and so forth are either outside the handset or stored securely... etc.
However, I'm not an Android developer --
SD card functions as a storage device. So writing files on it should not require permissions. Only access to certain files/apps have to require permissions.
Have you tried fixing permissions? Don't know if it will work but its worth a try I guess.
To me it just seems like a security risk but then I guess Windows software allows the same thing and nothing can stop from reading contents of the hard drive. Still seems unsecure though that any platform, mobile or non-mobile would allow this behavior.

[Q] Android 4.2 multi-user and device policy

Android 4.2 supports multiple users. As I understand it, each of them runs in a sandbox with their own apps and data space; the different users cannot see each other's data. The primary user, the device owner, has the option to delete the accounts of other users.
What happens if a secondary user installs an app that requires device-administrator rights, such as password rules and "erase all data"? Do those rights apply to all users? Could the secondary user initiate a remote wipe that way? For example, AirDroid requests such rights and as a secondary user I can approve those rights. Those rights do not show up in the device-administrator list of the primary user, even though Android explicitly explains to the second user: "Erase the tablet's data without warning by performing a factory reset", not "Erase the user's data".
I don't really feel like trying out a remote wipe just to see what happens. Is there anyone here who knows? I haven't been able to find out on Google etc.
Update: I now tried to do a remote password reset (with AirDroid). It turns out that this only affects the password/PIN of the user that was running AirDroid.

[Q] 4.1.2 --- video / image files, thumbnail and cache

Hi
I will be passing on my company phone for someone else to use for couple of weeks, and I am having some privacy concerns about it. I have already transferred all images/videos from the phone's ext SD card, but now I am worried of how I can securely erase the data. I don't wanna buy a new SD card just for this, so I was wondering if there is any way to safely erase/destroy those data.
For starters, I got my self 'secure file deletion' from play store, which allows to wipe off selected data off the phone memory and the external card. Which I did. Images/videos are stored under:
/storage/extSdCard/DCIM/Camera
But after wiping those off, I realised that not all image/video data is cleaned off. The OS also stores thumbnails for those media. Surprisingly, those are stored in phone memory and location can't be changed:
/storage/sdcard0/DCIM/.thumbnails
In there, there are .JPGs (thumbnails) and a strange '.thumbdataXXXX' file. So, I use 'secure file deletion' to remove those as well. Funny thing is that even after erasing those, I can still see the thumbnails of the corresponding video/image (but when I select it, it says 'file not found' - which is expected, because its already been wiped). Nevertheless, my guess is that the thumbnails of those videos/images are also cached elsewhere. But where?
My question is - is that all there is to it? Is the OS storing any more related data in regard to images/videos that I need to wipe? Are those actions I have taken enough to give me peace of mind that my media are safely wiped off beyond recovery?
I found that the secure deletion apps are very few, most of them require root and most even don't work properly (e.g. files reappearing after wipe etc). There are some good ones like 'ishredder 3 pro' and 'clean master' that offer secure wipe options - but only for wiping off entire phone/card memory - which is not what I want here. Any more suggestions?
The phone is a non-rooted Samsung with 4.1.2 Android OS on it. I don't wanna root the phone and I don't want to wipe entire ext card - so any suggestions, please bear that in mind.
Makes me wondering why there isn't any build-in function to the OS for secure deletion of files? Sure it would be slower and not everyone would applaud it, but it could be enabled on demand e.g. via Developer Options...
ta!
I have also noticed, that ever since I started using 'secure file deletion', when I connect via USB to copy files from the extSD to the PC, I get "device not connected" errors every few files I copy. Then, I have to use 'enable usb debugging' (from Dev Options) in order to get the device to show up again.
Any thoughts on my initial queries will be most appreciated. Someone must have noticed those issues. Perhaps they are not specific to 4.1.2 but maybe other versions of the OS...
jstoner said:
Funny thing is that even after erasing those, I can still see the thumbnails of the corresponding video/image (but when I select it, it says 'file not found' - which is expected, because its already been wiped)
Click to expand...
Click to collapse
Just another observation regarding this. If I go into File Manager and nagivate to "/storage/extSdCard/DCIM/Camera" and then go back to Gallery, then the thumbs of videos that are already deleted don't show up. That's a workaround for refreshing the cache (without having to do a full restart).
Anyone noticed those issues, or is it just me???

[Q] security with and without root / safestrap / nexus ROM

Hi all,
after getting my new 99 € Fire HDX 7" and managing to root it, install Safestrap and the Nexus ROM, I am now somewhat worried about the security of the device in case it gets lost or stolen. Let me explain:
Among other apps with personal data I have my email account installed on the device, so anyone getting access to it can easily get into my ebay/paypal/amazon/whatever accounts using the forgot-password functionality of those web sites.
What one would do on a stock kindle in order to prevent this: use an unlock PIN for the screen and disable ADB. That should be sufficient, I guess, as I don't see what additional security there should be in enabling encryption except that someone could physically remove the flash chips from the device (but that risk I'm willing to take, as I don't deem my data sensitive enough for someone to go take the device apart).
Now how is the situation once Safestrap and the Nexus ROM are installed? I can still disable ADB in the settings, but on every reboot the Safestrap screen gets displayed and a thief can easily get into the Safestrap recovery and browse the files from there. Would it be possible for him to export files from there, reset a ROM to remove the PIN or do something else to get access to the system?
If so, would it be possible to enable encryption on the Kindle HDX to prevent this? Or would encrypting not work with Safestrap or even brick the device?

Sometimes downloads aren't starting at all

I have a Moto Z with stock image, Magisk Root and Turbo Z Custom Kernel.
As far as I see everything is fine except two one things:
1. Sometimes downloads aren't starting at all. Which is very weird because regular surfing with Chrome works flawlessly. But if I want to watch a video from YouTube (regardless whether YouTube app or within Chrome) the video won't play sometimes. The same happens with F-Droid downloads. Sometimes an installation/updated doesn't even start the download. The network is fine (it works perfectly with any other device).
2. I have a screenlock set up but I don't think there is encryption active. I have to type the password just once (device boots to GUI then SIM pin, then unlock PIN). On encryption the unlock PIN have to be entered bevore booting into the GUI — right? However, Security Settings claims that the phone is encrypted. I wanted to set / change the password with cryptfs password manager but the app doesn't even start claiming 'cannot get superuser access' (maybe it's not compatible to Magisk?). Is it possible to change/set the password in this state without risking data loss?
The stock kernel enforces encryption, the z-kernel doesen't. However, your stock kernel already did its deeds. So if you really want to remove encryption, here is what you might want to do:
Remove all phone passwords (pin/password/pattern etc), then make a backup of everything. (If you don't & then restore such a backup, you'll always end up with password/pin/pattern mismatch).
Then boot into TWRP recovery and format(!) data partiton (erase just doesn't cut it..). If there's still a problem, change data's filesystem to ext4 and then back to f2fs - that should remove any nasty residual settings.
Then reboot & enjoy. Maybe you can restore the backed-up data files to the unencrypted partition now, but I wouldn't bet on it...
Hi again @benzinerwin
However, I don't want to remove encryption. I want to enable it.
It says that it is enabled in settings but I strongly doubt that it actually is.
Just change the password, opt for boot password (or whatever it's called), boot into TWRP and see if it asks for password/pattern to unlock access to the data partition...
If you cannot get there, just do the above, end up with an unencrypted data partition and the go through the settings and trigger the encryption with boot pass etc...
benzinerwin said:
Just change the password, opt for boot password (or whatever it's called[…]
Click to expand...
Click to collapse
That was it
In retrospective this is pretty obvious. Thank you.
Now just the problem with the struggling downloads is left.
Hmm, about the strange download problem... that pretty much sounds like an app not having all the requested rights (look through all the settings, not just the app's properties... [sigh])
But it affects all apps. Even Chrome. Regular surfing is fine but for example loading a YouTube file sometimes doesn't even start.

Categories

Resources