I've recently been staying at a hotel that provides a USB-A port to charge devices without having to use up an entire outlet. Like any normal person would, I plugged my phone into this port and expected it to charge.

But when I tried to boot my phone, I noticed that the OS signing-key signature (also called key fingerprint, and for the remainer of this article called the OS signature) was incorrect and that the phone would crash about five seconds into the boot process.

Here's the situation.

Likely due to a faulty implementation of USB-A in the hotel's port, my USB-C device began to supply power to the port (that is, the power was flowing out of my phone). This left my device at near-zero charge. When the device restarted, however, Android did not recognize that it was nearly out of power—it did, after all, detect that a power cable was connected—and began the boot process.

The boot process wouldn't finish. It would proceed for about five seconds and then the phone would crash—it would go entirely black and I would have to turn the phone on again. This was strange behavior, especially because I didn't realize at the time that the power cable wasn't charging the device (but rather draining it).

My device does not run a normal version of Android. I've modified the boot sequence to show me the OS cryptographic signature before the boot continues to ensure that the OS is trustworthy. This is a relatively common security measure.

I also noticed that the signature shown during the boot sequence did not match the correct OS signature. I thought that perhaps a new automatically-applied update of my operating system may have changed the signature, but no new update had been released. Furthermore, Android didn't mark the different signature as corrupted. It showed the 'your device has loaded a different operating system,' not 'your device is corrupted' as it would be expected to if the signature was calculated incorrectly.

Strictly-Enforced-Verified-Boot-Android-Nougat

What could be going on?

This left two plausible scenarios: the device was trying to boot off of the USB-A device (hence the different OS signature and the crash), or the low battery power (and resultant low voltage to the processor) caused the processor to incorrectly calculate the OS signature and crash when the voltage came too low.

Both of these scenarios are concerning.

If my phone was trying to boot off of the hotel USB-A device, this would mean that a less diligent user (who did not check OS signatures during boot) could be fooled into running a compromised OS that could theoretically flash itself onto the disk permanently.

If my phone was so low on battery that the processor was calculating the OS signature incorrectly, this would mean that the signature isn't trustworthy and that the power level failsafes in my device are faulty.

The diagnosis.

To test these theories, I charged my phone to full power using my own personal charger plugged into a wall outlet. I then turned the phone off, plugged it into the faulty USB-A port, and began the boot process.

If the situation remained the same—the OS signature is incorrect and the phone crashes—this would lend credibility to the hypothesis that the phone is trying to boot off of the disk connected to the USB-A port. If all goes well, the second hypothesis—that the low battery caused the signature to be calculated incorrectly and the device to crash—is more likely.

Lo and behold, the boot process went smoothly. The signature shown was correct, and the device successfully booted. I did notice, however, that the battery level was shown as zero until I unplugged the device from the hotel port.

While neither theory can be conclusively determined–it's perfectly possible that a third explanation exists—the evidence demonstrates that a combination of a low battery, a faulty USB-A port, and faulty power level failsafes contributed to the situation. Still, there is no explanation for why the incorrect signature wasn't marked as corrupted, despite being calculated incorrectly.

The takeaway: only trust your OS signature when your phone is plugged in, and be sure to check the OS's signature. And maybe avoid hotel chargers, too.