22 KiB
layout | title | mathjax | description |
---|---|---|---|
evergreen | Android | true | Android is a secure operating system that has strong [app sandboxing](https://source.android.com/security/app-sandbox), [verified boot](https://source.android.com/security/verifiedboot), and a robust [permission](https://developer.android.com/guide/topics/permissions/overview) control system. The main privacy concern with most Android devices is that they usually include [Google Play Services](https://developers.google.com/android/guides/overview). This component is proprietary, closed source, has a privileged role on your phone and may collect private user information. It is not a part of the [Android Open Source Project](https://source.android.com/) (AOSP) nor is it included with the below derivatives. |
AOSP Derivatives
{% for item_hash in site.data.operating-systems.android %} {% assign item = item_hash[1] %}
{% if item.type == "Recommendation" %} {% include recommendation-card.html %} {% endif %}
{% endfor %}
Android security and privacy features
User Profiles
Multiple user profiles (Settings → System → Multiple users) are the simplest way to isolate in Android. With user profiles you can limit a user from making calls, SMS or installing apps on the device. Each profile is encrypted using its own encryption key and cannot access the data of any other profiles. Even the device owner cannot view the data of other profiles without knowing their password. Multiple user profiles is a more secure method of isolation.
Work Profile
Work Profiles are another way to isolate individual apps and may be more convenient than separate user profiles.
A device controller such as Shelter is required, unless you're using CalyxOS which includes one.
The work profile is dependent on a device controller to function. Features such as File Shuttle and contact search blocking or any kind of isolation features must be implemented by the controller. The user must also fully trust the device controller app, as it has full access to the data inside of the work profile.
This method is generally less secure than a secondary user profile; however, it does allow you the convenience of running apps in both the work and personal profiles simultaneously.
Verified Boot
Verified boot is an important part of the Android security model. It provides protection against Evil maid attacks, malware persistence, and ensures security updates cannot be downgraded with rollback protection.
Android 10 and above has moved away from full-disk encryption (FDE) to more flexible file-based encryption.
Each user's data is encrypted using their own unique encryption key, and the operating system files are left unencrypted. Verified boot ensures the integrity of the operating system files preventing an adversary with physical access from tampering or installing malware on the device. In the unlikely case that malware is able to exploit other parts of the system and gain higher privileged access, verified boot will prevent and revert changes to the system partition upon reboot of the device.
Unfortunately, original equipment manufacturers (OEMs) are only obliged to support verified boot on their stock Android distribution. Only a few OEMs such as Google support custom Android Verified Boot (AVB) key enrollment on their devices. Some AOSP derivatives such as LineageOS or /e/ OS do not support verified boot even on hardware with verified boot support for third party operating systems. We recommend that you check for support before purchasing a new device. AOSP derivatives which do not support verified boot are not recommended.
VPN Killswitch
Android 7 and above supports a VPN killswitch and it is available without the need to install third party apps. This feature can prevent leaks if the VPN is disconnected. It can be found in ⚙️ Settings → Network & internet → VPN → ⚙️ → Block connections without VPN.
Global Toggles
Modern Android devices have global toggles for disabling Bluetooth and location services. Android 12 introduced toggles for the camera and microphone. When not in use, we recommend disabling these features. Apps cannot use disabled features (even if granted individual permission) until renabled.
Recommended Apps
{% for item_hash in site.data.operating-systems.android-applications %} {% assign item = item_hash[1] %}
{% if item.type == "Recommendation" %} {% include recommendation-card.html %} {% endif %}
{% endfor %}
General Recommendations
Avoid Root
Rooting Android phones can decrease security significantly as it weakens the complete Android security model. This can decrease privacy should there be an exploit that is assisted by the decreased security. Common rooting methods involve directly tampering with the boot partition, making it impossible to perform successful verified boot. Apps that require root will also modify the system partition meaning that verified boot would have to remain disabled. Having root exposed directly in the user interface also increases the attack surface of your device and may assist in privilege escalation vulnerabilities and SELinux policy bypasses.
Adblockers (AdAway) which modify the hosts file and firewalls (AFWall+) which require root access persistently are dangerous and should not be used. They are also not the correct way to solve their intended purposes. For Adblocking we suggest encrypted DNS or VPN server blocking solutions instead. RethinkDNS, TrackerControl and AdAway in non-root mode will take up the VPN slot (by using a local loopback VPN) preventing you from using privacy enhancing services such as Orbot or a real VPN server.
AFWall+ works based on the packet filtering approach and is bypassable in some situations.
We do not believe that the security sacrifices made by rooting a phone are worth the questionable privacy benefits of those apps.
Firmware Updates
Firmware updates are critical for maintaining security and without them your device cannot be secure. Original equipment manufacturers (OEMs) - phone manufacturers have support agreements with their partners to provide the closed source components for a limited support period. These are detailed in the monthly Android Security Bulletins.
As the components of the phone such as the processor and radio technologies rely on closed source components, the updates must be provided by the respective manufacturers. Therefore it is important that you purchase a device within an active support cycle. Qualcomm and Samsung support their devices for 4 years while cheaper products often have shorter support. With the introduction of the Pixel 6, Google now makes their own system on chip (SoC) and they will provide 5 years of support.
Devices that have reached their end-of-life (EoL) and are no longer supported by the SoC manufacturer, cannot receive firmware updates from OEM vendors or after market Android distributors. This means that security issues with those devices will remain unfixed.
Android versions
It's also important to make sure that you're not using an end-of-life version of Android. Newer versions of Android not only receive security updates for the operating system but also important privacy enhancing updates too. For example, prior to Android 10, any user apps with the READ_PHONE_STATE
permission could access sensitive and unique serial numbers of your phone such as IMEI, MEID, your SIM card's IMSI, whereas now they must be system apps to do so. System apps are only shipped by the OEM or Android distribution.
Android Permissions
Permissions on Android grant users control over what apps are allowed to access. Google regularly makes improvements on the permission system in each successive version. All user installed apps are strictly sandboxed, therefore there is no need to install any antivirus apps. The savings you make from not purchasing or subscribing to security apps is better spent on paying for a supported device in the future.
Should you want to run an app that you're unsure about consider using a user or work profile.
SafetyNet and Play Integrity API
SafetyNet and the Play Integrity APIs are generally used for banking apps. Many banking apps will work fine in GrapheneOS with sandboxed Play services, however some non-financal apps have their own crude anti-tampering mechanisms which might fail. GrapheneOS passes the basicIntegrity
check, but not the certification check ctsProfileMatch
. Devices with Android 8 or later have hardware attestation support which cannot be bypassed without leaked keys or serious vulnerabilities.
As for Google Wallet, we don't recommend this due to their privacy policy, which states you must opt-out if you don't want your credit rating and personal information shared with affiliate marketing services.
Android Device Shopping
Google Pixels are known to have good security and properly support verified boot. Some other phones such as the Fairphone and Oneplus devices also support custom Android verified boot (AVB) key enrollment. However, there have been issues with their older models. In the past they were using test keys or not doing proper verification, making verified boot on those devices useless.
Avoid buying phones from mobile network operators. These often have a locked bootloader and do not support OEM unlocking. These phone variants will prevent you from installing any kind of alternative Android distribution. Phones that cannot be unlocked will often have an IMEI starting with "35", that includes phones from purchased from Verizon, Telus, Rogers, EE etc.
Be very careful about buying second hand phones from online marketplaces. Always check the reputation of the seller. If the device is stolen there's a possibility of IMEI blacklisting. There is also a risk involved with you being associated with the activity of the previous owner.
We have these general tips:
- If you're after a bargain on a Pixel device, we suggest buying an "a" model, just after the next flagship is released. Discounts are usually available because Google will be trying to clear their stock.
- Consider price beating options and specials offered at brick and mortar stores.
- Look at online community bargain sites in your country. These can alert you to good sales.
- The price per day for a device can be calculated as \({\text {EoL Date}-\text{Current Date} \over \text{Cost}}\). Google provides a list of their supported devices.
- Do not buy devices that have reached or are near their end-of-life, additional firmware updates must be provided by the manufacturer.
- Do not buy preloaded LineageOS or /e/ OS phones or any Android phones without proper verified boot support and firmware updates. These devices also have no way for you to check whether they've been tampered with.
- In short, if a device or Android distribution is not listed here, there is probably a good reason, so check our discussions page.
The installation of GrapheneOS on a Pixel phone is easy with their web installer. If you don't feel comfortable doing it yourself and are willing to spend a bit of extra money, check out the NitroPhone as they come preloaded with GrapheneOS from the reputable Nitrokey company. The GrapheneOS project is not currently affiliated with any vendor and cannot ensure the quality or security of their products.
A CalyxOS membership also entitles you to a device preloaded with CalyxOS.
Security comparison of GrapheneOS and CalyxOS
Profiles
CalyxOS includes a device controller app so there is no need to install a third party app like Shelter. GrapheneOS plans to introduce nested profile support with better isolation in the future.
GrapheneOS extends the user profile feature allowing a user to press an "End Session" button. This button clears the encryption key from memory. There are plans to add a cross profile notifications system in the future.
INTERNET permission vs packet filtering
Packet filter based solutions such Datura Firewall, LineageOS (DivestOS), AFWall+ and NetGuard, are not ideal as they can leak and don't prevent an app from proxying a network request through another app using an intent.
Android has a built-in INTERNET
permission. This is enforced by the operating system. On AOSP and most of its derivatives, it is treated as an install time permission. GrapheneOS changes it to runtime permission, meaning that it can be revoked to deny internet access to a specific app.
The INTERNET
permission is a strong way of controlling internet access. It also blocks direct access to the internet and access to other APIs that rely on the INTERNET
permission. The only way for an app to circumvent it is for it to communicate with another app that has been granted INTERNET
permission via mutual consent. Such communication can be prevented by putting apps into seperate profiles.
Some apps might crash if their INTERNET
permission is revoked. CalyxOS instead uses a firewall to achieve a similar outcome however, in some circumstances CalyxOS's approach may leak (#572, #581).
Sandboxed Play Services vs Privileged MicroG
When Google Play services are used on GrapheneOS, they run as a user app and are contained within a user or work profile.
Sandboxed Play Services are confined using the highly restrictive, default untrusted_app
domain provided by SELinux. Permissions for apps to use Play Services can be revoked at any time by the user.
MicroG is a reimplementation of Google Play Services. This means it needs to be updated every time Android has a major version update (or the Android API changes). It also needs to run in the highly privileged system_app
SELinux domain like the normal Play Services and is less secure than the Sandboxed Play Service approach. We do not believe MicroG provides any privacy advantages over Sandboxed Play Services except for the option to shift trust of the location backend from Google to another provider such as Mozilla or DejaVu.
Privileged App Extensions
Android 12 comes with special support for seamless app updates with third party app stores. The popular Free and Open Source Software (FOSS) repository F-Droid doesn't implement this feature and requires a privileged extension to be included with the Android distribution in order to have unattended app installation.
GrapheneOS doesn't compromise on security, therefore they do not include the F-Droid extension therefore, users have to confirm all updates manually if they want to use F-Droid. GrapheneOS officially recommends Sandboxed Play Services instead. Many FOSS Android apps are also in Google Play but sometimes they are not (like [NewPipe]({% link _evergreen/video-streaming.md %})).
CalyxOS includes the privileged extension, which may lower device security. Seamless app updates should be possible with Aurora Store in Android 12.
Additional Hardening
GrapheneOS improves upon AOSP security with:
- Hardened WebView: Vanadium WebView requires 64-bit processes on the WebView process and disables legacy 32-bit processes. It uses hardened compiler options such as
-fwrapv
and-fstack-protector-strong
, which can help protect against stack buffer overflows. APIs such as the battery status API are disabled for privacy reasons. All system apps on GrapheneOS use the Vanadium WebView which means user installed apps that use WebView will also benefit from Vanadium's hardening. The Vanadium patch set is a lot more comprehensive than CalyxOS's Chromium patch set which is derived from it. - Hardened Kernel: GrapheneOS kernel includes some hardening from the linux-hardened project and the Kernel Self Protection Project (KSPP). CalyxOS uses the same kernel as regular Android with some minor modifications.
- Hardened Memory Allocator: GrapheneOS uses the hardened malloc subproject as its memory allocator. This focuses on hardening against memory heap corruption. CalyxOS uses the default AOSP Scudo Malloc, which is generally less effective. Hardened Malloc has uncovered vulnerabilities in AOSP which have been fixed by GrapheneOS such as CVE-2021-0703.
- Secure Exec Spawning: GrapheneOS spawns fresh processes as opposed to using the Zygote model used by AOSP and CalyxOS. The Zygote model weakens Address Space Layout Randomization (ASLR) and is considered less secure. Creating fresh processes is safer but will have some performance penalty when launching a new application. These penalties are not really noticeable unless you have an old device with slow storage such as the Pixel 3a/3a XL as it has eMMC.
Please note that these are just a few examples and are not an extensive list of GrapheneOS's hardening.