CVE-2024-21629 Erroneous handling of `record_external_operation` error return

Medium 5.9 Published Updated

Attackers can force state commitments despite failed contract creation if custom error handling is implemented, affecting Rust EVM library users.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-21629?

CVE-2024-21629 is a medium-severity vulnerability in rust-ethereum evm, published on 2 Jan 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Rust EVM is an Ethereum Virtual Machine interpreter. In `rust-evm`, a feature called `record_external_operation` was introduced, allowing library users to record custom gas changes. This feature can have some bogus interactions with the call stack. In particular, during finalization of a `CREATE` or `CREATE2`, in the case that the substack execution happens successfully, `rust-evm` will first commit the substate, and then call `record_external_operation(Write(out_code.len()))`. If `record_external_operation` later fails, this error is returned to the parent call stack, instead of `Succeeded`. Yet, the substate commitment already happened. This causes smart contracts able to commit state changes, when the parent caller contract receives zero address (which usually indicates that the execution has failed). This issue only impacts library users with custom `record_external_operation` that returns errors. The issue is patched in release 0.41.1. No known workarounds are available.

Weakness: CWE-703

Which versions are affected by CVE-2024-21629?

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

PackageAffectedFixed in
evm crates.ioAll versions0.41.1
evm crates.ioAll versions0.41.1

Products include Evm Project Evm.

How do I fix CVE-2024-21629?

Upgrade evm to 0.41.1 or later.

Is CVE-2024-21629 being exploited?

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

Sources

Also known as GHSA-27wg-99g8-2v4v.

Is CVE-2024-21629 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free