-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from chrisccoulson/efi-support-firmware-agent…
…s-in-pcr4 efi: PCR4: Add support for certain firmware applications loaded during OS-present. Some newer laptops are loading endpoint management applications that are shipped with firmware, and these are being loaded as part of the OS-present environment with the LoadImage API, resulting in them being measured to PCR4. This currently causes us to mis-predict values for PCR4 because everything after the separator (the pre-OS to OS-present transition) is assumed to belong to the OS and gets dropped from the predicted measurements. A future PR will provide support for detecting compatibility for FDE, with an option for detecting and disallowing these firmware applications. In most cases, they should be disabled (and it's possible to disable Absolute from userspace on Dell laptops), but we should add support here for specific, known endpoint management applications for any edge cases where these agents cannot be disabled. This adds support for any applications where the firmware volume filename GUID is well known and maps to "AbsoluteAbtInstaller" or "AbsoluteComputraceInstaller".
- Loading branch information
Showing
8 changed files
with
537 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// -*- Mode: Go; indent-tabs-mode: t -*- | ||
|
||
/* | ||
* Copyright (C) 2024 Canonical Ltd | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 3 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
package internal | ||
|
||
import ( | ||
"fmt" | ||
|
||
efi "github.com/canonical/go-efilib" | ||
"github.com/canonical/go-efilib/guids" | ||
"github.com/canonical/tcglog-parser" | ||
) | ||
|
||
// IsAbsoluteAgentLaunch returns true if the supplied event corresponds to the launch of an | ||
// application that is associated with the Absolute (formerly Computrace) endpoint management | ||
// firmware. This will return false if the event is not associated with an application launch, | ||
// or the launch is not from a firmware volume, or the launch is from a firmware volume with | ||
// a filename that is not known to be Absolute. | ||
// | ||
// It will return an error if the event data is badly formed, ie, it doesn't decode properly | ||
// to the EFI_IMAGE_LOAD_EVENT structure, there is an empty device path or a badly formed | ||
// firmware device path that begins with a firmware volume that is not followed by a single | ||
// firmware volume filename. | ||
func IsAbsoluteAgentLaunch(ev *tcglog.Event) (bool, error) { | ||
if ev.EventType != tcglog.EventTypeEFIBootServicesApplication { | ||
// Wrong event type | ||
return false, nil | ||
} | ||
data, ok := ev.Data.(*tcglog.EFIImageLoadEvent) | ||
if !ok { | ||
// the data resulting from decode errors is guaranteed to implement the error interface | ||
return false, fmt.Errorf("%s event has wrong data format: %w", tcglog.EventTypeEFIBootServicesApplication, ev.Data.(error)) | ||
} | ||
if len(data.DevicePath) == 0 { | ||
return false, fmt.Errorf("%s event has empty device path", tcglog.EventTypeEFIBootServicesApplication) | ||
} | ||
|
||
if _, isFv := data.DevicePath[0].(efi.MediaFvDevicePathNode); !isFv { | ||
// Not loaded from a flash volume, so this isn't Absolute | ||
return false, nil | ||
} | ||
|
||
// The image is loaded from a flash volume - we should have a path of the form "Fv()\FvFile()". | ||
if len(data.DevicePath) != 2 { | ||
return false, fmt.Errorf("invalid firmware volume device path (%v): invalid length (expected 2 components)", data.DevicePath) | ||
} | ||
|
||
// The second component should be the filename in the firmware volume (both firmware volumes and the names | ||
// of files inside those volumes are identified with a GUID, for which there is a public database of well | ||
// known GUIDs). | ||
fvf, isFvf := data.DevicePath[1].(efi.MediaFvFileDevicePathNode) | ||
if !isFvf { | ||
// The second component is not a firmware volume filename | ||
return false, fmt.Errorf("invalid firmware volume device path (%v): doesn't terminate with FvFile", data.DevicePath) | ||
} | ||
|
||
// We have a complete firmware volume file path. The Absolute installer application has 2 well | ||
// known names. We can match directly by GUID or do a lookup using data in the public database. | ||
name, known := guids.FileOrVolumeNameString(efi.GUID(fvf)) | ||
if !known { | ||
// This is not a well known GUID and is not Absolute. | ||
return false, nil | ||
} | ||
switch name { | ||
case "AbsoluteAbtInstaller", "AbsoluteComputraceInstaller": | ||
return true, nil | ||
default: | ||
return false, nil | ||
} | ||
} |
Oops, something went wrong.