Advisory

GHSA-78h2-9frx-2jm8

Also known as: CVE-2026-34986, GO-2026-4945

Summary

Go JOSE Panics in JWE decryption

Details

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.

Severity

High Basis: The source's own band: HIGH

Dates

Published
2026-04-03 03:28 UTC
Modified
2026-09-10 03:50 UTC

Affected packages and fixes

github.com/go-jose/go-jose/v4

Go · All systems

Affected

  • introduced 0, fixed 4.1.4 (semver)

Fixed versions

4.1.4

Fix

github.com/go-jose/go-jose/v3

Go · All systems

Affected

  • introduced 0, fixed 3.0.5 (semver)

Fixed versions

3.0.5

Fix

github.com/go-jose/go-jose

Go · All systems

Affected

  • introduced 0, last affected 2.6.3 (semver)

Fixed versions

None listed

Fix

No fixed version is listed.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences