Viewing and resetting the BIOS passwords on the RedmiBook 16
I recently lost the BIOS password for my Xiaomi RedmiBook 16. Luckily, viewing and even resetting the password from inside a Linux session turned out to be incredibly easy.
As it turns out, both the user and the system ("supervisor") passwords are not hashed in any way and stored as plaintext inside EFI variables. Viewing these EFI variables is incredibly easy on a Linux system where efivarfs
is enabled, even under a regular user account and if secure boot is enabled:
$ uname -a
Linux book 5.10.7.a-1-hardened #1 SMP PREEMPT Tue, 12 Jan 2021 20:46:33 +0000 x86_64 GNU/Linux
$ whoami
xx
$ sudo dmesg | grep "Secure boot"
[ 0.010717] Secure boot enabled
Reading the variables:
$ hexdump -C /sys/firmware/efi/efivars/SystemSupervisorPw*
00000000 07 00 00 00 0a 70 61 73 73 77 6f 72 64 31 32 20 |.....password12 |
$ hexdump -C /sys/firmware/efi/efivars/SystemUserPw*
00000000 07 00 00 00 0a 70 61 73 73 77 6f 72 64 31 31 21 |.....password11!|
If you have a root shell, removing the passwords entirely is also possible:
# chattr -i /sys/firmware/efi/efivars/SystemUserPw* /sys/firmware/efi/efivars/SystemSupervisorPw*
# rm /sys/firmware/efi/efivars/SystemUserPw* /sys/firmware/efi/efivars/SystemSupervisorPw*
Reboot, and the BIOS no longer asks for a password to enter setup, change secure boot settings, etc.