Burning custom secure boot keys #8
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
So I heard that many retail Exynos devices actually have unused keybanks (in the form of efuses) that one can install their own secure boot key to, and then be able to self-sign any bootloader they desire and boot it from internal storage (non-tethered).
Now I was linked one repository (mirror) relating to burning keys, and I noticed it actually patches S-BOOT to call some functions (likely involving
smcs) to do so from download mode.Since osmium is a download mode exploit, perhaps it can pull this off? >:D
@chipmunkmc wrote in #8 (comment):
Maybe
I looked into it a bit, particularly by looking for these functions in a copy of S-BOOT I have, and I think I found them.
The
cm_otp_write_rom_sec_boot_keyfunction can be identified with the string"[OTP] ROM_SECURE_BOOT_KEY program start\n". It takes a key and a length (expected to be 32).It seems to create a 160-byte buffer, copy the key to the beginning, add the length value at offset 128, and what looks like a checksum at offset 132. It then calls a function which seemingly clears the buffer from the CPU cache, and then calls
smc 0with0xc2001014inx0.The
cm_otp_write_use_rom_sec_boot_keyfunction has the string"[OTP] USE_ROM_SEC_BOOT_KEY program start\n", and it seems to callsmc 0with0xc2001014inx0and 2 inx1.I suppose the simplest thing to do would be to use osmium to run a small program that calls these functions. I'm not sure which device(s) I want to test this on though (since fusing is a permanent operation).
It seems as if the two functions I mentioned likely do not exist on older chipsets' bootloaders, like that of my SM-J327T1 (edit: and SM-J727T1). They exist in the SM-S367VL S-BOOT though.
I also looked at the signing data at the end of an SM-J327T1 bootloader, and apparently it uses signer version 3. The SM-S367VL bootloader uses version 4, though the data in both bootloaders otherwise looked alike.
I still see some interesting strings in the SM-J327T1 bootloader, like
"[OTP] OEM_KEY0 setting: start 1/2...\n"and"[OTP] OEM_KEY1 setting: start 1/2\n". Maybe OEM_KEY1 is another keybank?I also see
"[CM] TEST 04/11: call cm_secure_boot_set_pubkey()\n", though it exists in SM-S367VL S-BOOT too.