parallaxsecond / parallaxsecond/rust-tss-esapi

Creating AK triggers TPM failure with hardware TPM on some Intel systems

Open
#367 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
135
Forks
80
Avg merge
1d 17h
Merged PRs (30d)
5

Description

I'm submitting this on behalf of my team, including @kkaarreell and @sergio-correia.

While running tests on the Rust Keylime agent using a hardware TPM, the team noticed that running the Create AK function triggers a failed TPM state on certain Intel systems (we don't have an exhaustive list). These same hardware TPMs work fine with our other Python agent, which does not use the rust-tss-esapi, leading us to believe this error may be rust-tss-esapi related. There is a miminal reproducer here that fails on this line.

  • OS: RHEL 9.1 *see note
  • TPM info: 'Issuer: C = DE, O = Infineon Technologies AG, OU = OPTIGA(TM) TPM2.0, CN = Infineon OPTIGA(TM) RSA Manufacturing CA 007'

Note: We don't currently have a Fedora test machine with hardware TPM as of today, but can get one if necessary. @sergio-correia did test this on F35 in the past week and reports similar results.

All tpm2_ commands produce expected output before running the mini reproducer. The output related to the error includes the following below:

This shows how the mini reproducer process hangs on ak::create_ak():

Hello, TPM world!
Preparing to kill the TPM of those Intel Whitley, Wilson City 2S, Ice Lake machines...
Preparing for ek::create_ek_object()
Preparing for ak::create_ak()

Output from dmesg after running the reproducer:

[ 1269.275809] tpm tpm0: tpm2_save_context: failed with a TPM error 0x0101
[ 1269.284334] tpm tpm0: A TPM error (257) occurred flushing context
[ 1269.292270] tpm tpm0: A TPM error (257) occurred flushing context
[ 1269.300268] tpm tpm0: A TPM error (257) occurred flushing context
[ 1269.306366] tpm tpm0: tpm2_commit_space: error -14

with that 257 error indicating...

# tpm2_rc_decode 257
tpm:error(2.0): commands not being accepted because of a TPM failure

Here is the output of tpm2_pcrread after running the reproducer:

# tpm2_pcrread
ERROR:tcti:src/tss2-tcti/tcti-device.c:501:Tss2_Tcti_Device_Init() timeout waiting for response from fd 3 
WARNING:esys:src/tss2-esys/api/Esys_GetCapability.c:303:Esys_GetCapability_Finish() Received TPM Error 
ERROR:esys:src/tss2-esys/api/Esys_GetCapability.c:107:Esys_GetCapability() Esys Finish ErrorCode (0x00000084) 
ERROR: Esys_GetCapability(0x84) - tpm:handle(unk):value is out of range or is not correct for the context
ERROR: Unable to run tpm2_pcrread

And tpm2_gettestresult (the value for data before the test was 0001f9db000000000000):

# tpm2_gettestresult
ERROR:tcti:src/tss2-tcti/tcti-device.c:501:Tss2_Tcti_Device_Init() timeout waiting for response from fd 3 
status:   success
data:   0001f9db0000000001d6

Any ideas on this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked minimal reproducer, especially src/main.rs:42 and the ak::create_ak() call, and run it on an affected Intel hardware TPM. Trace the rust-tss-esapi path used by Create AK while comparing the TPM and dmesg output. Done means the reproducer no longer hangs or leaves the TPM in a failed state on the affected systems.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.