# CVE-2023-49290: Malicious parameters can cause a denial of service in lestrrat-go/jwx

> An attacker can cause a denial of service in the lestrrat-go/jwx library by setting an excessively high p2c parameter in JWE headers.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 4 Dec 2023
- **Updated:** 29 May 2025
- **Also known as:** GHSA-7f9x-gw85-8grf, GO-2023-2379, MINI-2v42-w5h3-9jwf, MINI-528m-5c78-877j, MINI-8xvj-jv4h-j35x, MINI-fxcj-487f-82g9, MINI-jcp8-gc4v-x3fw, MINI-mjwv-7236-7xjj, MINI-mx5f-8qq3-8qvc, MINI-q6gf-xg3w-xp36, MINI-r3jh-6mpr-47rv, MINI-vq49-3w87-26vh, MINI-vvwv-qf49-458w, MINI-x45p-c9v5-h8x7

## What is CVE-2023-49290?

CVE-2023-49290 is a medium-severity denial of service vulnerability in lestrrat-go jwx, published on 4 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

lestrrat-go/jwx is a Go module implementing various JWx (JWA/JWE/JWK/JWS/JWT, otherwise known as JOSE) technologies. A p2c parameter set too high in JWE's algorithm PBES2-* could lead to a denial of service. The JWE key management algorithms based on PBKDF2 require a JOSE Header Parameter called p2c (PBES2 Count). This parameter dictates the number of PBKDF2 iterations needed to derive a CEK wrapping key. Its primary purpose is to intentionally slow down the key derivation function, making password brute-force and dictionary attacks more resource- intensive. Therefore, if an attacker sets the p2c parameter in JWE to a very large number, it can cause a lot of computational consumption, resulting in a denial of service. This vulnerability has been addressed in commit `64f2a229b` which has been included in release version 1.2.27 and 2.0.18. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-400 (Uncontrolled Resource Consumption)

## Which versions are affected by CVE-2023-49290?

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.27 |
| `github.com/lestrrat-go/jwx` | Go | All versions | 1.2.27 |
| `github.com/lestrrat-go/jwx` | Go | All versions | 1.2.27 |
| `github.com/lestrrat-go/jwx/v2` | Go | All versions | 2.0.18 |
| `github.com/lestrrat-go/jwx/v2` | Go | All versions | 2.0.18 |
| `github.com/lestrrat-go/jwx/v2` | Go | All versions | 2.0.18 |

Products: Lestrrat-Go Jwx.

## How do I fix CVE-2023-49290?

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

## Is CVE-2023-49290 being exploited?

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

## Other vulnerabilities in lestrrat-go jwx

- [CVE-2024-28122](https://insights.sbomify.com/CVE-2024-28122/): JWX vulnerable to a denial of service attack using compressed JWE message (medium 6.8)
- [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-2023-49290 and fix it if it is affected.

What it is: CVE-2023-49290 is a medium-severity denial of service vulnerability in lestrrat-go jwx, published on 4 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-49290 exists.

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

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

## Sources

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

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