Skip to content

AddPCRProfile: add WithAllowSecurityLevelDowngraded - #555

Open
frederic-hoerni wants to merge 5 commits into
masterfrom
feature/permit-ev-efi-action-security-level
Open

AddPCRProfile: add WithAllowSecurityLevelDowngraded#555
frederic-hoerni wants to merge 5 commits into
masterfrom
feature/permit-ev-efi-action-security-level

Conversation

@frederic-hoerni

Copy link
Copy Markdown
Collaborator

No description provided.

@frederic-hoerni frederic-hoerni self-assigned this Jul 21, 2026
@frederic-hoerni
frederic-hoerni force-pushed the feature/permit-ev-efi-action-security-level branch from c315d4d to 5418be0 Compare July 21, 2026 12:00

@valentindavid valentindavid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks fine. Though I think it is mutually exclusive with "DMA Protection Disabled". But this is merge-able as is.

Comment thread efi/fw_load_handler.go
if includeThunderboltSecurityLevel0 {
ctx.ExtendPCR(internal_efi.SecureBootPolicyPCR, e.Digests[ctx.PCRAlg()])
}
allowThunderboltSecurityLevel0 = false // Only allow this event to appear once

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we might be able to set allowInsufficientDMAProtection to false here. And also set allowThunderboltSecurityLevel0 to false in previous case. I think those 2 measurements (dma protection disabled and security level downgraded) are mutually exclusive, right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok, done.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

does this change need a test?

@frederic-hoerni frederic-hoerni Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I will add a test for the "mutually exclusive" part.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

test added: TestMeasureImageStartErrAllowThunderboltSecurityLevel0WithInsufficientDMA

@pedronis pedronis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks, one nitpick/some questions

Btw do we need full WithAutoTCGPCRProfile integration with ActionProceed for this? should that be a follow up?

cc @valentindavid

Comment thread internal/efitest/log.go Outdated
StartupLocality uint8 // specify a startup locality other than 0
FirmwareDebugger bool // indicate a firmware debugger endpoint is enabled
DMAProtection DMAProtectionDisabledEventFlags // whether DMA protection is disabled
ThunderboltSecurityLevel0 ThunderboltSecurityLevel0EventFlags // whether security level is downgraded

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why not just a bool?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

changed to a bool.

Comment thread efi/pcr_profile_test.go Outdated
),
),
expected: []tpm2.PCRValues{
// Not including DMA protection string // TODO

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what is the TODO about?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

@valentindavid

Copy link
Copy Markdown
Member

Btw do we need full WithAutoTCGPCRProfile integration with ActionProceed for this? should that be a follow up?

We could. But given this is only very old firmware, maybe we should not do it. That probably will not add that many devices. If that opened for many devices that would be a bit different.

This adds an option WithAllowThunderboltSecurityLevel0() to allow a measurement
event EV_EFI_ACTION "Security Level is Downgraded to 0", which relates to the
Thunderbolt security level.

Some BIOS firmware on NUC8v5PNB devices measure this event and that breaks the
computation of the PCR policy, with this error:

  cannot measure secure boot policy: unexpected event type (EV_EFI_ACTION) found in log

This can be fixed on those devices either by configuring the BIOS to the most
secure option for Thunderbolt, or by updating the firmware.

Having a Thunderbolt security level of zero means that in some situations a
malicious Thunderbolt device could access potentially sensitive data in your
system’s memory. This is why this case is not supported by default.

However, in some cases, users cannot configure nor update the firmware and need
this option.
@frederic-hoerni
frederic-hoerni force-pushed the feature/permit-ev-efi-action-security-level branch from 5418be0 to c19422a Compare July 23, 2026 13:01
@frederic-hoerni

Copy link
Copy Markdown
Collaborator Author

I took into account the remarks of the review. I will squash the related commits before merge.

@pedronis pedronis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question

Comment thread efi/fw_load_handler.go
if includeThunderboltSecurityLevel0 {
ctx.ExtendPCR(internal_efi.SecureBootPolicyPCR, e.Digests[ctx.PCRAlg()])
}
allowThunderboltSecurityLevel0 = false // Only allow this event to appear once

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

does this change need a test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unexpected event type (EV_EFI_ACTION) found in log (Thunderbolt related)

3 participants