GHSA-w3vw-ccc5-qr8v: Use After Free in Context :start_auth_session Vulnerability

MODERATE
Published
Advisory Summary

GHSA-w3vw-ccc5-qr8v is a MODERATE :start_auth_session vulnerability (General Security Weakness) affecting Use After Free in Context libraries in the crates.io ecosystem. The issue involves :start_auth_session. Remediation is available by upgrading affected packages to version 7.1.0, 6.1.2.

GHSA-w3vw-ccc5-qr8v at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-w3vw-ccc5-qr8v
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Use After Free in Context
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-w3vw-ccc5-qr8v

To remediate this vulnerability, upgrade all affected Use After Free in Context dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

tss-esapi fixed: 7.1.0
Upgrade tss-esapi to 7.1.0
tss-esapi fixed: 6.1.2
Upgrade tss-esapi to 6.1.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for tss-esapi

How to Check if You Are Affected

To determine whether your application is affected by GHSA-w3vw-ccc5-qr8v, inspect your project dependencies for Use After Free in Context:

inspect dependencies for tss-esapi

Analyze the terminal output to locate any version of Use After Free in Context in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.1.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Use After Free in Context, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact **This issue only applies to applications starting authorization sessions using an explicit initial `nonce`.** When [`Context::start_auth_session`](https://docs.rs/tss-esapi/7.0.1/tss_esapi/struct.Context.html#method.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](https://github.com/parallaxsecond/rust-tss-esapi/pull/344) PR. For more details about the `TPM2_StartAuthSession` command see section 11.1 of [the TPM spec, part 3](https://trustedcomputinggroup.org/wp-content/uploads/TCG_TPM2_r1p59_Part3_Commands_pub.pdf), and section 19.6.3 of [part 1 of the same spec](https://trustedcomputinggroup.org/wp-content/uploads/TCG_TPM2_r1p59_Part1_Architecture_pub.pdf) for more information regarding session nonces. ### For more information If you have any questions or comments about this advisory: * Open an issue or discussion in [our repo](https://github.com/parallaxsecond/rust-tss-esapi) * Get in touch on [our Slack channel](https://github.com/parallaxsecond/community#community-channel)

GHSA-w3vw-ccc5-qr8v Affected Use After Free in Context Versions

2 component(s)
Fixed Versions:
7.1.06.1.2
Product / Package Ecosystem Affected Versions Fixed Version
tss-esapi
crates.io
≥ 7.0.0
< 7.1.0
7.1.0
tss-esapi
crates.io
< 6.1.2
6.1.2

References

Frequently Asked Questions

What is GHSA-w3vw-ccc5-qr8v?
GHSA-w3vw-ccc5-qr8v is a security vulnerability in Use After Free in Context involving :start_auth_session under General Security Weakness.
Which Use After Free in Context versions are affected?
Affected versions include releases prior to 7.1.0, 6.1.2 across affected packages: tss-esapi.
What version fixes GHSA-w3vw-ccc5-qr8v?
Upgrading to 7.1.0, 6.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tss-esapi affected?
Yes, tss-esapi is affected in releases prior to 7.1.0, 6.1.2. Upgrade your dependency to 7.1.0, 6.1.2 or later.
What CWE is associated with GHSA-w3vw-ccc5-qr8v?
GHSA-w3vw-ccc5-qr8v is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-w3vw-ccc5-qr8v?
Run the dependency tree command: 'inspect dependencies for tss-esapi'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w3vw-ccc5-qr8v",
  "modified" : "2022-06-17T01:17:41Z",
  "published" : "2022-06-17T01:17:41Z",
  "aliases" : [ ],
  "summary" : "Use After Free in Context::start_auth_session",
  "details" : "### Impact\n\n**This issue only applies to applications starting authorization sessions using an explicit initial `nonce`.**\n\nWhen [`Context::start_auth_session`](https://docs.rs/tss-esapi/7.0.1/tss_esapi/struct.Context.html#method.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.\n\nLogs indicating a failure due to this issue (with the 1.61.0 version of the Rust toolchain) look as follows:\n```\n2022-05-24T01:04:41.9131341Z WARNING:esys:src/tss2-esys/api/Esys_StartAuthSession.c:390:Esys_StartAuthSession_Finish() Received TPM Error \n2022-05-24T01:04:41.9132192Z ERROR:esys:src/tss2-esys/api/Esys_StartAuthSession.c:136:Esys_StartAuthSession() Esys Finish ErrorCode (0x000001d5) \n2022-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)\n2022-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\n```\n\n### Patches\nThe issue has been patched in versions 6 and 7 of the `tss-esapi` crate. Please update to `7.1.0` or `6.1.2`.\n\n### Workarounds\nThere is no workaround that achieves the same functionality.\n\n### References\nFor more information on the cause of the issue and the fix, see [this](https://github.com/parallaxsecond/rust-tss-esapi/pull/344) PR.\n\nFor more details about the `TPM2_StartAuthSession` command see section 11.1 of [the TPM spec, part 3](https://trustedcomputinggroup.org/wp-content/uploads/TCG_TPM2_r1p59_Part3_Commands_pub.pdf), and section 19.6.3 of [part 1 of the same spec](https://trustedcomputinggroup.org/wp-content/uploads/TCG_TPM2_r1p59_Part1_Architecture_pub.pdf) for more information regarding session nonces.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue or discussion in [our repo](https://github.com/parallaxsecond/rust-tss-esapi)\n* Get in touch on [our Slack channel](https://github.com/parallaxsecond/community#community-channel)\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tss-esapi"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.1.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tss-esapi"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.1.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/parallaxsecond/rust-tss-esapi/security/advisories/GHSA-w3vw-ccc5-qr8v"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/parallaxsecond/rust-tss-esapi"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T01:17:41Z",
    "nvd_published_at" : null
  }
}