# CVE-2022-39354: evm has incorrect is_static parameter for custom stateful precompiles

> Incorrect static context handling in custom precompiles allows unauthorized state modifications during static calls in the evm library.

- **Severity:** Medium 5.9 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/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:** 25 Oct 2022
- **Updated:** 23 Apr 2025
- **Also known as:** GHSA-hhc4-47rh-cr34, RUSTSEC-2022-0083

## What is CVE-2022-39354?

CVE-2022-39354 is a medium-severity vulnerability in rust-blockchain evm, published on 25 Oct 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

SputnikVM, also called evm, is a Rust implementation of Ethereum Virtual Machine. A custom stateful precompile can use the `is_static` parameter to determine if the call is executed in a static context (via `STATICCALL`), and thus decide if stateful operations should be done. Prior to version 0.36.0, the passed `is_static` parameter was incorrect -- it was only set to `true` if the call came from a direct `STATICCALL` opcode. However, once a static call context is entered, it should stay static. The issue only impacts custom precompiles that actually uses `is_static`. For those affected, the issue can lead to possible incorrect state transitions. Version 0.36.0 contains a patch. There are no known workarounds.

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

## Which versions are affected by CVE-2022-39354?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `evm` | crates.io | All versions | 0.36.0 |
| `evm` | crates.io | All versions | 0.36.0 |
| `evm` | crates.io | From 0.0.0-0 | 0.36.0 |

Products: Evm Project Evm.

## How do I fix CVE-2022-39354?

Upgrade evm to 0.36.0 or later.

## Is CVE-2022-39354 being exploited?

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

## Other vulnerabilities in rust-blockchain evm

- [CVE-2021-41153](https://insights.sbomify.com/CVE-2021-41153/): Specification non-compliance in JUMPI (high 8.7)
- [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)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-39354 and fix it if it is affected.

What it is: CVE-2022-39354 is a medium-severity vulnerability in rust-blockchain evm, published on 25 Oct 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 CVE-2022-39354 in the wild and no public exploit code.

Affected packages and fixed versions:
- evm (crates.io): affected all versions; fixed in 0.36.0
- evm (crates.io): affected all versions; fixed in 0.36.0
- evm (crates.io): affected from 0.0.0-0; fixed in 0.36.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-2022-39354/ (Markdown: https://insights.sbomify.com/CVE-2022-39354/index.md)
```

## Sources

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

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