Skip to content

GHSA-78h2-9frx-2jm8 CVE-2026-34986 GO-2026-4945

Go JOSE Panics in JWE decryption

High Go
Severity
7.5 / 10
High · CVSS 3.1
Exploit chance (EPSS)
0.65%
Chance of exploitation in the next 30 days. Higher than 51.21% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-248 Uncaught Exception
Fix
Available
2 packages have a fixed version

Description

Impact

Decrypting a JSON Web Encryption (JWE) object will panic if the alg field indicates a key wrapping algorithm (one ending in KW, with the exception of A128GCMKW, A192GCMKW, and A256GCMKW) and the encrypted_key field is empty. The panic happens when cipher.KeyUnwrap() in key_wrap.go attempts to allocate a slice with a zero or negative length based on the length of the encrypted_key.

This code path is reachable from ParseEncrypted() / ParseEncryptedJSON() / ParseEncryptedCompact() followed by Decrypt() on the resulting object. Note that the parse functions take a list of accepted key algorithms. If the accepted key algorithms do not include any key wrapping algorithms, parsing will fail and the application will be unaffected.

This panic is also reachable by calling cipher.KeyUnwrap() directly with any ciphertext parameter less than 16 bytes long, but calling this function directly is less common.

Panics can lead to denial of service.

Fixed In

4.1.4 and v3.0.5

Workarounds

If the list of keyAlgorithms passed to ParseEncrypted() / ParseEncryptedJSON() / ParseEncryptedCompact() does not include key wrapping algorithms (those ending in KW), your application is unaffected.

If your application uses key wrapping, you can prevalidate to the JWE objects to ensure the encrypted_key field is nonempty. If your application accepts JWE Compact Serialization, apply that validation to the corresponding field of that serialization (the data between the first and second .).

Thanks

Thanks to Datadog's Security team for finding this issue.

Affected versions

Go

PackageVulnerableFixed in
github.com/go-jose/go-jose
<= 2.6.3
No fix yet
github.com/go-jose/go-jose
<= 2.6.3
No fix yet
github.com/go-jose/go-jose/v3
< 3.0.5
3.0.5
github.com/go-jose/go-jose/v3
< 3.0.5
3.0.5
github.com/go-jose/go-jose/v4
< 4.1.4
4.1.4
github.com/go-jose/go-jose/v4
< 4.1.4
4.1.4

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

github.com/go-jose/go-jose/v3 Go → 3.0.5

go
go get github.com/go-jose/go-jose/v3@v3.0.5 && go mod tidy

github.com/go-jose/go-jose/v4 Go → 4.1.4

go
go get github.com/go-jose/go-jose/v4@v4.1.4 && go mod tidy

Severity breakdown

CVSS 3.1 7.5

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Weakness

CWE-248: Uncaught Exception

An exception is thrown from a function, but it is not caught.

References

Advisories

Packages

Other links

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-mgcc-cww5-fp2q
Go JOSE: DoS when parsing JWKs that contain RSA keys
High Also affects github.com/go-jose/go-jose/v3
GHSA-vvm8-gf78-28g4
Go JOSE: Panics in JSON parsing
Medium Also affects github.com/go-jose/go-jose/v3
GHSA-4w3g-jfj2-cw2q
Go JOSE: Panic during CBC-HMAC processing
Medium Also affects github.com/go-jose/go-jose/v3
GHSA-c6gw-w398-hv78
DoS in go-jose Parsing
Medium Also affects github.com/go-jose/go-jose
GHSA-c5q2-7r4c-mv6g
Go JOSE vulnerable to Improper Handling of Highly Compressed Data (Data Amplification)
Medium Also affects github.com/go-jose/go-jose/v3
GHSA-8hrf-8g6f-7xwp
Forge: Denial of service in TLS record processing via a record interleaved with a fragmented handshake message
High Same weakness, CWE-248
GHSA-27r3-jxmh-p828
body-parser vulnerable to Denial of Service via trailing bytes after a compressed request body
High Same weakness, CWE-248
GHSA-9pvw-hwfg-92h5
Wasmtime: Panic lowering a host-created component model stream into a guest that expects a different payload type
Medium Same weakness, CWE-248

Credits: Datadog's Security team

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor