CVE-2026-34986: Go JOSE Panics in JWE decryption
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 encryptedkey field is empty. The panic happens when cipher.KeyUnwrap() in keywrap.go attempts to allocate a slice with a zero or negative length based on the length of the encryptedkey.
Published Apr 3, 2026 · Updated Apr 6, 2026
Affected packages
github.com/go-jose/go-jose/v4
- Ecosystem
- Go
- Affected
- < 4.1.4
- Fixed in
- 4.1.4
- Check
go list -m github.com/go-jose/go-jose/v4
github.com/go-jose/go-jose/v3
- Ecosystem
- Go
- Affected
- < 3.0.5
- Fixed in
- 3.0.5
- Check
go list -m github.com/go-jose/go-jose/v3
github.com/go-jose/go-jose
- Ecosystem
- Go
- Affected
- <= 2.6.3
- Fixed in
- No patched version yet
- Check
go list -m github.com/go-jose/go-jose
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-116585
Go JOSE: Panic during CBC-HMAC processing
medium6.9No fixOct 28, 2026CVE-2026-116586
Go JOSE: Panics in JSON parsing
medium6.9No fixOct 28, 2026CVE-2026-116587
Go JOSE: DoS when parsing JWKs that contain RSA keys
high7.5No fixOct 27, 2026CVE-2025-27144
DoS in go-jose Parsing
medium6.9Feb 24, 2025CVE-2024-28180
Go JOSE vulnerable to Improper Handling of Highly Compressed Data (Data Amplification)
medium4.3No fixMar 7, 2024
