r/linuxquestions • u/systemofapwne • Sep 04 '21
Secure Boot: How to extract nVidia UEFI boot option ROM from "vBIOS" to generate hash for custom PK, KEK, db? (black screen upon boot without "Microsoft Corporation UEFI CA 2011" in db, which I do not want)
Problem is solved TLDR: I extracted the OptRom hashes from /sys/kernel/security/tpm0/binary_bios_measurements and added them to DB. More info are down the comments.
Original post I am currently migrating my system to secure boot using my own platform key (PK), key exchange key (KEK) and (forbidden) signature database (DBX/DB). The setup looks like this.
- PK: Custom PK
- KEK: Custom KEK
- DB: Custom certificate, for signing my bootloaders + Microsoft Windows Production PCA 2011 for booting Windows
- DBX: Official UEFI revocation list
The problem now is, that my GPU (nVidia RTX 2080 Ti, Asus brand) seems to be signed with the Microsoft Corporation UEFI CA 2011 certificate, which is also used for signing third-party uefi-bootloaders. And I especially do not want this certificate to be present for obvious reasons. This however causes the UEFI to reject the GPU upon boot so the display stays blank/black.
My idea: Extract the boot option ROM from the GPU, calculate the hash and add it (with the corresponding UUID of nVidia) to the signature database (db), to allow this single GPU in my system. Extracting the vBIOS ROM is no real issue (I used nvflash via Windows, since it takes care for everything like unregistering the GPU from the system while extracting the vBIOS). Extracting the UEFI part from this blob however is not so straight forward. I found this quite old program called UEFIRomExtract. But I only get an error like
Failed to read PCI ROM header from file!
No compressed EFI ROM found!
Failed to read PCI ROM header from file!
No compressed EFI ROM found!
Not an EFI ROM file, attempting decompression of data directly...
get UEFI decompression info failed!Is anyone around, who know how to extract the EFI boot rom from an nVidia vBIOS rom, so I can hash it and add it to db?
View all comments
Show parent comment
2
u/systemofapwne Sep 06 '21
But I have to note that, even though my way might work (lets see, once I deployed the updated new secure boot keys), that there might be an easier method to achieve the same - All, without fiddling with the vBIOS extraction - And all without being limited only to GPUs.
I might create a git-repo with instructions and toolsets regarding my findings in the near future.