Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS13M3Z3LWNjYzUtcXI4ds4AArtL

Use After Free in Context::start_auth_session

Impact

This issue only applies to applications starting authorization sessions using an explicit initial nonce.

When Context::start_auth_session was called with a nonce argument value of Some(...), the nonce pointer passed down through FFI to Esys_StartAuthSession would be a dangling pointer, left over from a defunct instance of TPM2B_NONCE. This could lead to an incorrect value being used as a nonce, though whether that value is controllable is unclear (so should be assumed as possible). The error became apparent due to changes in v1.61.0 of the Rust compiler.

Logs indicating a failure due to this issue (with the 1.61.0 version of the Rust toolchain) look as follows:

2022-05-24T01:04:41.9131341Z WARNING:esys:src/tss2-esys/api/Esys_StartAuthSession.c:390:Esys_StartAuthSession_Finish() Received TPM Error 
2022-05-24T01:04:41.9132192Z ERROR:esys:src/tss2-esys/api/Esys_StartAuthSession.c:136:Esys_StartAuthSession() Esys Finish ErrorCode (0x000001d5) 
2022-05-24T01:04:41.9145124Z [2022-05-24T01:04:41Z ERROR tss_esapi::context::tpm_commands::session_commands] Error when creating a session: structure is the wrong size (associated with parameter number 1)
2022-05-24T01:04:41.9153816Z thread 'main' panicked at 'Call to start_auth_session failed: Tss2Error(FormatOne(FormatOneResponseCode { .0: 469, error_number: 21, parameter: true, format_selector: true, number: 1 }))', tss-esapi/tests/integration_tests/context_tests/tpm_commands/enhanced_authorization_ea_commands_tests.rs:870:14

Patches

The issue has been patched in versions 6 and 7 of the tss-esapi crate. Please update to 7.1.0 or 6.1.2.

Workarounds

There is no workaround that achieves the same functionality.

References

For more information on the cause of the issue and the fix, see this PR.

For more details about the TPM2_StartAuthSession command see section 11.1 of the TPM spec, part 3, and section 19.6.3 of part 1 of the same spec for more information regarding session nonces.

For more information

If you have any questions or comments about this advisory:

Permalink: https://github.com/advisories/GHSA-w3vw-ccc5-qr8v
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13M3Z3LWNjYzUtcXI4ds4AArtL
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: almost 2 years ago
Updated: over 1 year ago


Identifiers: GHSA-w3vw-ccc5-qr8v
References: Repository: https://github.com/parallaxsecond/rust-tss-esapi
Blast Radius: 0.0

Affected Packages

cargo:tss-esapi
Dependent packages: 11
Dependent repositories: 20
Downloads: 198,737 total
Affected Version Ranges: < 6.1.2, >= 7.0.0, < 7.1.0
Fixed in: 6.1.2, 7.1.0
All affected versions: 1.0.0, 1.0.1, 2.0.0, 3.0.0, 3.0.1, 3.0.2, 5.0.0, 5.0.1, 5.1.0, 6.0.0, 6.1.0, 6.1.1, 7.0.0, 7.0.1
All unaffected versions: 6.1.2, 7.1.0, 7.2.0, 7.3.0, 7.4.0, 7.5.0, 7.5.1