CVE-2025-27144
Description
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. In versions on the 4.x branch prior to version 4.0.5, when parsing compact JWS or JWE input, Go JOSE could use excessive memory. The code used strings.Split(token, ".") to split JWT tokens, which is vulnerable to excessive memory consumption when processing maliciously crafted tokens with a large number of . characters. An attacker could exploit this by sending numerous malformed tokens, leading to memory exhaustion and a Denial of Service. Version 4.0.5 fixes this issue. As a workaround, applications could pre-validate that payloads passed to Go JOSE do not contain an excessive number of . characters.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
github.com/go-jose/go-jose/v4Go | < 4.0.5 | 4.0.5 |
github.com/go-jose/go-jose/v3Go | < 3.0.4 | 3.0.4 |
github.com/go-jose/go-joseGo | < 3.0.4 | 3.0.4 |
Patches
199b346cec4e8Don't allow unbounded amounts of splits (#167)
3 files changed · +9 −4
jwe.go+3 −2 modified@@ -288,10 +288,11 @@ func ParseEncryptedCompact( keyAlgorithms []KeyAlgorithm, contentEncryption []ContentEncryption, ) (*JSONWebEncryption, error) { - parts := strings.Split(input, ".") - if len(parts) != 5 { + // Five parts is four separators + if strings.Count(input, ".") != 4 { return nil, fmt.Errorf("go-jose/go-jose: compact JWE format must have five parts") } + parts := strings.SplitN(input, ".", 5) rawProtected, err := base64.RawURLEncoding.DecodeString(parts[0]) if err != nil {
jws.go+3 −2 modified@@ -327,10 +327,11 @@ func parseSignedCompact( payload []byte, signatureAlgorithms []SignatureAlgorithm, ) (*JSONWebSignature, error) { - parts := strings.Split(input, ".") - if len(parts) != 3 { + // Three parts is two separators + if strings.Count(input, ".") != 2 { return nil, fmt.Errorf("go-jose/go-jose: compact JWS format must have three parts") } + parts := strings.SplitN(input, ".", 3) if parts[1] != "" && payload != nil { return nil, fmt.Errorf("go-jose/go-jose: payload is not detached")
jws_test.go+3 −0 modified@@ -119,6 +119,9 @@ func TestCompactParseJWS(t *testing.T) { "////.eyJhbGciOiJYWVoifQ.c2lnbmF0dXJl", // Invalid header "cGF5bG9hZA.cGF5bG9hZA.c2lnbmF0dXJl", + // Too many parts + "eyJhbGciOiJYWVoifQ.cGF5bG9hZA.c2lnbmF0dXJl.....................................................", + "eyJhbGciOiJYWVoifQ.cGF5bG9hZA.c2lnbmF0dXJl.cGF5bG9hZA.cGF5bG9hZA.cGF5bG9hZA....................", } for i := range failures {
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
7- github.com/advisories/GHSA-c6gw-w398-hv78ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-27144ghsaADVISORY
- github.com/go-jose/go-jose/commit/99b346cec4e86d102284642c5dcbe9bb0cacfc22nvdWEB
- github.com/go-jose/go-jose/releases/tag/v4.0.5nvdWEB
- github.com/go-jose/go-jose/security/advisories/GHSA-c6gw-w398-hv78nvdWEB
- github.com/golang/go/issues/71490ghsaWEB
- go.dev/issue/71490ghsaWEB
News mentions
0No linked articles in our index yet.