Skip to content

Buffer Overlow in TSS2_RC_Decode

Low
williamcroberts published GHSA-4j3v-fh23-vx67 Jan 19, 2023

Package

tpm2-tss (Linux Distros)

Affected versions

<= 4.0.0

Patched versions

TBD

Description

Report

Reported by fergus-dall: https://github.com/fergus-dall

Tss2_RC_SetHandler and Tss2_RC_Decode both index into layer_handler with an 8 bit layer number, but the array only has TPM2_ERROR_TSS2_RC_LAYER_COUNT entries, so trying to add a handler for higher-numbered layers or decode a response code with such a layer number reads/writes past the end of the buffer. For example, on my system this program segfaults:

#include <stdio.h>
#include "tss2/tss2_rc.h"

int main() {
    printf("%s\n", Tss2_RC_Decode(0xffffffff));
}

Impact

Buffer overrun, could result in arbitrary code execution. An example attack would be a MiTM bus attack that returns 0xFFFFFFFF for the RC.

Patches

in progress.

Workarounds

No

References

No

Severity

Low

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:N

CVE ID

CVE-2023-22745

Weaknesses

No CWEs