CVE-2022-36025: Evm Besu VM Vulnerable To Gas Vulnerability

CRITICAL
Advisory Identifier: GHSA-4456-w38r-m53x
CVSS 9.1
CWE-681 CWE-196
Published
Advisory Summary

CVE-2022-36025 is a CRITICAL (CVSS 9.1) besu vm vulnerable to gas vulnerability (CWE-681: Incorrect Conversion between Numeric Types) affecting Evm libraries in the Maven ecosystem. The issue involves besu vm vulnerable to gas allocation error in call operations. Remediation is available by upgrading affected packages to version 22.7.1.

CVE-2022-36025 at a Glance

CVE Identifier CVE-2022-36025
GHSA Identifier GHSA-4456-w38r-m53x
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-681: Incorrect Conversion between Numeric Types
Affected Product Evm
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 9.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-36025

To remediate this vulnerability, upgrade all affected Evm dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.hyperledger.besu:evm fixed: 22.7.1
<dependency>
    <groupId>org.hyperledger.besu</groupId>
    <artifactId>evm</artifactId>
    <version>22.7.1</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.hyperledger.besu

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2022-36025, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.hyperledger.besu

Analyze the terminal output to locate any version of Evm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 22.7.1), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.hyperledger.besu command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-681: Incorrect Conversion between Numeric Types, where when converting from one data type to another, such as long to integer, data can be omitted or translated in a way that produces unexpected values. if the resulting values are used in a sensitive context, then dangerous behaviors may occur. In Evm, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact An error in 32 bit signed and unsigned types in the calculation of available gas in the CALL operations (including DELEGATECALL) results in incorrect gas being passed into called contracts and incorrect gas being returned after call execution. Where the amount of gas makes a difference in the success or failure, or if the gas is a negative 64 bit value, the execution will result in a different state root than expected, resulting in a consensus failure in networks with multiple EVM implementations. In networks with a single EVM implementation this can be used to execute with significantly more gas than then transaction requested, possibly exceeding gas limitations. ### Patches Version 22.7.1 contains a fix, ensuring that excess gas will not be allocated to inner transaction calls and correcting the excess gas errors. ### Workarounds Reverting to version 22.1.3 or earlier will prevent incorrect execution. However many ethereum mainnet networks require changes in more recent versions of Besu and should not use older versions of besu and should instead use the patched version. Ethereum Classic and other networks not depending on a Proof of Stake transition should function fine with version 22.1.3 or earlier. ### For more information Issue was found by [Martin Holst Swende](https://github.com/holiman) using [goevmlab](https://github.com/holiman/goevmlab), it is believed that no production networks have transactions that would trigger this failure.

CVE-2022-36025 Affected Evm Versions

1 component(s)
Fixed Versions:
22.7.1
Product / Package Ecosystem Affected Versions Fixed Version
org.hyperledger.besu:evm
Maven
≥ 22.4.0-RC1
< 22.7.1
22.7.1

References

Frequently Asked Questions

What is CVE-2022-36025?
CVE-2022-36025 is a security vulnerability in Evm involving Besu VM vulnerable to gas allocation error in CALL operations under CWE-681: Incorrect Conversion between Numeric Types.
Which Evm versions are affected?
Affected versions include releases prior to 22.7.1 across affected packages: org.hyperledger.besu:evm.
What version fixes CVE-2022-36025?
Upgrading to 22.7.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is evm affected?
Yes, org.hyperledger.besu:evm is affected in releases prior to 22.7.1. Upgrade your dependency to 22.7.1 or later.
What is the CVSS score of CVE-2022-36025?
CVE-2022-36025 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H.
What CWE is associated with CVE-2022-36025?
CVE-2022-36025 is classified under CWE-681: Incorrect Conversion between Numeric Types (When converting from one data type to another, such as long to integer, data can be omitted or translated in a way that produces unexpected values. If the resulting values are used in a sensitive context, then dangerous behaviors may occur.).
How can I check Maven dependencies for CVE-2022-36025?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.hyperledger.besu'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4456-w38r-m53x",
  "modified" : "2022-09-23T20:24:21Z",
  "published" : "2022-09-23T20:24:21Z",
  "aliases" : [ "CVE-2022-36025" ],
  "summary" : "Besu VM vulnerable to gas allocation error in CALL operations",
  "details" : "### Impact\nAn error in 32 bit signed and unsigned types in the calculation of available gas in the CALL operations (including DELEGATECALL) results in incorrect gas being passed into called contracts and incorrect gas being returned after call execution.  Where the amount of gas makes a difference in the success or failure, or if the gas is a negative 64 bit value, the execution will result in a different state root than expected, resulting in a consensus failure in networks with multiple EVM implementations. \n\nIn networks with a single EVM implementation this can be used to execute with significantly more gas than then transaction requested, possibly exceeding gas limitations. \n\n### Patches\nVersion 22.7.1 contains a fix, ensuring that excess gas will not be allocated to inner transaction calls and correcting the excess gas errors.\n\n### Workarounds\nReverting to version 22.1.3 or earlier will prevent incorrect execution. However many ethereum mainnet networks require changes in more recent versions of Besu and should not use older versions of besu and should instead use the patched version.  \n\nEthereum Classic and other networks not depending on a Proof of Stake transition should function fine with version 22.1.3 or earlier.\n\n### For more information\nIssue was found by [Martin Holst Swende](https://github.com/holiman) using [goevmlab](https://github.com/holiman/goevmlab), it is believed that no production networks have transactions that would trigger this failure.\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.hyperledger.besu:evm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "22.4.0-RC1"
      }, {
        "fixed" : "22.7.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/hyperledger/besu/security/advisories/GHSA-4456-w38r-m53x"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-36025"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/hyperledger/besu"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-196", "CWE-681" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-23T20:24:21Z",
    "nvd_published_at" : "2022-09-24T02:15:00Z"
  }
}