# CVE-2024-28122: JWX vulnerable to a denial of service attack using compressed JWE message

> An attacker can cause a denial of service in the JWX Go library by sending a maliciously compressed JWE token, requiring an upgrade to patched versions.

- **Severity:** Medium 6.8 (`CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 9 Mar 2024
- **Updated:** 16 Apr 2025
- **Also known as:** GHSA-hj3v-m684-v259, GO-2024-2632, MINI-2268-jc36-p9mc, MINI-44w4-g8rh-fch5, MINI-7cqx-pcq2-4wr4, MINI-ffmj-967w-w75h, MINI-fmxx-8r4m-478w, MINI-fr37-7963-x5mv, MINI-gwj6-46cm-p6r9, MINI-j4w4-xj42-89q6, MINI-mfxq-q9ph-xxxr, MINI-mgxh-6v3c-chj4, MINI-v9j9-w3cg-fj22, MINI-xmwq-2q99-9rv9

## What is CVE-2024-28122?

CVE-2024-28122 is a medium-severity denial of service vulnerability in lestrrat-go jwx, published on 9 Mar 2024. An attacker needs administrator access to exploit it, with no action from the victim.

### Official description

JWX is Go module implementing various JWx (JWA/JWE/JWK/JWS/JWT, otherwise known as JOSE) technologies. This vulnerability allows an attacker with a trusted public key to cause a Denial-of-Service (DoS) condition by crafting a malicious JSON Web Encryption (JWE) token with an exceptionally high compression ratio. This issue has been patched in versions 1.2.29 and 2.0.21.

Weakness: CWE-400 (Uncontrolled Resource Consumption)

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

6 open source packages ship an affected version, including github.com/lestrrat-go/jwx and github.com/lestrrat-go/jwx/v2. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/lestrrat-go/jwx` | Go | All versions | 1.2.29 |
| `github.com/lestrrat-go/jwx` | Go | All versions | 1.2.29 |
| `github.com/lestrrat-go/jwx` | Go | All versions | 1.2.29 |
| `github.com/lestrrat-go/jwx/v2` | Go | All versions | 2.0.21 |
| `github.com/lestrrat-go/jwx/v2` | Go | All versions | 2.0.21 |
| `github.com/lestrrat-go/jwx/v2` | Go | All versions | 2.0.21 |

Products: Lestrrat-Go Jwx.

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

Upgrade github.com/lestrrat-go/jwx to 1.2.29 or later.

## Is CVE-2024-28122 being exploited?

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

## Other vulnerabilities in lestrrat-go jwx

- [CVE-2023-49290](https://insights.sbomify.com/CVE-2023-49290/): Malicious parameters can cause a denial of service in lestrrat-go/jwx (medium 5.3)
- [CVE-2024-21664](https://insights.sbomify.com/CVE-2024-21664/): Parsing JSON serialized payload without protected field can lead to segfault (medium 4.3)

## Fix prompt for AI coding agents

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

What it is: CVE-2024-28122 is a medium-severity denial of service vulnerability in lestrrat-go jwx, published on 9 Mar 2024. An attacker needs administrator access to exploit it, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-28122 exists.

Affected packages and fixed versions:
- github.com/lestrrat-go/jwx (Go): affected all versions; fixed in 1.2.29
- github.com/lestrrat-go/jwx (Go): affected all versions; fixed in 1.2.29
- github.com/lestrrat-go/jwx (Go): affected all versions; fixed in 1.2.29
- github.com/lestrrat-go/jwx/v2 (Go): affected all versions; fixed in 2.0.21
- github.com/lestrrat-go/jwx/v2 (Go): affected all versions; fixed in 2.0.21
- github.com/lestrrat-go/jwx/v2 (Go): affected all versions; fixed in 2.0.21

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

## Sources

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

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