---
id: "GHSA-c8m5-c952-6cm4"
kind: "vulnerability"
aliases: ["GHSA-c8m5-c952-6cm4"]
title: "Rustls: Session Debug formatting exposes TLS master secrets and resumption PSKs"
severity: "medium"
cvss: 4.0
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "rustls", "fixed": ["0.23.46"], "affected": "< 0.23.46", "ecosystem": "cargo"}, {"name": "rustls", "fixed": ["0.24.0-dev.2"], "affected": ">= 0.24.0-dev.1, < 0.24.0-dev.2", "ecosystem": "cargo"}]
ecosystems: ["cargo"]
tags: ["cargo", "cwe-212", "package", "rust", "rustls"]
not_affected_if: ["default-config", "no-custom-session-store"]
published_at: "2026-10-27T16:08:47+00:00"
first_seen_at: "2026-10-27T16:10:07+00:00"
updated_at: "2026-10-27T16:10:54+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-c8m5-c952-6cm4", "first_seen_at": "2026-10-27T16:10:07+00:00"}]
---

# Rustls: Session Debug formatting exposes TLS master secrets and resumption PSKs

Formatting a Rustls client session value with Debug prints its TLS 1.2 master secret or TLS 1.3 resumption PSK. A custom session store that logs these values can leak keys to anyone who reads the logs.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- cargo:rustls affected < 0.23.46 fixed 0.23.46
- cargo:rustls affected >= 0.24.0-dev.1, < 0.24.0-dev.2 fixed 0.24.0-dev.2

## How to check

- Run `cargo tree -i rustls` and note the resolved version
- Search your code for a custom `ClientSessionStore` implementation that logs or Debug-formats `Tls12ClientSessionValue` or `Tls13ClientSessionValue`

## Fix

- Upgrade rustls to `0.23.46` or later on the 0.23 line
- Upgrade to `0.24.0-dev.2` or later if you use the 0.24 dev line
- Stop logging session store values with Debug until upgraded

## Timeline

- 2026-10-27T16:10:07+00:00 ghsa https://github.com/advisories/GHSA-c8m5-c952-6cm4

## From the sources

### Summary

Formatting a client session value with Debug exposes its TLS 1.2 master secret or TLS 1.3 resumption PSK. A custom session store that logs these values can disclose keys to readers of the logs. Ordinary connection and built-in cache diagnostics remain redacted, and the session-store interface already warns that its values are sensitive.

### Details

Derived formatters traverse the session's secret-bearing fields. This conflicts with the project's explicit [key-material redaction policy](https://github.com/rustls/rustls/blob/99f2358cae2954837dbb866faf6727de75489ab9/SECURITY.md#boundary-public-api).

### Proof of concept

Custom `ClientSessionStore` implementations could leak secret data by using the provided `Tls12ClientSessionValue` or `Tls13ClientSessionValue` in a way that triggers its implementation of the `Debug` trait.

### Impact

Such store implementations could leak the master secret for the TLS connection.

### Acknowledgement
Thanks to OpenAI [OutboundDisclosures@openai.com](mailto:OutboundDisclosures@openai.com) for the disclosure.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
