• GeneralSolved
  • My audit of GrapheneOS is complete, found two more issues

I have completed my audit of GrapheneOS.

Verdict:

Two leaks in the VPN implementation was found. One DNS leak, and one MDNS/multicast leak. I reported these issues to GrapheneOS developers about one and a half month ago. GrapheneOS developers have confirmed both issues, and attempted to fix the first one, but had to revert the fix because it interfered with some VPN apps. A new fix will be developed. No work has been started yet at fixing the MDNS/multicast leak, but the issue is confirmed.

https://github.com/GrapheneOS/os-issue-tracker/issues/3442
https://github.com/GrapheneOS/os-issue-tracker/issues/3443

I have looked for information leaks over both Wifi and 4G while using various apps. Only expected data traffic was observed, no leaks. Revoking Network permission works as expected, it blocks the app from sending or receiving network traffic.

I have analyzed what files are stored in what storage classes. I was unable to confirm things are actually encrypted, but I think the Cellebrite leak recently kind of proved that it is, so I didn't bother to dig deeper. Storage classes and what data is stored how is given below. I have already pointed out that some sensitive data is stored in a way not requiring your credentials to read. The developers are already very aware of this limitation, and have been clear it is too low priority to fix for now, and that Device Encryption still provides some protection. So this is for your information only. But, one issue I uncovered seem far more serious. Log files with very precise information about what you do on your device, including the exact files you open with full unencrypted file names, and timestamps, and what user profile did it, is stored as Device Encrypted, ie without being protected with your login credentials such as PIN or password at all. This defeats the purpose of file name encryption, and may also leak other sensitive user specific app data. I reported this issue today.

https://github.com/GrapheneOS/os-issue-tracker/issues/3583

I also by chance discovered a flaw in the app permission UI, where not all file based permissions show up, possibly misleading the user to believe an app do not have access to files and media at all, when it fact it has full read/write access to the whole file system. I reported this issue today too.

https://github.com/GrapheneOS/os-issue-tracker/issues/3584

That is it! I promised to post this once I completed the audit, and now I have!

Device Encrypted:

Things stored in this storage class are protected and encrypted by the Secure Element hardware, bootloader firmware and GrapheneOS firmware. An attacker needs to find an exploit against any of them to read out this data, but will not need your PIN code, password or any other user credential.

List of installed app is Device Encrypted, including the APKs themselves. List of user profiles and their profile pictures are Device Encrypted. Various non-sensitive system information and non-sensitive system related cache files are Device Encrypted. Device uptime and usage statistics is Device Encrypted. Log files are Device Encrypted. Per user app permissions are Device Encrypted. Bluetooth and cell tower configuration seem to be Device Encrypted, presumably including associated Bluetooth devices. File sizes or number of files for each user is Device Encrypted, even when the filenames and file data themselves are Credential Encrypted. Log files is from all user profiles, and may leak information about what files exists in the user profile, and what actions the user has done with exact timestamps. File sizes and file counts alone can also reveal what files it is, if they have been downloaded from the web, or uploaded to the web. I found nothing else that is Device Encrypted.

Credential Encrypted:

Things stored in this storage class is protected and encrypted by the Secure Element hardware, bootloader firmware, GrapheneOS firmware and your PIN code or password. An attacker does not only need to break the Device Encrypted storage class, but then also need to break your PIN code or password using brute-force after that. A 6 digit PIN code would be trivial to break once Device Encrypted storage class is broken, but a long password of 7 or more diceware words should protect your files and data that is Credential Encrypted for many years, even if the hardware and software is completely broken by an attacker.

All app cache and user data are Credential Encrypted per user. All files visible in Files app are Credential Encrypted per user, including all thumbnails. File names of all app cache, user data and all files are Credential Encrypted per user. When you log out a user, the files for that user becomes unavailable again, as before the user was logged in. You cannot log out the Owner user, so don't store sensitive files there, unless you want to turn of your phone completely. I am uncertain, but stored Wifi networks and their passwords are possibly also Credential Encrypted, but I didn't confirm this with certainty because usually that information is not sensitive anyway.

Per Boot Encrypted:

I would guess this is encrypted with a key that is regenerated at every boot. Only swap storage seem to be of this storage class, nothing else. This would be as expected, and secure, assuming key is wiped at poweroff or reboot.

Unencrypted:

GrapheneOS itself is unencrypted. Data related to the SIM card is unencrypted, including the name of your carrier. Modem related user data is unencrypted. This information is available to any attacker who disassembles your phone, that is all they need to do, but none of this information seem sensitive, so that is likely no issue.

    ryrona I also by chance discovered a flaw in the app permission UI, where not all file based permissions show up, possibly misleading the user to believe an app do not have access to files and media at all, when it fact it has full read/write access to the whole file system. I reported this issue today too.

    https://github.com/GrapheneOS/os-issue-tracker/issues/3584

    As discussed in the issue itself, the permission can be found in Settings > Apps > Special app access. That's where it is in upstream. Mentioning it here for people who are not aware. It's not an issue, it's just how the AOSP UI is.

    ryrona Log files is from all user profiles, and may leak information about what files exists in the user profile, and what actions the user has done with exact timestamps

    Apart from a factory reset is there any way to wipe the log files?

      ryrona When you log out a user, the files for that user becomes unavailable again, as before the user was logged in. You cannot log out the Owner user, so don't store sensitive files there, unless you want to turn [off] your phone completely.

      Interesting point!

      ryrona I have analyzed what files are stored in what storage classes. I was unable to confirm things are actually encrypted, but I think the Cellebrite leak recently kind of proved that it is, so I didn't bother to dig deeper. Storage classes and what data is stored how is given below. I have already pointed out that some sensitive data is stored in a way not requiring your credentials to read. The developers are already very aware of this limitation, and have been clear it is too low priority to fix for now, and that Device Encryption still provides some protection. So this is for your information only. But, one issue I uncovered seem far more serious. Log files with very precise information about what you do on your device, including the exact files you open with full unencrypted file names, and timestamps, and what user profile did it, is stored as Device Encrypted, ie without being protected with your login credentials such as PIN or password at all. This defeats the purpose of file name encryption, and may also leak other sensitive user specific app data. I reported this issue today.

      https://github.com/GrapheneOS/os-issue-tracker/issues/3583

      Response by one of our developers that looked into it:

      https://github.com/GrapheneOS/os-issue-tracker/issues/3583#issuecomment-2138848174

      logd logs aren't persisted to storage on production builds.

      Persistence of these logs is enabled on debuggable builds by the logd.logpersistd=logcatd system property override.

      logd and logpersist SELinux domains aren't even allowed to write anything to /data/misc/logd on production builds:
      https://github.com/GrapheneOS/platform_system_sepolicy/blob/2a69fff9c2bd85156a24ec03c46b2bf79662ff3e/private/logd.te#L8
      https://github.com/GrapheneOS/platform_system_sepolicy/blob/2a69fff9c2bd85156a24ec03c46b2bf79662ff3e/private/logpersist.te#L23

      See https://github.com/GrapheneOS/platform_system_logging/blob/14/logcat/logcatd.rc and https://github.com/GrapheneOS/platform_system_logging/blob/14/logd/README.property for more info.

      DeletedUser115 Apart from a factory reset is there any way to wipe the log files?

      Turns out the log files are not persisted at all on production builds, according to the analysis by one of the GrapheneOS developers, so in that case there is no issue at all. The logs are only in memory on production builds, so wiped in a secure way at every device reboot. Since it is not possible to audit production builds, I could not confirm this myself, but it is plausible this is right, see my comment in the ticket I filed.

      Still, it could be good to be aware that the owner profile can see the logs from the current boot cycle, and thus also the files of all other user profiles that have been logged in during the current boot cycle. Not much problem if you are using all user profiles for yourself, but a possible privacy issue in case you share the device with someone.

        4 months later

        Marking as solved as both initial issues have now been addressed by GrapheneOS:

        https://github.com/GrapheneOS/os-issue-tracker/issues/3442
        https://github.com/GrapheneOS/os-issue-tracker/issues/3443

        The DNS leaks can be made stricter once a way to do so without breaking app compatibility is found, and the multicast issues found have been fixed, along with other issues the developer working on this found along the way.

        The multicast fixes will have to be reverted for now to address some regressions.