# CVE-2021-41153: Specification non-compliance in JUMPI

> Incorrect JUMPI opcode execution order in the evm crate causes consensus divergence on Ethereum mainnet, requiring an immediate library upgrade.

- **Severity:** High 8.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 18 Oct 2021
- **Updated:** 4 Aug 2024
- **Also known as:** GHSA-pvh2-pj76-4m96

## What is CVE-2021-41153?

CVE-2021-41153 is a high-severity vulnerability in rust-blockchain evm, published on 18 Oct 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The evm crate is a pure Rust implementation of Ethereum Virtual Machine. In `evm` crate `< 0.31.0`, `JUMPI` opcode's condition is checked after the destination validity check. However, according to Geth and OpenEthereum, the condition check should happen before the destination validity check. This is a **high** severity security advisory if you use `evm` crate for Ethereum mainnet. In this case, you should update your library dependency immediately to on or after `0.31.0`. This is a **low** severity security advisory if you use `evm` crate in Frontier or in a standalone blockchain, because there's no security exploit possible with this advisory. It is **not** recommended to update to on or after `0.31.0` until all the normal chain upgrade preparations have been done. If you use Frontier or other `pallet-evm` based Substrate blockchain, please ensure to update your `spec_version` before updating this. For other blockchains, please make sure to follow a hard-fork process before you update this.

Weakness: CWE-670 (Always-Incorrect Control Flow Implementation)

## Which versions are affected by CVE-2021-41153?

2 open source packages ship an affected version, including evm. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `evm` | crates.io | All versions | 0.31.0 |
| `evm` | crates.io | All versions | 0.31.0 |

Products: Evm Project Evm.

## How do I fix CVE-2021-41153?

Upgrade evm to 0.31.0 or later.

## Is CVE-2021-41153 being exploited?

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

## Other vulnerabilities in rust-blockchain evm

- [CVE-2021-29511](https://insights.sbomify.com/CVE-2021-29511/): Memory over-allocation in evm crate (medium 6.5)
- [CVE-2024-21629](https://insights.sbomify.com/CVE-2024-21629/): Erroneous handling of `record_external_operation` error return (medium 5.9)
- [CVE-2022-39354](https://insights.sbomify.com/CVE-2022-39354/): evm has incorrect is_static parameter for custom stateful precompiles (medium 5.9)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-41153 and fix it if it is affected.

What it is: CVE-2021-41153 is a high-severity vulnerability in rust-blockchain evm, published on 18 Oct 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2021-41153 in the wild and no public exploit code.

Affected packages and fixed versions:
- evm (crates.io): affected all versions; fixed in 0.31.0
- evm (crates.io): affected all versions; fixed in 0.31.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/CVE-2021-41153/ (Markdown: https://insights.sbomify.com/CVE-2021-41153/index.md)
```

## Sources

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

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