Re: [RFC PATCH v2 03/13] ima: invalidate unsupported PCR banks
From: Nicolai Stange
Date: Wed Mar 26 2025 - 04:45:16 EST
James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> writes:
> On Mon, 2025-03-24 at 21:03 -0400, Mimi Zohar wrote:
>> On Sun, 2025-03-23 at 17:18 -0400, James Bottomley wrote:
> [...]
>> > Instead of any of that, why not do what the TCG tells us to do for
>> > unsupported banks and simply cap them with 0xffffffff record
>> > EV_SEPARATOR and stop extending to them? (note this would probably
>> > require defining a separator event for IMA)
>>
>> open-writers and ToMToU integrity violations are added to the IMA
>> measurement list as 0x00's, but are extended into the TPM using
>> 0xFF's. Unfortunately, as mentioned previously, some verifiers
>> ignore these integrity violations by automatically replacing the
>> 0x00's with 0xFF's.
I've researched the EV_SEPARATOR now, and according to [1], sec. 10.4.1
("Event Types"), PDF p. 128, the _digest_ of 0xffffffff is to get
extended. So there's no conflict with how IMA violations are extended
(plain 0xff ... ff), in case that was the reason Mimi mentioned it.
However, the main point of this patchset is to handle unsupported algos,
so I think the HASH(0xffffffff) constant cannot get computed.
> That sounds like something that should be fixed ...
>
>> What do you mean by "simply cap" them? Does it automatically prevent
>> the PCR from being extended? If not, then this patch set is doing
>> exactly that - preventing the TPM bank from additional extends.
>
> The idea of separators as understood by the TCG (the EV_SEPARATOR
> event) is that they divide the log up into different phases. If you
> see a measurement belonging to a prior phase after a separator you know
> some violation has occurred, even if the log itself verifies. The
> point being that if you log a separator in the last phase of boot (and
> for IMA logs there only is a single phase) there can be no more valid
> measurements after that event because of the separator, so the PCR is
> termed capped, meaning you can't validly extend to it and if you do the
> verifier shows a violation.
The motivation for extending with constant 0xfe ... fe into unsupported
banks is based on a very similar line of reasoning: because no event
template HASH() would possibly come out as that particular constant, no
sequence of events, including an empty one, could get verified against
such a bank.
Thanks,
Nicolai
[1] TCG PC Client Platform Firmware Profile Specification, Level 00
Version 1.06 Revision 52, December 4, 2023
https://trustedcomputinggroup.org/wp-content/uploads/TCG-PC-Client-Platform-Firmware-Profile-Version-1.06-Revision-52_pub-3.pdf
--
SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nürnberg, Germany
GF: Ivo Totev, Andrew McDonald, Werner Knoblich
(HRB 36809, AG Nürnberg)