---
id: "GHSA-h2v8-394m-p7vv"
kind: "vulnerability"
aliases: ["GHSA-h2v8-394m-p7vv"]
title: "Rustls: Brotli certificate decompression can allocate an attacker-controlled amount of memory up to 1 GiB before authentication."
severity: "low"
cvss: 3.7
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-770", "package", "rust", "rustls", "self-hosted"]
not_affected_if: ["brotli-feature-disabled", "default-config"]
published_at: "2026-10-27T16:08:36+00:00"
first_seen_at: "2026-10-27T16:10:07+00:00"
updated_at: "2026-10-27T16:10:58+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-h2v8-394m-p7vv", "first_seen_at": "2026-10-27T16:10:07+00:00"}]
---

# Rustls: Brotli certificate decompression can allocate an attacker-controlled amount of memory up to 1 GiB before authentication.

When the optional Brotli feature is enabled, a peer can send a compressed certificate whose header requests a 1 GiB decompression window, forcing a large allocation before any authentication. An attacker can make the process abort or run out of memory, a denial of service.

_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

- Check whether the `brotli` feature of rustls is enabled in `Cargo.toml` or in the lockfile feature set (`cargo tree -e features -i rustls`).
- Check the rustls version in `Cargo.lock` with `cargo tree -i rustls`, comparing against `0.23.46` and `0.24.0-dev.2`.

## Fix

- Upgrade rustls to `0.23.46` or later on the 0.23 line, or to `0.24.0-dev.2` or later on the 0.24 development line.
- Alternatively, leave the `brotli` feature disabled, since it is off by default.

## Timeline

- 2026-10-27T16:10:07+00:00 ghsa https://github.com/advisories/GHSA-h2v8-394m-p7vv

## From the sources

### Summary

The built-in (but disabled by default) Brotli certificate decoder bounds the output buffer but accepts an input-selected history window. A header of five bytes can specify a 1 GiB window allocation. A peer can abort a process whose allocator cannot satisfy that request. A client must enable Brotli and connect to the peer; a server must enable Brotli and request a client certificate. Neither direction requires a trusted attacker certificate.

### Details

rustls calls `BrotliDecompress` which enables Brotli's large-window extension. rustls applies a limit to certificates, but this applies to the decompressed result, and not to any internal allocations the process requires.

### Impact

Client applications that enable the `brotli` feature will be vulnerable to malicious servers. Server applications that enable the `brotli` feature and enable client authentication will be vulnerable to malicious clients.

Potential for denial of service due to memory exhaustion from peers sending malicious Brotli-encoded certificates, for applications that enable Brotli decompression.

### 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_
