Vulnerabilites related to golang-jwt - jwt
cve-2025-30204
Vulnerability from cvelistv5
Published
2025-03-21 21:42
Modified
2025-04-04 23:03
Severity ?
EPSS score ?
Summary
golang-jwt is a Go implementation of JSON Web Tokens. Prior to
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.
References
▼ | URL | Tags |
---|---|---|
https://github.com/golang-jwt/jwt/security/advisories/GHSA-mh63-6h87-95cp | x_refsource_CONFIRM | |
https://github.com/golang-jwt/jwt/commit/0951d184286dece21f73c85673fd308786ffe9c3 | x_refsource_MISC |
Impacted products
Vendor | Product | Version | ||
---|---|---|---|---|
golang-jwt | jwt |
Version: < 4.5.2 Version: >= 5.0.0-rc.1, < 5.2.2 |
{ containers: { adp: [ { metrics: [ { other: { content: { id: "CVE-2025-30204", options: [ { Exploitation: "none", }, { Automatable: "yes", }, { "Technical Impact": "partial", }, ], role: "CISA Coordinator", timestamp: "2025-03-24T14:10:18.281694Z", version: "2.0.3", }, type: "ssvc", }, }, ], providerMetadata: { dateUpdated: "2025-03-24T14:10:35.776Z", orgId: "134c704f-9b21-4f2e-91b3-4a467353bcc0", shortName: "CISA-ADP", }, title: "CISA ADP Vulnrichment", }, { providerMetadata: { dateUpdated: "2025-04-04T23:03:13.309Z", orgId: "af854a3a-2127-422b-91ae-364da2661108", shortName: "CVE", }, references: [ { url: "https://security.netapp.com/advisory/ntap-20250404-0002/", }, ], title: "CVE Program Container", }, ], cna: { affected: [ { product: "jwt", vendor: "golang-jwt", versions: [ { status: "affected", version: "< 4.5.2", }, { status: "affected", version: ">= 5.0.0-rc.1, < 5.2.2", }, ], }, ], descriptions: [ { lang: "en", value: "golang-jwt is a Go implementation of JSON Web Tokens. Prior to \n5.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.", }, ], metrics: [ { cvssV3_1: { attackComplexity: "LOW", attackVector: "NETWORK", availabilityImpact: "HIGH", baseScore: 7.5, baseSeverity: "HIGH", confidentialityImpact: "NONE", integrityImpact: "NONE", privilegesRequired: "NONE", scope: "UNCHANGED", userInteraction: "NONE", vectorString: "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", version: "3.1", }, }, ], problemTypes: [ { descriptions: [ { cweId: "CWE-405", description: "CWE-405: Asymmetric Resource Consumption (Amplification)", lang: "en", type: "CWE", }, ], }, ], providerMetadata: { dateUpdated: "2025-03-21T21:42:01.382Z", orgId: "a0819718-46f1-4df5-94e2-005712e83aaa", shortName: "GitHub_M", }, references: [ { name: "https://github.com/golang-jwt/jwt/security/advisories/GHSA-mh63-6h87-95cp", tags: [ "x_refsource_CONFIRM", ], url: "https://github.com/golang-jwt/jwt/security/advisories/GHSA-mh63-6h87-95cp", }, { name: "https://github.com/golang-jwt/jwt/commit/0951d184286dece21f73c85673fd308786ffe9c3", tags: [ "x_refsource_MISC", ], url: "https://github.com/golang-jwt/jwt/commit/0951d184286dece21f73c85673fd308786ffe9c3", }, ], source: { advisory: "GHSA-mh63-6h87-95cp", discovery: "UNKNOWN", }, title: "jwt-go allows excessive memory allocation during header parsing", }, }, cveMetadata: { assignerOrgId: "a0819718-46f1-4df5-94e2-005712e83aaa", assignerShortName: "GitHub_M", cveId: "CVE-2025-30204", datePublished: "2025-03-21T21:42:01.382Z", dateReserved: "2025-03-18T18:15:13.849Z", dateUpdated: "2025-04-04T23:03:13.309Z", state: "PUBLISHED", }, dataType: "CVE_RECORD", dataVersion: "5.1", }
cve-2024-51744
Vulnerability from cvelistv5
Published
2024-11-04 21:47
Modified
2024-11-05 16:11
Severity ?
EPSS score ?
Summary
golang-jwt is a Go implementation of JSON Web Tokens. Unclear documentation of the error behavior in `ParseWithClaims` can lead to situation where users are potentially not checking errors in the way they should be. Especially, if a token is both expired and invalid, the errors returned by `ParseWithClaims` return both error codes. If users only check for the `jwt.ErrTokenExpired ` using `error.Is`, they will ignore the embedded `jwt.ErrTokenSignatureInvalid` and thus potentially accept invalid tokens. A fix has been back-ported with the error handling logic from the `v5` branch to the `v4` branch. In this logic, the `ParseWithClaims` function will immediately return in "dangerous" situations (e.g., an invalid signature), limiting the combined errors only to situations where the signature is valid, but further validation failed (e.g., if the signature is valid, but is expired AND has the wrong audience). This fix is part of the 4.5.1 release. We are aware that this changes the behaviour of an established function and is not 100 % backwards compatible, so updating to 4.5.1 might break your code. In case you cannot update to 4.5.0, please make sure that you are properly checking for all errors ("dangerous" ones first), so that you are not running in the case detailed above.
References
▼ | URL | Tags |
---|---|---|
https://github.com/golang-jwt/jwt/security/advisories/GHSA-29wx-vh33-7x7r | x_refsource_CONFIRM | |
https://github.com/golang-jwt/jwt/commit/7b1c1c00a171c6c79bbdb40e4ce7d197060c1c2c | x_refsource_MISC |
Impacted products
Vendor | Product | Version | ||
---|---|---|---|---|
golang-jwt | jwt |
Version: < 4.5.1 |
{ containers: { adp: [ { metrics: [ { other: { content: { id: "CVE-2024-51744", options: [ { Exploitation: "none", }, { Automatable: "no", }, { "Technical Impact": "partial", }, ], role: "CISA Coordinator", timestamp: "2024-11-05T16:11:29.522504Z", version: "2.0.3", }, type: "ssvc", }, }, ], providerMetadata: { dateUpdated: "2024-11-05T16:11:42.243Z", orgId: "134c704f-9b21-4f2e-91b3-4a467353bcc0", shortName: "CISA-ADP", }, title: "CISA ADP Vulnrichment", }, ], cna: { affected: [ { product: "jwt", vendor: "golang-jwt", versions: [ { status: "affected", version: "< 4.5.1", }, ], }, ], descriptions: [ { lang: "en", value: "golang-jwt is a Go implementation of JSON Web Tokens. Unclear documentation of the error behavior in `ParseWithClaims` can lead to situation where users are potentially not checking errors in the way they should be. Especially, if a token is both expired and invalid, the errors returned by `ParseWithClaims` return both error codes. If users only check for the `jwt.ErrTokenExpired ` using `error.Is`, they will ignore the embedded `jwt.ErrTokenSignatureInvalid` and thus potentially accept invalid tokens. A fix has been back-ported with the error handling logic from the `v5` branch to the `v4` branch. In this logic, the `ParseWithClaims` function will immediately return in \"dangerous\" situations (e.g., an invalid signature), limiting the combined errors only to situations where the signature is valid, but further validation failed (e.g., if the signature is valid, but is expired AND has the wrong audience). This fix is part of the 4.5.1 release. We are aware that this changes the behaviour of an established function and is not 100 % backwards compatible, so updating to 4.5.1 might break your code. In case you cannot update to 4.5.0, please make sure that you are properly checking for all errors (\"dangerous\" ones first), so that you are not running in the case detailed above.", }, ], metrics: [ { cvssV3_1: { attackComplexity: "HIGH", attackVector: "NETWORK", availabilityImpact: "NONE", baseScore: 3.1, baseSeverity: "LOW", confidentialityImpact: "LOW", integrityImpact: "NONE", privilegesRequired: "NONE", scope: "UNCHANGED", userInteraction: "REQUIRED", vectorString: "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N", version: "3.1", }, }, ], problemTypes: [ { descriptions: [ { cweId: "CWE-755", description: "CWE-755: Improper Handling of Exceptional Conditions", lang: "en", type: "CWE", }, ], }, ], providerMetadata: { dateUpdated: "2024-11-04T21:47:12.170Z", orgId: "a0819718-46f1-4df5-94e2-005712e83aaa", shortName: "GitHub_M", }, references: [ { name: "https://github.com/golang-jwt/jwt/security/advisories/GHSA-29wx-vh33-7x7r", tags: [ "x_refsource_CONFIRM", ], url: "https://github.com/golang-jwt/jwt/security/advisories/GHSA-29wx-vh33-7x7r", }, { name: "https://github.com/golang-jwt/jwt/commit/7b1c1c00a171c6c79bbdb40e4ce7d197060c1c2c", tags: [ "x_refsource_MISC", ], url: "https://github.com/golang-jwt/jwt/commit/7b1c1c00a171c6c79bbdb40e4ce7d197060c1c2c", }, ], source: { advisory: "GHSA-29wx-vh33-7x7r", discovery: "UNKNOWN", }, title: "Bad documentation of error handling in ParseWithClaims can lead to potentially dangerous situations in golang-jwt", }, }, cveMetadata: { assignerOrgId: "a0819718-46f1-4df5-94e2-005712e83aaa", assignerShortName: "GitHub_M", cveId: "CVE-2024-51744", datePublished: "2024-11-04T21:47:12.170Z", dateReserved: "2024-10-31T14:12:45.789Z", dateUpdated: "2024-11-05T16:11:42.243Z", state: "PUBLISHED", }, dataType: "CVE_RECORD", dataVersion: "5.1", }