CVE-2025-30204
JSON

7.5high

jwt-go allows excessive memory allocation during header parsing

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
0.81% (higher than 58% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-mh63-6h87-95cpGO-2025-3553

Description

golang-jwt is a Go implementation of JSON Web Tokens. Starting in version 3.2.0 and prior to versions 5.2.2 and 4.5.2, the function parse.ParseUnverified splits (via a call to strings.Split) its argument (which is untrusted data) on periods. As a result, in the face of a malicious request whose Authorization header consists of Bearer followed by many period characters, a call to that function incurs allocations to the tune of O(n) bytes (where n stands for the length of the function's argument), with a constant factor of about 16. This issue is fixed in 5.2.2 and 4.5.2.

Affected

Product or packageVersionsReported by
golang-jwt jwt>= 3.2.0, < 4.5.2, >= 5.0.0-rc.1, < 5.2.2CVE List
github.com/golang-jwt/jwt/v5 (Go)from 5.0.0-rc.1 before 5.2.2GitHub Advisory Database, Go Vulnerability Database
github.com/golang-jwt/jwt/v4 (Go)before 4.5.2GitHub Advisory Database, Go Vulnerability Database
github.com/golang-jwt/jwt (Go)from 3.2.0 up to 3.2.2, all versionsGitHub Advisory Database, Go Vulnerability Database

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Classification

CWE-405

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

golang-jwt is a Go implementation of JSON Web Tokens. Starting in version 3.2.0 and prior to versions 5.2.2 and 4.5.2, the function parse.ParseUnverified splits (via a call to strings.Split) its argument (which is untrusted data) on periods. As a result, in the face of a malicious request whose Authorization header consists of Bearer followed by many period characters, a call to that function incurs allocations to the tune of O(n) bytes (where n stands for the length of the function's argument), with a constant factor of about 16. This issue is fixed in 5.2.2 and 4.5.2.

GitHub Advisory Database
Summary

Function parse.ParseUnverified currently splits (via a call to strings.Split) its argument (which is untrusted data) on periods.

As a result, in the face of a malicious request whose Authorization header consists of Bearer followed by many period characters, a call to that function incurs allocations to the tune of O(n) bytes (where n stands for the length of the function's argument), with a constant factor of about 16. Relevant weakness: CWE-405: Asymmetric Resource Consumption (Amplification)

Details

See parse.ParseUnverified

Impact

Excessive memory allocation

Go Vulnerability Database

Excessive memory allocation during header parsing in github.com/golang-jwt/jwt

NVD (es)

golang-jwt es una implementación de Go de tokens web JSON. En versiones anteriores a la 5.2.2 y la 4.5.2, la función parse.ParseUnverified divide (mediante una llamada a strings.Split) su argumento (que contiene datos no confiables) en puntos. Como resultado, ante una solicitud maliciosa cuyo encabezado de autorización consiste en "Bearer" seguido de muchos puntos, una llamada a dicha función genera asignaciones de O(n) bytes (donde n representa la longitud del argumento de la función), con un factor constante de aproximadamente 16. Este problema se solucionó en las versiones 5.2.2 y 4.5.2.

References

Related

Sources

SourceRecordLicence
CVE ListCVE-2025-30204 changed 2025-04-10CVE Terms of Use
GitHub Advisory DatabaseGHSA-mh63-6h87-95cp changed 2026-09-10CC-BY-4.0
Go Vulnerability DatabaseGO-2025-3553 changed 2026-11-23CC-BY-4.0
NVDCVE-2025-30204 changed 2026-06-17Public domain