5.9medium
Erroneous handling of `record_external_operation` error return
- Severity
- 5.9medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.58% (higher than 48% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-27wg-99g8-2v4v
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| rust-ethereum evm | < 0.41.1 | CVE List |
| evm (crates.io) | before 0.41.1 | GitHub Advisory Database |
| evm_project evm | before 0.41.1 | NVD |
All scores
| GitHub_M | 5.9medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N |
| GitHub | 5.9medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
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.
GitHub Advisory Database
Impact
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.
Patches
The issue is patched in release 0.41.1. The commit can be seem here.
Workarounds
None.
References
Patch PR #264.
NVD (es)
Rust EVM es un intérprete de máquina virtual Ethereum. En "rust-evm", se introdujo una función llamada "record_external_operation", que permite a los usuarios de la librería registrar cambios de gas personalizados. Esta característica puede tener algunas interacciones falsas con la pila de llamadas. En particular, durante la finalización de `CREATE` o `CREATE2`, en el caso de que la ejecución de la subpila se realice exitosamente, `rust-evm` primero confirmará el subestado y luego llamará a `record_external_operation(Write(out_code.len()) )`. Si `record_external_operation` falla posteriormente, este error se devuelve a la pila de llamadas principal, en lugar de `Succeeded`. Sin embargo, el compromiso subestatal ya se produjo. Esto hace que los contratos inteligentes puedan realizar cambios de estado, cuando el contrato principal de la persona que llama recibe una dirección cero (lo que generalmente indica que la ejecución ha fallado). Este problema solo afecta a los usuarios de la librería con `record_external_operative` personalizado que devuelve errores. El problema se solucionó en la versión 0.41.1. No hay workarounds disponibles.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-21629 changed 2025-06-17 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-27wg-99g8-2v4v changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2024-21629 changed 2026-06-17 | Public domain |