# GHSA-gwj5-wp6r-5q9f: Cronos vulnerable to DoS through unintended Contract Selfdestruct

> An attacker can cause denial of service for smart contracts sharing identical bytecode by triggering a selfdestruct on one contract, affecting all instances.

- **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:** 11 Aug 2022
- **Also known as:** GO-2022-0829

## What is GHSA-gwj5-wp6r-5q9f?

GHSA-gwj5-wp6r-5q9f is a denial of service vulnerability in github.com/crypto-org-chain/cronos, published on 11 Aug 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In Cronos nodes running versions before v0.7.0, the contract selfdestruct invocation permanently removes the corresponding bytecode from the internal database storage. However, due to a bug in Ethermint, all contracts that used the identical bytecode (i.e shared the same CodeHash) will also stop working once one contract invokes selfdestruct, even though the other contracts did not invoke the selfdestruct OPCODE. Thanks to the successfully coordinated security vulnerability disclosure, no smart contracts were impacted through the use of this vulnerability. Smart contract states and storage values are not affected by this vulnerability. This problem has been patched in Cronos v0.8.0. The patch has state machine-breaking changes and the required coordinated network upgrade was done on the block height 3982500 on the Cronos mainnet beta network. If a contract is subject to DoS due to this issue, the user can redeploy the same contract, i.e with identical bytecode, so that the original contract's code is recovered.

## Which versions are affected by GHSA-gwj5-wp6r-5q9f?

3 open source packages ship an affected version, including github.com/crypto-org-chain/cronos.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/crypto-org-chain/cronos` | Go | All versions | 0.8.0 |
| `github.com/crypto-org-chain/cronos` | Go | All versions | 0.8.0 |
| `github.com/crypto-org-chain/cronos` | Go | All versions | 0.8.0 |

## How do I fix GHSA-gwj5-wp6r-5q9f?

Upgrade github.com/crypto-org-chain/cronos to 0.8.0 or later.

## Is GHSA-gwj5-wp6r-5q9f being exploited?

There is no known exploitation of GHSA-gwj5-wp6r-5q9f in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-gwj5-wp6r-5q9f and fix it if it is affected.

What it is: GHSA-gwj5-wp6r-5q9f is a denial of service vulnerability in github.com/crypto-org-chain/cronos, published on 11 Aug 2022. 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-gwj5-wp6r-5q9f in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/crypto-org-chain/cronos (Go): affected all versions; fixed in 0.8.0
- github.com/crypto-org-chain/cronos (Go): affected all versions; fixed in 0.8.0
- github.com/crypto-org-chain/cronos (Go): affected all versions; fixed in 0.8.0

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-gwj5-wp6r-5q9f/ (Markdown: https://insights.sbomify.com/GHSA-gwj5-wp6r-5q9f/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-gwj5-wp6r-5q9f

---
From sbomify Insights: https://insights.sbomify.com/GHSA-gwj5-wp6r-5q9f/
Summaries are generated and may contain mistakes; the official description above is the record.
