2

I'm in the market for a new phone. The cheapest ones with decent specs are from China. Unfortunately I've read articles of phones sending data back to China for spying purposes.

The phone I am looking to buy is the Xiaomi Poco X3 NFC which has had their code open sourced https://github.com/MiCode/Xiaomi_Kernel_OpenSource/tree/surya-q-oss.

I will be flashing it to one of the most trusted sources either Pixel Experience or Lineage OS. Let's assume that neither of these are malicious.

Then my question is, is it possible, that despite me flashing the software to something safe, that it still is malicious? The reason I ask is because I'm wondering what happens if there is a malicious bootloader and a protected part of the memory or storage that isn't removed. Then the malicious bootloader could initially load this part of memory / storage and initiate something malicious (ie a program that sends data to china) and then proceed to load the custom image that I've flashed. Im trying to understand whether this is even technically possible. If it is, how would I know if this was happening? Since the code is open source, can I check what is on the phone matches the open source code? Does the open source code even matter if there is some hardware that acts maliciously before loading the rest of the software? What would be some clues this was the case (either that something malicious happens initially or that a part of memory / storage is reserved for something malicious)?

1
  • 1
    "... which has had their code open sourced ..." - this is not the source code of the whole phone. This is only the Linux kernel with the modifications they use, i.e. no applications etc. Dec 21, 2020 at 6:16

2 Answers 2

4

Custom ROMs only flash /system partition and reuse the same kernel that comes with the device. Kernel is part of boot.img in /boot. Sometimes /vendor partition is also reflashed with the custom ROM if the vendor image is patched by the maintainer but proprietary drivers and firmwares of OEM remain as it is. Other partitions like /radio, /odm and bootloader remain stock.

OEM can add spyware in any of these proprietary blobs to keep it persistent across custom ROMs. The source code they release is only of Linux kernel as required by GPL. Qualcomm also releases kernel source of their Snapdragon SoCs along with code of Hardware Abstraction Layer (HALs) on codeaurora forums (CAF). Some custom ROMs use CAF kernels and HALs released by Qualcomm. You can measure security of these public images but cannot be sure about security of what is already on your device.

Android bootloader (ABL) is protected by secure boot enforced by the SoC. Even if your blootloader is unlocked along with unlock_critical, ABL cannot be patched or replaced. A malware in bootloader can persist until end of life of the hardware. Supply chain attack tends to be stealthy because they pass signature verification on boot and their signed updates are trusted by the update manager. It comes down to who you trust. If you are trusting custom ROM, you have to trust OEM also.

0
1

... trusted safe rom ...

You are starting with the assumption that the ROM is trusted and safe - which might be already the wrong assumption.

It might be trusted by you and others and the trust is likely mostly justified since what software is installed by this ROM is far more transparent compared to the original ROM's shipped by most vendors. It should not be fully trusted though since it still contains lots of binary components. It looks like you are less worried about the closed Google ecosystem which is tightly integrated into ROM's like Pixel Experience - and which is also helps in tracking, but maybe tracking by somebody you personally trust more (Google). But then there are closed firmware blobs which are needed to make better access of the hardware like camera or sometimes even allow access at all. These firmware blobs come from the manufacturer itself and are usually taken from the original ROM. Who knows what they do ...

As for safe - this is much more than trusted. Software may have bugs which can be used to exploit the system and which can sometimes be used as backdoor in the system and for extensive spying on the user. In the past there were lots of such issues in both Android kernel, vendor or supplier (like Broadcom) specific firmware, core services and apps. Just running another ROM usually does not protect you against such issues. Although a more recent ROM can help in case the vendor itself provides no recent security updates for the phone.

And this is only about what you get with the ROM. Once you start adding apps and services on top of the ROM (like adding the Google ecosystem to LineageOS) it only gets more complex on your phone, i.e. it will be less safe and it will also be less transparent what happens which should lead to less trust in the system.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .