# CVE-2024-34353: matrix-sdk-crypto contains a log exposure of private key of the server-side key backup

> An attacker with access to debug logs can read private keys for server-side key backups, compromising encrypted message security.

- **Severity:** Medium 5.5 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 13 May 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-9ggc-845v-gcgv

## What is CVE-2024-34353?

CVE-2024-34353 is a medium-severity vulnerability in matrix-org matrix-sdk-crypto, published on 13 May 2024. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

The matrix-sdk-crypto crate, part of the Matrix Rust SDK project, is an implementation of a Matrix end-to-end encryption state machine in Rust. In Matrix, the server-side `key backup` stores encrypted copies of Matrix message keys. This facilitates key sharing between a user's devices and provides a redundant copy in case all devices are lost. The key backup uses asymmetric
cryptography, with each server-side key backup assigned a unique public-private key pair. Due to a logic bug introduced in commit 71136e44c03c79f80d6d1a2446673bc4d53a2067, matrix-sdk-crypto version 0.7.0 will sometimes log the private part of the backup key pair to Rust debug logs (using the `tracing` crate). This issue has been resolved in matrix-sdk-crypto version 0.7.1. No known workarounds are available.

Weakness: CWE-532 (Insertion of Sensitive Information into Log File)

## Which versions are affected by CVE-2024-34353?

2 open source packages ship an affected version, including matrix-sdk-crypto.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `matrix-sdk-crypto` | crates.io | From 0.7.0 | 0.7.1 |
| `matrix-sdk-crypto` | crates.io | From 0.7.0 | 0.7.1 |

## How do I fix CVE-2024-34353?

Upgrade matrix-sdk-crypto to 0.7.1 or later.

## Is CVE-2024-34353 being exploited?

There is no known exploitation of CVE-2024-34353 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-34353 and fix it if it is affected.

What it is: CVE-2024-34353 is a medium-severity vulnerability in matrix-org matrix-sdk-crypto, published on 13 May 2024. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-34353 in the wild and no public exploit code.

Affected packages and fixed versions:
- matrix-sdk-crypto (crates.io): affected from 0.7.0; fixed in 0.7.1
- matrix-sdk-crypto (crates.io): affected from 0.7.0; fixed in 0.7.1

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-2024-34353/ (Markdown: https://insights.sbomify.com/CVE-2024-34353/index.md)
```

## Sources

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

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