# CVE-2025-24371: Malicious peer can make node stuck in blocksync in github.com/cometbft/cometbft

> A malicious peer can cause a syncing node to hang indefinitely by reporting inconsistent block heights, leading to denial of service.

- **Severity:** High 7.1 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 3 Feb 2025
- **Updated:** 4 Feb 2025
- **Also known as:** GHSA-22qq-3xwm-r5x4, GO-2025-3442

## What is CVE-2025-24371?

CVE-2025-24371 is a high-severity denial of service vulnerability in cometbft, published on 3 Feb 2025. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

CometBFT is a distributed, Byzantine fault-tolerant, deterministic state machine replication engine. In the `blocksync` protocol peers send their `base` and `latest` heights when they connect to a new node (`A`), which is syncing to the tip of a network. `base` acts as a lower ground and informs `A` that the peer only has blocks starting from height `base`. `latest` height informs `A` about the latest block in a network. Normally, nodes would only report increasing heights. If `B` fails to provide the latest block, `B` is removed and the `latest` height (target height) is recalculated based on other nodes `latest` heights. The existing code however doesn't check for the case where `B` first reports `latest` height `X` and immediately after height `Y`, where `X > Y`. `A` will be trying to catch up to 2000 indefinitely. This condition requires the introduction of malicious code in the full node first reporting some non-existing `latest` height, then reporting lower `latest` height and nodes which are syncing using `blocksync` protocol. This issue has been patched in versions 1.0.1 and 0.38.17 and all users are advised to upgrade. Operators may attempt to ban malicious peers from the network as a workaround.

Weakness: CWE-703 (Improper Check or Handling of Exceptional Conditions)

## Which versions are affected by CVE-2025-24371?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/cometbft/cometbft` | Go | All versions | 0.38.17 |
| `github.com/cometbft/cometbft` | Go | All versions | 0.38.17 |
| `github.com/cometbft/cometbft` | Go | All versions | 0.38.17 |
| `github.com/cometbft/cometbft` | Go | All versions | 1.0.1 |
| `github.com/cometbft/cometbft` | Go | From 1.0.0-alpha.1 | 1.0.1 |
| `github.com/cometbft/cometbft` | Go | From 1.0.0-alpha.1 | 1.0.1 |

## How do I fix CVE-2025-24371?

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

## Is CVE-2025-24371 being exploited?

There is no known exploitation of CVE-2025-24371 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-24371 and fix it if it is affected.

What it is: CVE-2025-24371 is a high-severity denial of service vulnerability in cometbft, published on 3 Feb 2025. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-24371 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/cometbft/cometbft (Go): affected all versions; fixed in 0.38.17
- github.com/cometbft/cometbft (Go): affected all versions; fixed in 0.38.17
- github.com/cometbft/cometbft (Go): affected all versions; fixed in 0.38.17
- github.com/cometbft/cometbft (Go): affected all versions; fixed in 1.0.1
- github.com/cometbft/cometbft (Go): affected from 1.0.0-alpha.1; fixed in 1.0.1
- github.com/cometbft/cometbft (Go): affected from 1.0.0-alpha.1; fixed in 1.0.1

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/CVE-2025-24371/ (Markdown: https://insights.sbomify.com/CVE-2025-24371/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-24371
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-24371
- OSV: https://osv.dev/vulnerability/CVE-2025-24371

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-24371/
Summaries are generated and may contain mistakes; the official description above is the record.
