# GHSA-2c7c-3mj9-8fqh: Decryption of malicious PBES2 JWE objects can consume unbounded system resources

> An attacker can cause denial of service by sending malicious JWE objects with large p2c values to applications using the go-jose library.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Nov 2023
- **Also known as:** GO-2023-2334

## What is GHSA-2c7c-3mj9-8fqh?

GHSA-2c7c-3mj9-8fqh is a denial of service vulnerability in github.com/go-jose/go-jose/v3, published on 21 Nov 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The go-jose package is subject to a "billion hashes attack" causing denial-of-service when decrypting JWE inputs. This occurs when an attacker can provide a PBES2 encrypted JWE blob with a very large p2c value that, when decrypted, produces a denial-of-service.

## Which versions are affected by GHSA-2c7c-3mj9-8fqh?

6 open source packages ship an affected version, including github.com/go-jose/go-jose/v3 and github.com/square/go-jose.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/go-jose/go-jose/v3` | Go | All versions | 3.0.1 |
| `github.com/go-jose/go-jose/v3` | Go | All versions | 3.0.1 |
| `github.com/go-jose/go-jose/v3` | Go | All versions | 3.0.1 |
| `github.com/square/go-jose` | Go | All versions | None |
| `github.com/square/go-jose` | Go | All versions | 2.6.2 |
| `github.com/square/go-jose` | Go | All versions | 2.6.2 |

## How do I fix GHSA-2c7c-3mj9-8fqh?

Upgrade github.com/go-jose/go-jose/v3 to 3.0.1 or later.

## Is GHSA-2c7c-3mj9-8fqh being exploited?

There is no known exploitation of GHSA-2c7c-3mj9-8fqh in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-2c7c-3mj9-8fqh and fix it if it is affected.

What it is: GHSA-2c7c-3mj9-8fqh is a denial of service vulnerability in github.com/go-jose/go-jose/v3, published on 21 Nov 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-2c7c-3mj9-8fqh in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/go-jose/go-jose/v3 (Go): affected all versions; fixed in 3.0.1
- github.com/go-jose/go-jose/v3 (Go): affected all versions; fixed in 3.0.1
- github.com/go-jose/go-jose/v3 (Go): affected all versions; fixed in 3.0.1
- github.com/square/go-jose (Go): affected all versions; no fix listed
- github.com/square/go-jose (Go): affected all versions; fixed in 2.6.2
- github.com/square/go-jose (Go): affected all versions; fixed in 2.6.2

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-2c7c-3mj9-8fqh/ (Markdown: https://insights.sbomify.com/GHSA-2c7c-3mj9-8fqh/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-2c7c-3mj9-8fqh

---
From sbomify Insights: https://insights.sbomify.com/GHSA-2c7c-3mj9-8fqh/
Summaries are generated and may contain mistakes; the official description above is the record.
