# GHSA-v6rw-hhgg-wc4x: Evmos vulnerable to DOS and transaction fee expropiation through Authz exploit

> Attackers can halt the Evmos blockchain by executing infinite-loop smart contracts via nested transactions, requiring an upgrade to patched versions.

- **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:** 17 Apr 2024
- **Also known as:** GO-2024-2732

## What is GHSA-v6rw-hhgg-wc4x?

GHSA-v6rw-hhgg-wc4x is a denial of service vulnerability in github.com/evmos/evmos, published on 17 Apr 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

## Impact
_What kind of vulnerability is it? Who is impacted?_

An attacker can use this bug to bypass the block gas limit and gas payment completely to perform a full Denial-of-Service against the chain.

## Disclosure

Evmos versions below `v11.0.1` do not check for `MsgEthereumTx` messages that are nested under other messages. This allows a malicious actor to perform EVM transactions that do not meet the checks performed under `newEthAnteHandler`. This opens the possibility for the DOS of validators and consequently halt the chain through an infinite EVM execution.

### Additional details

The attack scenario is as follows:

1. The attacker deploys a simple smart contract with an infinite loop to the chain.  
2. The attacker calls the smart contract using an embedded transaction with an extremely high gas value (`uint64` max or similar). 
3. Once the transaction is included in a block, nodes will try to execute the EVM transaction with almost infinite gas and get stuck. **This stops new block creation and effectively halts the chain, requiring a manual restart of all nodes.**

## Users Impacted
All Evmos users are impacted by this vulnerability as it has the potential to halt the chain. Users' funds and chain state are safe but when under attack, the chain could be deemed unusable. 

## Patches

_Has the problem been patched? What versions should users upgrade to?_

The vulnerability has been patched on Evmos versions ≥v12.0.0.

### Details

As a temporary workaround, the fix blocks `MsgEthereumTxs` messages from being sent under the `authz` module's `MsgExec` message. It also covers the scenario in which `MsgEthereumTx` are deeply nested by:

- Doing a recursive check over the nested messages of `MsgExec`
- Limiting the amount of possible nested messages (inner messages) in `MsgExec`

This is done by adding an additional `AnteHandler` decorator (`AuthzLimiterDecorator`) for Cosmos and EIP-712 transactions.

This is a state machine-breaking change as it restricts previously allowed messages and thus requires a hard-fork upgrade.

## References
__Are there any links users can visit to find out more?__

### For more information
If you have any questions or comments about this advisory:

- Reach out to the Core Team in [Discord](https://discord.gg/evmos)
- Open a discussion in [evmos/evmos](https://github.com/evmos/evmos/discussions)
- Email us at [security@evmos.org](mailto:security@evmos.org) for security questions
- For Press, email us at [evmos@west-comms.com](mailto:evmos@west-comms.com).

## Which versions are affected by GHSA-v6rw-hhgg-wc4x?

14 open source packages ship an affected version, including github.com/evmos/evmos/v11, github.com/evmos/evmos and github.com/evmos/evmos/v10.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/evmos/evmos/v11` | Go | All versions | None |
| `github.com/evmos/evmos/v11` | Go | All versions | 12.0.0 |
| `github.com/evmos/evmos/v11` | Go | All versions | 12.0.0 |
| `github.com/evmos/evmos` | Go | All versions | None |
| `github.com/evmos/evmos/v10` | Go | All versions | None |
| `github.com/evmos/evmos/v12` | Go | All versions | 12.0.0 |
| `github.com/evmos/evmos/v2` | Go | All versions | None |
| `github.com/evmos/evmos/v3` | Go | All versions | None |
| `github.com/evmos/evmos/v4` | Go | All versions | None |
| `github.com/evmos/evmos/v5` | Go | All versions | None |
| `github.com/evmos/evmos/v6` | Go | All versions | None |
| `github.com/evmos/evmos/v7` | Go | All versions | None |
| `github.com/evmos/evmos/v8` | Go | All versions | None |
| `github.com/evmos/evmos/v9` | Go | All versions | None |

## How do I fix GHSA-v6rw-hhgg-wc4x?

Upgrade github.com/evmos/evmos/v11 to 12.0.0 or later.

## Is GHSA-v6rw-hhgg-wc4x being exploited?

There is no known exploitation of GHSA-v6rw-hhgg-wc4x in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-v6rw-hhgg-wc4x and fix it if it is affected.

What it is: GHSA-v6rw-hhgg-wc4x is a denial of service vulnerability in github.com/evmos/evmos, published on 17 Apr 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-v6rw-hhgg-wc4x in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/evmos/evmos/v11 (Go): affected all versions; no fix listed
- github.com/evmos/evmos/v11 (Go): affected all versions; fixed in 12.0.0
- github.com/evmos/evmos/v11 (Go): affected all versions; fixed in 12.0.0
- github.com/evmos/evmos (Go): affected all versions; no fix listed
- github.com/evmos/evmos/v10 (Go): affected all versions; no fix listed
- github.com/evmos/evmos/v12 (Go): affected all versions; fixed in 12.0.0
- github.com/evmos/evmos/v2 (Go): affected all versions; no fix listed
- github.com/evmos/evmos/v3 (Go): affected all versions; no fix listed
- github.com/evmos/evmos/v4 (Go): affected all versions; no fix listed
- github.com/evmos/evmos/v5 (Go): affected all versions; no fix listed
- github.com/evmos/evmos/v6 (Go): affected all versions; no fix listed
- github.com/evmos/evmos/v7 (Go): affected all versions; no fix listed

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-v6rw-hhgg-wc4x/ (Markdown: https://insights.sbomify.com/GHSA-v6rw-hhgg-wc4x/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-v6rw-hhgg-wc4x

---
From sbomify Insights: https://insights.sbomify.com/GHSA-v6rw-hhgg-wc4x/
Summaries are generated and may contain mistakes; the official description above is the record.
