# GHSA-w7hm-hmxv-pvhf: HPACK decoder panics on invalid input

> An attacker can cause a denial of service by sending malformed HPACK data that triggers a panic in the decoder.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 15 Sep 2023
- **Also known as:** RUSTSEC-2023-0085

## What is GHSA-w7hm-hmxv-pvhf?

GHSA-w7hm-hmxv-pvhf is a denial of service vulnerability in hpack, published on 15 Sep 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Due to insufficient checking of input data, decoding certain data sequences can
lead to _Decoder::decode_ panicking rather than returning an error.

Example code that triggers this vulnerability looks like this:

```rust
use hpack::Decoder;

pub fn main() {
  let input = &[0x3f];
  let mut decoder = Decoder::new();
  let _ = decoder.decode(input);
}
```

hpack is unmaintained. A crate with the panics fixed has been published as
[hpack-patched](https://crates.io/crates/hpack-patched).

Also consider using
[loona-hpack](https://crates.io/crates/loona-hpack) or
[httlib-huffman](https://crates.io/crates/httlib-huffman) as an alternative.

Version 0.3.1 of
[fluke-hpack](https://crates.io/crates/fluke-hpack) still reproduces the panic
described in this advisory.

## Which versions are affected by GHSA-w7hm-hmxv-pvhf?

3 open source packages ship an affected version, including hpack.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `hpack` | crates.io | All versions to 0.3.0 | None |
| `hpack` | crates.io | All versions to 0.3.0 | None |
| `hpack` | crates.io | From 0.0.0-0 | None |

## How do I fix GHSA-w7hm-hmxv-pvhf?

No fix has been published for GHSA-w7hm-hmxv-pvhf yet. Limit exposure of the affected software until one is available.

## Is GHSA-w7hm-hmxv-pvhf being exploited?

There is no known exploitation of GHSA-w7hm-hmxv-pvhf in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-w7hm-hmxv-pvhf and fix it if it is affected.

What it is: GHSA-w7hm-hmxv-pvhf is a denial of service vulnerability in hpack, published on 15 Sep 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-w7hm-hmxv-pvhf in the wild and no public exploit code.

Affected packages and fixed versions:
- hpack (crates.io): affected all versions up to 0.3.0; no fix listed
- hpack (crates.io): affected all versions up to 0.3.0; no fix listed
- hpack (crates.io): affected from 0.0.0-0; no fix listed

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/GHSA-w7hm-hmxv-pvhf/ (Markdown: https://insights.sbomify.com/GHSA-w7hm-hmxv-pvhf/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-w7hm-hmxv-pvhf

---
From sbomify Insights: https://insights.sbomify.com/GHSA-w7hm-hmxv-pvhf/
Summaries are generated and may contain mistakes; the official description above is the record.
