Skip to content
Heist/ feed
Back to feed
Medium

Erroneous handling of `record_external_operation` error return

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2024-21629
Confirmed fixed CVEs
Not specified
Updated in this feed
6 Nov 2026, 02:46 UTC · Revision 1

Source evidence

Erroneous handling of `record_external_operation` error return

core-osv · Original source

Published 2 Jan 2024, 21:26 UTC

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.

osv:CVE-2024-21629
Complete source record
{
  "id": "8066d0eca66a952df781bb91a2dec1e86c7ce687373c2f1d907cc938f1fdae9e",
  "url": "https://osv.dev/vulnerability/CVE-2024-21629",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Erroneous handling of `record_external_operation` error return",
    "summary": "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.",
    "evidence": "osv:CVE-2024-21629",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2024-21629",
      "aliases": [
        "CVE-2024-21629",
        "GHSA-27wg-99g8-2v4v"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/rust-ethereum/evm",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "d8991ec727ad0fb64fe9957a3cd307387a6701e4"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "fixed": "d8991ec727ad0fb64fe9957a3cd307387a6701e4"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "evm-core-v0.26.1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-21629.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:46.300818622Z",
      "provider": "osv",
      "references": [
        "https://github.com/rust-ethereum/evm/blob/release-v041/src/executor/stack/executor.rs#L1012C25-L1012C69",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/21xxx/CVE-2024-21629.json",
        "https://github.com/rust-ethereum/evm/security/advisories/GHSA-27wg-99g8-2v4v",
        "https://nvd.nist.gov/vuln/detail/CVE-2024-21629",
        "https://github.com/rust-ethereum/evm/commit/d8991ec727ad0fb64fe9957a3cd307387a6701e4",
        "https://github.com/rust-ethereum/evm/pull/264"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-703"
        ],
        "cna_assigner": "GitHub_M",
        "unresolved_ranges": [
          {
            "extracted_events": [
              {
                "range": [
                  {
                    "fixed": "0.41.1"
                  }
                ],
                "source": "AFFECTED_FIELD",
                "strategy": "StringRangeExpression"
              }
            ]
          }
        ],
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/21xxx/CVE-2024-21629.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2024-21629",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 514406,
  "published_at": "2024-01-02T21:26:12.68+00:00"
}