From: Ken Goldman <kgold@linux.ibm.com>
To: "Guozihua (Scott)" <guozihua@huawei.com>,
Mimi Zohar <zohar@linux.ibm.com>,
Jonathan Corbet <corbet@lwn.net>
Cc: linux-integrity@vger.kernel.org
Subject: Re: [RFC PATCH -next] ima: Make tpm hash configurable
Date: Wed, 30 Aug 2023 15:26:07 -0400 [thread overview]
Message-ID: <df39ccaa-532e-c50c-fe75-0d13ab4e791c@linux.ibm.com> (raw)
In-Reply-To: <6a4766e4-1c50-f0a1-3efe-b3aada612bda@huawei.com>
On 8/30/2023 5:32 AM, Guozihua (Scott) wrote:
> On 2023/8/29 5:05, Ken Goldman wrote:
>> I'd like to present three possible cases, expanding on Mimi's
>> observation that the template hash is currently the hash of the
>> template data.
>>
>> My vote is #2, but all have merits.
>>
>> ----------
>>
>> 1. Leave the SHA-1 template hash.
>>
>> A. This does not break existing applications.
>>
>> B. The template data is protected by the TPM quote, which does not
>> have to be SHA-1.
>>
>> C. The SHA-1 digest provides some debug usefulness against a
>> non-malicious alteration of the template data. The application can
>> report which event record is incorrect.
>
> What the verifier can't do as of now is to tell which file has been
> corrupted, given the attacker managed to achieve a SHA-1 collision while
> keeping the measurement items reasonable.
That's why I said "non-malicious". A collision in that case is unlikely.
It's just a debug aid. The quote failed. Including a SHA-1 hash
can help in software debug.
>
> Even worse, as the TPM quote contains only an accumulated digest, there
> leaves a chance for the attacker to "fix" the TPM digest by generating
> additional measurement items. Without the ability to verify each and
> every individual measurement item verifier could produce a false
> negative result.
The quote uses SHA-256 or better, which the attacker cannot fix. In #1,
the SHA-1 hash is for debug, not for security.
>>
>> ----------
>>
>> 2. Include template hashes for all PCR banks.
>>
>> A. This breaks existing applications on the attestor side, but could
>> be made backward compatible / deprecated at the verifier side.
>>
>> B. The redundant data is an attack surface, in that the verifier must
>> remember to check the hashes against the quote AND against the
>> template data.
>>
>> C. The digest provides debug usefulness against malicious attacks on
>> the template data.
>>
>> D. This permits the use case where the template hash is NOT a hash of
>> the template data. In the UEFI event log (using IMA terms), the
>> template hash can be a digest of some other data and the template data
>> is a hint as to where and what that data is.
>>
>> E.g., the UEFI event EV_CPU_MICROCODE template data field has a patch
>> descriptor, while the template hash is a digest of the patch itself.
>
> As of now, IMA stores template hash with it's measurement item in the
> memory, and storing digest value from all banks would make the digest
> list N times bigger, where N would be an increasing number of supported
> algorithms by TPM.
N is not the number of supported algorithms. It's the number of
allocated PCR banks.
E.g., a typical TPM might support SHA-1, 256, 384, but only allocate
SHA-256 and SHA-384. The IMA log would hold those two.
In addition, while the digest list may be N times bigger, the record is
not, because most of the record is the template name, template data, ...
>>
>> ----------
>>
>> 3. Include a template hash for the strongest hash algorithm.
>>
>> A. It's not always clear what the strongest algorithm is.
>>
>> Otherwise, this is the same as #2.
>
> "strongest" algorithm does not exist. I think it would be better to find
> a extensible solution allowing for future upgrade.
Sometimes yes (SHA-256 vs. SHA-384). I agree that A. is the drawback of
#3. I voted for #2.
next prev parent reply other threads:[~2023-08-30 20:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-17 6:13 [RFC PATCH -next] ima: Make tpm hash configurable GUO Zihua
2023-08-17 14:19 ` Mimi Zohar
2023-08-18 1:25 ` Guozihua (Scott)
2023-08-18 23:17 ` Mimi Zohar
2023-08-19 8:43 ` Guozihua (Scott)
2023-08-28 21:05 ` Ken Goldman
2023-08-30 9:32 ` Guozihua (Scott)
2023-08-30 19:26 ` Ken Goldman [this message]
2023-08-30 9:14 ` Guozihua (Scott)
2023-08-30 12:27 ` Mimi Zohar
2023-08-29 14:09 ` Ken Goldman
2023-08-28 20:35 ` Ken Goldman
2023-08-30 9:38 ` Guozihua (Scott)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=df39ccaa-532e-c50c-fe75-0d13ab4e791c@linux.ibm.com \
--to=kgold@linux.ibm.com \
--cc=corbet@lwn.net \
--cc=guozihua@huawei.com \
--cc=linux-integrity@vger.kernel.org \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox