Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXE_DRIVER Example: Replace Test Platform Key with a new Platform Key #247

Draft
wants to merge 1 commit into
base: dev/202405
Choose a base branch
from

Conversation

Flickdm
Copy link
Member

@Flickdm Flickdm commented Nov 25, 2024

**** THIS SHOULD BE USED WITH CAUTION - PLEASE READ ****

Some platforms may have lost the private portion of the PK (Platform Key), or the PK may have been compromised (E.G Test Certificate). The former would prevent the operating system from updating the secure boot variables via a signed update. A Firmware update natively only updates the "Defaults" but not the active variables.

In these cases, it is necessary to replace the active PK with a new one via a firmware update. This example demonstrates how an OEM may replace the existing bad PK with a new one via firmware.

This shouldn't be included indefinitely in firmware and ideally is only transient. Do not arbitrarily add this to a platform's DSC without understanding the implications of it.

I've included a script that will generate a new Test PK on demand. However I am not providing a Test PK to prevent someone from adding that to their firmware. Additionally, I've set the payload to the windows PK so that if this driver does run it will replace the certificate with a well known good default.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?
  • Backport to release branch?

How This Was Tested

QemuQ35

Boot with Secure Boot disabled
exit from the shell
enable secure boot (with an appropriate target certificate)

Integration Instructions

N/A

Some platforms may have lost the private portion of the PlatformKey,
or the PlatformKey may have been compromised. In these cases, it is
necessary to replace the PlatformKey with a new one. This example
demonstrates how to replace the old PlatformKey with a new one. That
is intended to be used as a reference.

Targets a Test certificate that is not provided to prevent accidents.
@Flickdm Flickdm force-pushed the feature/OverridePlatformKey branch from ead1b32 to 79cbb07 Compare November 25, 2024 18:50
@github-actions github-actions bot added language:python Pull requests that update Python code impact:non-functional Does not have a functional impact impact:security Has a security impact labels Nov 25, 2024
*
* @param[in] Hash Pointer to the hash to compare against the existing PK.
* @param[in] HashSize Size of the hash in bytes.
*
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update comments

@@ -0,0 +1,271 @@
#include <Uefi.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs doxygen header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:non-functional Does not have a functional impact impact:security Has a security impact language:python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants