GHSA-hrhf-2vcr-ghch: Github.com/cometbft/cometbft CometBFT's Invalid BitArray Handling Can Vulnerability

HIGH
CWE-228
Published
Advisory Summary

GHSA-hrhf-2vcr-ghch is a HIGH cometbft's invalid bitarray handling can vulnerability (CWE-228: Improper Handling of Syntactically Invalid Structure) affecting Github.com/cometbft/cometbft libraries in the Go ecosystem. The issue involves cometbft's invalid bitarray handling can lead to network halt. Remediation is available by upgrading affected packages to version 0.37.16, 0.38.19.

GHSA-hrhf-2vcr-ghch at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-hrhf-2vcr-ghch
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-228: Improper Handling of Syntactically Invalid Structure
Affected Product Github.com/cometbft/cometbft
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-hrhf-2vcr-ghch

To remediate this vulnerability, upgrade all affected Github.com/cometbft/cometbft 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/cometbft/cometbft fixed: 0.37.16
Upgrade github.com/cometbft/cometbft to 0.37.16
github.com/cometbft/cometbft fixed: 0.38.19
Upgrade github.com/cometbft/cometbft to 0.38.19
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/cometbft/cometbft

How to Check if You Are Affected

To determine whether your application is affected by GHSA-hrhf-2vcr-ghch, inspect your project dependencies for Github.com/cometbft/cometbft:

inspect dependencies for github.com/cometbft/cometbft

Analyze the terminal output to locate any version of Github.com/cometbft/cometbft in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.37.16), 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-228: Improper Handling of Syntactically Invalid Structure, where the product does not handle or incorrectly handles input that is not syntactically well-formed with respect to the associated specification. In Github.com/cometbft/cometbft, 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

Name: ASA-2025-003: Invalid BitArray handling can lead to network halt Criticality: High (Considerable Impact; Possible Likelihood per [ACMv1.2](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md)) Affected versions: `<= v0.38.18`, `<= v0.37.15`, and `main` development branches Affected users: Validators, Full nodes, Users ### Description A bug was discovered in CometBFT's handling of `BitArray`'s that have a mismatch between the `BitArray`'s expected number of `Elems` for the specified number of `Bits`. Additional validation was added to prevent processing `BitArray`'s in this invalid state, as well as guards to prevent panics on `BitArray` methods if one of these invalid states is processed. ### Impact `BitArray`'s are present in a number of messages received from peers. When handling these messages, insufficient validation was applied to prevent processing messages the aforementioned invalid state. In the worst case, nodes will gossip messages to peers in an invalid state before processing them themselves, leading to a network halt (instead of only the node receiving the malicious message crashing). ### Patches The new CometBFT releases [v0.38.19](https://github.com/cometbft/cometbft/releases/tag/v0.38.19) and [v0.37.16](https://github.com/cometbft/cometbft/releases/tag/v0.37.16) fix this issue. Unreleased code in the main branch is patched as well. ### Workarounds If a node is able to identify a malicious peer sending these payloads, they can ban the ip address using common tools like `iptables`. ### Timeline * October 3, 2025, 11:26am EST: Issue reported to Cosmos Labs via an external team (via their Bug Bounty Program). * October 3, 2025, 11:59am EST: Issue triaged by core team and core team completes validation of issue. * October 6, 2025, 11:14pm EST: Issue reported to the Cosmos Bug Bounty Program (by original white hat reporter). * October 9, 2025, 11:15am EST: Pre-notification delivered. * October 10, 2025, 11:37am EST: Core team completes patch for the issue. * October 14, 2025, 11:00am EST: Patch made available. This issue was reported by @whoismxuse to the Cosmos Bug Bounty Program on HackerOne on October 6, 2025. If you believe you have found a bug in the Cosmos Stack or would like to contribute to the program by reporting a bug, please see https://hackerone.com/cosmos. If there are questions about Cosmos security efforts, please reach out to our official communication channel at [security@cosmoslabs.io](mailto:security@cosmoslabs.io). A Github Security Advisory for this issue is available in the CometBFT [repository](https://github.com/cometbft/cometbft/security/advisories/GHSA-hrhf-2vcr-ghch). For more information about CometBFT, see https://docs.cometbft.com/.

GHSA-hrhf-2vcr-ghch Affected Github.com/cometbft/cometbft Versions

2 component(s)
Fixed Versions:
0.37.160.38.19
Product / Package Ecosystem Affected Versions Fixed Version
github.com/cometbft/cometbft
Go
< 0.37.16
0.37.16
github.com/cometbft/cometbft
Go
≥ 0.38.0-alpha.1
< 0.38.19
0.38.19

References

Frequently Asked Questions

What is GHSA-hrhf-2vcr-ghch?
GHSA-hrhf-2vcr-ghch is a security vulnerability in Github.com/cometbft/cometbft involving CometBFT's invalid BitArray handling can lead to network halt under CWE-228: Improper Handling of Syntactically Invalid Structure.
Which Github.com/cometbft/cometbft versions are affected?
Affected versions include releases prior to 0.37.16, 0.38.19 across affected packages: github.com/cometbft/cometbft.
What version fixes GHSA-hrhf-2vcr-ghch?
Upgrading to 0.37.16, 0.38.19 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/cometbft/cometbft affected?
Yes, github.com/cometbft/cometbft is affected in releases prior to 0.37.16, 0.38.19. Upgrade your dependency to 0.37.16, 0.38.19 or later.
What CWE is associated with GHSA-hrhf-2vcr-ghch?
GHSA-hrhf-2vcr-ghch is classified under CWE-228: Improper Handling of Syntactically Invalid Structure (The product does not handle or incorrectly handles input that is not syntactically well-formed with respect to the associated specification.).
How can I check Go dependencies for GHSA-hrhf-2vcr-ghch?
Run the dependency tree command: 'inspect dependencies for github.com/cometbft/cometbft'. 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-hrhf-2vcr-ghch",
  "modified" : "2025-11-18T18:37:25Z",
  "published" : "2025-10-14T19:57:30Z",
  "aliases" : [ ],
  "summary" : "CometBFT's invalid BitArray handling can lead to network halt",
  "details" : "Name: ASA-2025-003: Invalid BitArray handling can lead to network halt\nCriticality: High (Considerable Impact; Possible Likelihood per [ACMv1.2](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md))\nAffected versions: `<= v0.38.18`, `<= v0.37.15`, and `main` development branches\nAffected users: Validators, Full nodes, Users\n\n### Description\n\nA bug was discovered in CometBFT's handling of `BitArray`'s that have a mismatch between the `BitArray`'s expected number of `Elems` for the specified number of `Bits`. Additional validation was added to prevent processing `BitArray`'s in this invalid state, as well as guards to prevent panics on `BitArray` methods if one of these invalid states is processed.\n\n### Impact\n`BitArray`'s are present in a number of messages received from peers. When handling these messages, insufficient validation was applied to prevent processing messages the aforementioned invalid state. In the worst case, nodes will gossip messages to peers in an invalid state before processing them themselves, leading to a network halt (instead of only the node receiving the malicious message crashing). \n\n### Patches\n\nThe new CometBFT releases [v0.38.19](https://github.com/cometbft/cometbft/releases/tag/v0.38.19) and [v0.37.16](https://github.com/cometbft/cometbft/releases/tag/v0.37.16) fix this issue.\n\nUnreleased code in the main branch is patched as well.\n\n### Workarounds\n\nIf a node is able to identify a malicious peer sending these payloads, they can ban the ip address using common tools like `iptables`.\n\n### Timeline\n\n* October 3, 2025, 11:26am EST: Issue reported to Cosmos Labs via an external team (via their Bug Bounty Program).\n* October 3, 2025, 11:59am EST: Issue triaged by core team and core team completes validation of issue.\n* October 6, 2025, 11:14pm EST: Issue reported to the Cosmos Bug Bounty Program (by original white hat reporter).\n* October 9, 2025, 11:15am EST: Pre-notification delivered.\n* October 10, 2025, 11:37am EST: Core team completes patch for the issue.\n* October 14, 2025, 11:00am EST: Patch made available.\n\nThis issue was reported by @whoismxuse to the Cosmos Bug Bounty Program on HackerOne on October 6, 2025. If you believe you have found a bug in the Cosmos Stack or would like to contribute to the program by reporting a bug, please see https://hackerone.com/cosmos.\n\nIf there are questions about Cosmos security efforts, please reach out to our official communication channel at [security@cosmoslabs.io](mailto:security@cosmoslabs.io).\n\nA Github Security Advisory for this issue is available in the CometBFT [repository](https://github.com/cometbft/cometbft/security/advisories/GHSA-hrhf-2vcr-ghch). For more information about CometBFT, see https://docs.cometbft.com/.",
  "severity" : [ {
    "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/cometbft/cometbft"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.37.16"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.37.15"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cometbft/cometbft"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.38.0-alpha.1"
      }, {
        "fixed" : "0.38.19"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.38.18"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cometbft/cometbft/security/advisories/GHSA-hrhf-2vcr-ghch"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cometbft/cometbft/commit/be5677c3e58f998b7f67bb6186dd2c9b81a041a1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cometbft/cometbft/commit/dcb1f265b59477be40804f7ccdc4fb30612d6a4f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cometbft/cometbft"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cometbft/cometbft/releases/tag/v0.37.16"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cometbft/cometbft/releases/tag/v0.38.19"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-228" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-10-14T19:57:30Z",
    "nvd_published_at" : null
  }
}