I'm exploring UEFI secure boot and want to verify the certificates of the signed binaries.
The code below shows there are indeed some signatures present:
sbverify --list $BOOT/EFI/BOOT/BOOTX64.EFI warning: data remaining[1171248 vs 1334816]: gaps between PE/COFF sections? signature 1 image signature issuers: - /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft Corporation UEFI CA 2011 image signature certificates: - subject: /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft Windows UEFI Driver Publisher issuer: /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft Corporation UEFI CA 2011 - subject: /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft Corporation UEFI CA 2011 issuer: /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft Corporation Third Party Marketplace Root I want to verify that signature using a totally wrong certificate, and am expecting the verification to fail. In the steps below I create a random certificate and attempt to verify the binary signature with it:
openssl genpkey -algorithm RSA -out random-private-key.pem openssl req -new -x509 -key random-private-key.pem -out random-certificate.pem -days 365 -subj "/C=US/ST=California/L=San Francisco/O=My Organization/OU=My Unit/CN=mydomain.com" sbverify --cert random-certificate.pem $BOOT/EFI/BOOT/BOOTX64.EFI # Output: # warning: data remaining[1171248 vs 1334816]: gaps between PE/COFF sections? # Signature verification OK This is either a:
- false positive - no way the binary is signed by the just created random cert
- I'm misunderstanding the
sbverifyflags - Bug in
sbverify
Does anyone know a method for confirming the signature of an EFI binary?