# CVE-2023-22745: Buffer Overlow in TSS2_RC_Decode in tpm2-tss

> A buffer overflow in tpm2-tss allows local attackers with TPM access to execute arbitrary code via crafted response codes.

- **Severity:** Medium 6.4 (`CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 19 Jan 2023
- **Updated:** 21 Nov 2025
- **Also known as:** ALSA-2023:6685, ALSA-2023:7166, AZL-13055, AZL-69129, BELL-CVE-2023-22745, CLSA-2025-1760021057, DEBIAN-CVE-2023-22745, GHSA-4j3v-fh23-vx67, MGASA-2023-0050, OESA-2023-1079, RHSA-2023:6685, RHSA-2023:7166, RHSA-2024:4408, RHSA-2024:4739, SUSE-SU-2023:0526-1, SUSE-SU-2023:0613-1, UBUNTU-CVE-2023-22745, openSUSE-SU-2024:12629-1

## What is CVE-2023-22745?

CVE-2023-22745 is a medium-severity memory corruption vulnerability in tpm2-software tpm2-tss, published on 19 Jan 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

tpm2-tss is an open source software implementation of the Trusted Computing Group (TCG) Trusted Platform Module (TPM) 2 Software Stack (TSS2). In versions prior to 4.1.0-rc0, 4.0.1, and 3.2.2-rc1, `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. This Buffer overrun, could result in arbitrary code execution. An example attack would be a MiTM bus attack that returns 0xFFFFFFFF for the RC. Given the common use case of TPM modules an attacker must have local access to the target machine with local system privileges which allows access to the TPM system. Usually TPM access requires administrative privilege. Versions 4.1.0-rc0, 4.0.1, and 3.2.2-rc1 fix the issue.

Weakness: CWE-120 (Buffer Copy without Checking Size of Input)

## Which versions are affected by CVE-2023-22745?

It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `tpm2-tss` | AlmaLinux:8 | All versions | 2.3.2-5.el8 |
| `tpm2-tss-devel` | AlmaLinux:8 | All versions | 2.3.2-5.el8 |
| `tpm2-tss` | AlmaLinux:9 | All versions | 3.2.2-2.el9 |
| `tpm2-tss-devel` | AlmaLinux:9 | All versions | 3.2.2-2.el9 |
| `tpm2-tss` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.2-5.el8 |
| `tpm2-tss-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.2-5.el8 |
| `tpm2-tss-debugsource` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.2-5.el8 |
| `tpm2-tss-devel` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.2-5.el8 |
| `tpm2-tss` | Red Hat:enterprise_linux:9::baseos | All versions | 0:3.2.2-2.el9 |
| `tpm2-tss-debuginfo` | Red Hat:enterprise_linux:9::baseos | All versions | 0:3.2.2-2.el9 |
| `tpm2-tss-debugsource` | Red Hat:enterprise_linux:9::baseos | All versions | 0:3.2.2-2.el9 |
| `tpm2-tss-debuginfo` | Red Hat:enterprise_linux:9::crb | All versions | 0:3.2.2-2.el9 |
| `tpm2-tss-debugsource` | Red Hat:enterprise_linux:9::crb | All versions | 0:3.2.2-2.el9 |
| `tpm2-tss-devel` | Red Hat:enterprise_linux:9::crb | All versions | 0:3.2.2-2.el9 |
| `tpm2-tss` | Red Hat:rhel_aus:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss-debuginfo` | Red Hat:rhel_aus:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss-debugsource` | Red Hat:rhel_aus:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss-devel` | Red Hat:rhel_aus:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss` | Red Hat:rhel_e4s:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss-debuginfo` | Red Hat:rhel_e4s:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss-debugsource` | Red Hat:rhel_e4s:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss-devel` | Red Hat:rhel_e4s:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss` | Red Hat:rhel_eus:8.8::baseos | All versions | 0:2.3.2-5.el8_8 |
| `tpm2-tss-debuginfo` | Red Hat:rhel_eus:8.8::baseos | All versions | 0:2.3.2-5.el8_8 |
| `tpm2-tss-debugsource` | Red Hat:rhel_eus:8.8::baseos | All versions | 0:2.3.2-5.el8_8 |
| `tpm2-tss-devel` | Red Hat:rhel_eus:8.8::baseos | All versions | 0:2.3.2-5.el8_8 |
| `tpm2-tss` | Red Hat:rhel_tus:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss-debuginfo` | Red Hat:rhel_tus:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss-debugsource` | Red Hat:rhel_tus:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-tss-devel` | Red Hat:rhel_tus:8.6::baseos | All versions | 0:2.3.2-5.el8_6 |
| `tpm2-0-tss` | SUSE:Linux Enterprise Micro 5.3 | All versions | 3.1.0-150400.3.3.1 |
| `tpm2-0-tss` | SUSE:Linux Enterprise Module for Basesystem 15 SP4 | All versions | 3.1.0-150400.3.3.1 |
| `tpm2-0-tss` | SUSE:Linux Enterprise Real Time 15 SP3 | All versions | 2.4.5-150300.3.6.1 |
| `tpm2-0-tss` | openSUSE:Leap 15.4 | All versions | 2.4.5-150300.3.6.1 |
| `tpm2-0-tss` | openSUSE:Leap 15.4 | All versions | 3.1.0-150400.3.3.1 |
| `tpm2-0-tss` | openSUSE:Leap Micro 5.3 | All versions | 3.1.0-150400.3.3.1 |

Products: Tpm2 Software Stack Project Tpm2 Software Stack.

## How do I fix CVE-2023-22745?

Upgrade to a fixed version.

## Is CVE-2023-22745 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-22745 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-22745 and fix it if it is affected.

What it is: CVE-2023-22745 is a medium-severity memory corruption vulnerability in tpm2-software tpm2-tss, published on 19 Jan 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-22745 exists.

Affected product: tpm2-software tpm2-tss. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-22745/ (Markdown: https://insights.sbomify.com/CVE-2023-22745/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-22745
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-22745
- OSV: https://osv.dev/vulnerability/CVE-2023-22745

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-22745/
Summaries are generated and may contain mistakes; the official description above is the record.
