# GHSA-hg58-rf2h-6rr7: CometBFT is unstability during blocksync when syncing from malicious peer

> A malicious peer can cause CometBFT nodes to panic or get stuck during blocksync, resulting in a denial of service.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 28 Jun 2024
- **Also known as:** GO-2024-2951

## What is GHSA-hg58-rf2h-6rr7?

GHSA-hg58-rf2h-6rr7 is a denial of service vulnerability in github.com/cometbft/cometbft, published on 28 Jun 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

**Name**: ASA-2024-008: Instability during blocksync when syncing from malicious peer
**Component**: CometBFT
**Criticality**: Medium ([ACMv1](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md): I:Moderate; L: Possible)
**Affected versions**: < v0.38.7 

# Summary

An issue was identified for nodes syncing on an existing network during blocksync in which a malicious peer could cause the syncing peer to panic, enter into a catastrophic invalid syncing state or get stuck in blocksync mode, never switching to consensus. It is recommended for all clients to adopt this patch so that blocksync functions as expected and is tolerant of malicious peers presenting invalid data in this situation. Nodes that are vulnerable to this state may experience a Denial of Service condition in which syncing will not work as expected when joining a network as a client.

# Recognition

This issue was reported to the Cosmos Bug Bounty Program on HackerOne on 5/01/24 by unknown_feature. If you believe you have found a bug in the Interchain Stack or would like to contribute to the program by reporting a bug, please see https://hackerone.com/cosmos.

If you have questions about Interchain security efforts, please reach out to our official communication channel at [security@interchain.io](mailto:security@interchain.io).

For more information about CometBFT, please see https://docs.cometbft.com/.

For more information about the Interchain Foundation’s engagement with Amulet, please see https://github.com/interchainio/security.

## Which versions are affected by GHSA-hg58-rf2h-6rr7?

5 open source packages ship an affected version, including github.com/cometbft/cometbft.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/cometbft/cometbft` | Go | From 0.37.0 | 0.37.7, 0.38.8 |
| `github.com/cometbft/cometbft` | Go | From 0.37.0 | 0.37.7 |
| `github.com/cometbft/cometbft` | Go | From 0.37.0 | 0.37.7 |
| `github.com/cometbft/cometbft` | Go | From 0.38.0 | 0.38.8 |
| `github.com/cometbft/cometbft` | Go | From 0.38.0 | 0.38.8 |

## How do I fix GHSA-hg58-rf2h-6rr7?

Upgrade github.com/cometbft/cometbft to a fixed version for your release line: 0.37.7 or 0.38.8.

## Is GHSA-hg58-rf2h-6rr7 being exploited?

There is no known exploitation of GHSA-hg58-rf2h-6rr7 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-hg58-rf2h-6rr7 and fix it if it is affected.

What it is: GHSA-hg58-rf2h-6rr7 is a denial of service vulnerability in github.com/cometbft/cometbft, published on 28 Jun 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-hg58-rf2h-6rr7 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/cometbft/cometbft (Go): affected from 0.37.0; fixed in 0.37.7, 0.38.8
- github.com/cometbft/cometbft (Go): affected from 0.37.0; fixed in 0.37.7
- github.com/cometbft/cometbft (Go): affected from 0.37.0; fixed in 0.37.7
- github.com/cometbft/cometbft (Go): affected from 0.38.0; fixed in 0.38.8
- github.com/cometbft/cometbft (Go): affected from 0.38.0; fixed in 0.38.8

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-hg58-rf2h-6rr7/ (Markdown: https://insights.sbomify.com/GHSA-hg58-rf2h-6rr7/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-hg58-rf2h-6rr7

---
From sbomify Insights: https://insights.sbomify.com/GHSA-hg58-rf2h-6rr7/
Summaries are generated and may contain mistakes; the official description above is the record.
