CVE-2025-30204: Github.com/golang jwt/jwt/v5 Jwt-go Allows Excessive Memory Allocation Vulnerability

HIGH
Advisory Identifier: GHSA-mh63-6h87-95cp
CVSS 7.5
CWE-405
Published
Advisory Summary

CVE-2025-30204 is a HIGH (CVSS 7.5) jwt-go allows excessive memory allocation vulnerability (CWE-405: Asymmetric Resource Consumption (Amplification)) affecting Github.com/golang jwt/jwt/v5 libraries in the Go ecosystem. The issue involves jwt-go allows excessive memory allocation during header parsing. Remediation is available by upgrading affected packages to version 5.2.2, 4.5.2.

CVE-2025-30204 at a Glance

CVE Identifier CVE-2025-30204
GHSA Identifier GHSA-mh63-6h87-95cp
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-405: Asymmetric Resource Consumption (Amplification)
Affected Product Github.com/golang jwt/jwt/v5
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2025-30204

To remediate this vulnerability, upgrade all affected Github.com/golang jwt/jwt/v5 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/golang-jwt/jwt/v5 fixed: 5.2.2
Upgrade github.com/golang-jwt/jwt/v5 to 5.2.2
github.com/golang-jwt/jwt/v4 fixed: 4.5.2
Upgrade github.com/golang-jwt/jwt/v4 to 4.5.2
github.com/golang-jwt/jwt fixed: Latest secure release
Upgrade github.com/golang-jwt/jwt to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/golang-jwt/jwt/v5

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-30204, inspect your project dependencies for Github.com/golang jwt/jwt/v5:

inspect dependencies for github.com/golang-jwt/jwt/v5

Analyze the terminal output to locate any version of Github.com/golang jwt/jwt/v5 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.2.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-405: Asymmetric Resource Consumption (Amplification), where the product does not properly control situations in which an adversary can cause the product to consume or produce excessive resources without requiring the adversary to invest equivalent work or otherwise prove authorization, i.e., the adversary's influence is "asymmetric.". In Github.com/golang jwt/jwt/v5, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Function [`parse.ParseUnverified`](https://github.com/golang-jwt/jwt/blob/c035977d9e11c351f4c05dfeae193923cbab49ee/parser.go#L138-L139) currently splits (via a call to [strings.Split](https://pkg.go.dev/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)](https://cwe.mitre.org/data/definitions/405.html) ### Details See [`parse.ParseUnverified`](https://github.com/golang-jwt/jwt/blob/c035977d9e11c351f4c05dfeae193923cbab49ee/parser.go#L138-L139) ### Impact Excessive memory allocation

CVE-2025-30204 Affected Github.com/golang jwt/jwt/v5 Versions

3 component(s)
Fixed Versions:
5.2.24.5.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/golang-jwt/jwt/v5
Go
≥ 5.0.0-rc.1
< 5.2.2
5.2.2
github.com/golang-jwt/jwt/v4
Go
< 4.5.2
4.5.2
github.com/golang-jwt/jwt
Go
≥ 3.2.0
≤ 3.2.2

References

Frequently Asked Questions

What is CVE-2025-30204?
CVE-2025-30204 is a security vulnerability in Github.com/golang jwt/jwt/v5 involving jwt-go allows excessive memory allocation during header parsing under CWE-405: Asymmetric Resource Consumption (Amplification).
Which Github.com/golang jwt/jwt/v5 versions are affected?
Affected versions include releases prior to 5.2.2, 4.5.2 across affected packages: github.com/golang-jwt/jwt/v5, github.com/golang-jwt/jwt/v4, github.com/golang-jwt/jwt.
What version fixes CVE-2025-30204?
Upgrading to 5.2.2, 4.5.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/golang-jwt/jwt/v5 affected?
Yes, github.com/golang-jwt/jwt/v5 is affected in releases prior to 5.2.2. Upgrade your dependency to 5.2.2 or later.
Is github.com/golang-jwt/jwt/v4 affected?
Yes, github.com/golang-jwt/jwt/v4 is affected in releases prior to 4.5.2. Upgrade your dependency to 4.5.2 or later.
What is the CVSS score of CVE-2025-30204?
CVE-2025-30204 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2025-30204?
CVE-2025-30204 is classified under CWE-405: Asymmetric Resource Consumption (Amplification) (The product does not properly control situations in which an adversary can cause the product to consume or produce excessive resources without requiring the adversary to invest equivalent work or otherwise prove authorization, i.e., the adversary's influence is "asymmetric.").
How can I check Go dependencies for CVE-2025-30204?
Run the dependency tree command: 'inspect dependencies for github.com/golang-jwt/jwt/v5'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-mh63-6h87-95cp",
  "modified" : "2025-04-10T13:02:34Z",
  "published" : "2025-03-21T22:04:00Z",
  "aliases" : [ "CVE-2025-30204" ],
  "summary" : "jwt-go allows excessive memory allocation during header parsing",
  "details" : "### Summary\n\nFunction [`parse.ParseUnverified`](https://github.com/golang-jwt/jwt/blob/c035977d9e11c351f4c05dfeae193923cbab49ee/parser.go#L138-L139) currently splits (via a call to [strings.Split](https://pkg.go.dev/strings#Split)) its argument (which is untrusted data) on periods.\n\nAs 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)](https://cwe.mitre.org/data/definitions/405.html)\n\n### Details\n\nSee [`parse.ParseUnverified`](https://github.com/golang-jwt/jwt/blob/c035977d9e11c351f4c05dfeae193923cbab49ee/parser.go#L138-L139) \n\n### Impact\n\nExcessive memory allocation",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/golang-jwt/jwt/v5"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0-rc.1"
      }, {
        "fixed" : "5.2.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/golang-jwt/jwt/v4"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.5.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/golang-jwt/jwt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.2.0"
      }, {
        "last_affected" : "3.2.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/golang-jwt/jwt/security/advisories/GHSA-mh63-6h87-95cp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-30204"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/golang-jwt/jwt/commit/0951d184286dece21f73c85673fd308786ffe9c3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/golang-jwt/jwt/commit/bf316c48137a1212f8d0af9288cc9ce8e59f1afb"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/golang-jwt/jwt"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20250404-0002"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-405" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-21T22:04:00Z",
    "nvd_published_at" : "2025-03-21T22:15:26Z"
  }
}