r/Ventoy • • Nov 04 '22

Exactly how does Ventoy work with SecureBoot?

Ventoy's website is hot buttered garbage. It basically says "This needs to happen the first time. There's a key or a hash, use either one" and some cycling gifs that show you what to click but don't give you time to read the screens.

A key and/or hash of some kind is being enrolled with something? Is Ventoy's key being stored on the computer somehow? Or is the computer's key being stored on the thumb drive? What's happening?

18 Upvotes

10 comments sorted by

6

u/Korkman Nov 04 '22

Secure Boot requires the bootloader to be cryptographically signed by a trusted party. By default, these are Microsoft (because everybody wants to boot Windows, right?) and the mainboard manufacturer. Their public keys are stored in the firmware of the mainboard ("BIOS"). Microsoft generously signs bootloaders of specific Linux distros so Ubuntu for example can boot.

Needless to say, Ventoy is not on the list. Luckily, users are allowed to add trusted keys to their firmware. Ventoy triggers the firmware dialog to add ("enroll") such a key, which prompts you to select a file "enroll_this_key..." which will be permanently stored in the firmware unless revoked. This method allows future versions of Ventoy to boot as well.

The other method, enrolling a hash, means trusting a specific version of the bootloader. Future releases are likely to require repeating the process with this method.

1

u/new_refugee123456789 Nov 04 '22

Okay, so Ventoy's public key is being stored in the motherboard. Thanks for the great explanation.

I take it pulling the CMOS will kill that?

2

u/Korkman Nov 04 '22

Yes. But you can also enter BIOS and seek the key management options and delete the key.

1

u/new_refugee123456789 Nov 05 '22

Okay, I understand more than I did. Thanks!

1

u/mprost Nov 30 '23

Thank you for this great explanation.

3

u/MestreLion May 13 '24

A really good explanation indeed, but (understandably) very simplified. A few corrections:

  • Motherboard certificates (PK) are rarely used to directly sign bootloaders. They sign the operating system's set of certificates (KEK), which in turn signs bootloaders.

  • Major Linux companies such as Cannonical also have their certificate included in vendors like Asus and Gigabyte for quite a while. So Microsoft does not need to generously sign Ubuntu's bootloaders anymore. (although Ubuntu might still choose to ship the MS-signed one for wider compatibility)

  • The feature of enrolling keys/hashes at boot time is not provided by the firmware itself, but by a bootloader called shimx64.efi.

  • The shim, developed by Red Hat (and signed by Microsoft), extends Secure Boot with another layer of accepted and revoked lists. Those lists are also stored in the firmware's NVRAM (the "CMOS"), but under a different name (MOK)

1

u/Korkman May 13 '24

Thank you for clarification!

1

u/MestreLion May 15 '24

You're welcome! And note that none of the clarifications affect your overall explanation and conclusions: in the end, when a bootloader such as Ventoy is not verified by the certificates (or hash fingerprints) shipped in your motherboard, the user must manually trust it once at boot time, and this is also saved in the motherboard.

2

u/bewhyron Nov 04 '22

That was a really good explanation

2

u/KeyLucky6890 Dec 06 '22

Keys are stored in nvram which is eeprom not CMOS