On Wed, Aug 26, 2026 at 05:07:00PM +0000, Sanket Sharma wrote:
> TSS_checkhmac1() and TSS_checkhmac2() silently return success when the
> response tag is TPM_TAG_RSP_COMMAND (0x00c4), bypassing HMAC
> verification entirely. A forged TPM response with this unauthenticated
> tag allows an attacker to skip integrity checks on TPM responses.

I don't think we need threat scenario role play here.

> 
> Reject TPM_TAG_RSP_COMMAND with -EINVAL in both functions, requiring
> all responses to carry a proper authenticated tag.
> 
> Signed-off-by: Sanket Sharma <[email protected]>
> ---
>  security/keys/trusted-keys/trusted_tpm1.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/security/keys/trusted-keys/trusted_tpm1.c 
> b/security/keys/trusted-keys/trusted_tpm1.c
> index d47cb7108..6dbbf4546 100644
> --- a/security/keys/trusted-keys/trusted_tpm1.c
> +++ b/security/keys/trusted-keys/trusted_tpm1.c
> @@ -201,8 +201,6 @@ static int TSS_checkhmac1(unsigned char *buffer,
>       tag = LOAD16(buffer, 0);
>       ordinal = command;
>       result = LOAD32N(buffer, TPM_RETURN_OFFSET);
> -     if (tag == TPM_TAG_RSP_COMMAND)
> -             return 0;
>       if (tag != TPM_TAG_RSP_AUTH1_COMMAND)
>               return -EINVAL;
>       authdata = buffer + bufsize - SHA1_DIGEST_SIZE;
> @@ -269,8 +267,6 @@ static int TSS_checkhmac2(unsigned char *buffer,
>       ordinal = command;
>       result = LOAD32N(buffer, TPM_RETURN_OFFSET);
>  
> -     if (tag == TPM_TAG_RSP_COMMAND)
> -             return 0;
>       if (tag != TPM_TAG_RSP_AUTH2_COMMAND)
>               return -EINVAL;
>       authdata1 = buffer + bufsize - (SHA1_DIGEST_SIZE + 1
> -- 
> 2.53.0
> 

BR, Jarkko

Reply via email to