GHSA-rg2q-2jh9-447q: Cosmwasm vm Gas Mispricing Vulnerability

MODERATE
CVSS 4.3
CWE-920
Published
Advisory Summary

GHSA-rg2q-2jh9-447q is a MODERATE (CVSS 4.3) gas mispricing vulnerability (CWE-920: Improper Restriction of Power Consumption) affecting Cosmwasm vm libraries in the crates.io ecosystem. The issue involves gas mispricing in cosmwasm-vm. Remediation is available by upgrading affected packages to version 1.5.6, 2.0.5, 2.1.2, 2.0.3, 1.5.4.

GHSA-rg2q-2jh9-447q at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-rg2q-2jh9-447q
Severity MODERATE
CVSS v3.1 Base Score 4.3
CWE Classification CWE-920: Improper Restriction of Power Consumption
Affected Product Cosmwasm vm
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 4.3

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

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

How to Fix GHSA-rg2q-2jh9-447q

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

cosmwasm-vm fixed: 1.5.6
Upgrade cosmwasm-vm to 1.5.6
cosmwasm-vm fixed: 2.0.5
Upgrade cosmwasm-vm to 2.0.5
cosmwasm-vm fixed: 2.1.2
Upgrade cosmwasm-vm to 2.1.2
github.com/CosmWasm/wasmvm/v2 fixed: 2.1.2
Upgrade github.com/CosmWasm/wasmvm/v2 to 2.1.2
github.com/CosmWasm/wasmvm/v2 fixed: 2.0.3
Upgrade github.com/CosmWasm/wasmvm/v2 to 2.0.3
github.com/CosmWasm/wasmvm fixed: 1.5.4
Upgrade github.com/CosmWasm/wasmvm to 1.5.4
Verify Direct and Transitive Dependencies

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

inspect dependencies for cosmwasm-vm

How to Check if You Are Affected

To determine whether your application is affected by GHSA-rg2q-2jh9-447q, inspect your project dependencies for Cosmwasm vm:

inspect dependencies for cosmwasm-vm

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-920: Improper Restriction of Power Consumption, where the product operates in an environment in which power is a limited resource that cannot be automatically replenished, but the product does not properly restrict the amount of power that its operation consumes. In Cosmwasm vm, 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

**Component:** wasmvm **Criticality:** Medium ([ACMv1](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md): I:Moderate; L:Likely) **Patched versions:** wasmvm 1.5.4, 2.0.3, 2.1.2 Some Wasm operations take significantly more gas than our benchmarks indicated. This can lead to missing the [gas target](https://github.com/CosmWasm/cosmwasm/blob/e50490c4199a234200a497219b27f071c3409f58/docs/GAS.md#cosmwasm-gas-pricing) we defined by a factor of ~10x. This means a malicious contract could take 10 times as much time to execute as expected, which can be used to temporarily DoS a chain. See [CWA-2024-004](https://github.com/CosmWasm/advisories/blob/main/CWAs/CWA-2024-004.md) for more details.

GHSA-rg2q-2jh9-447q Affected Cosmwasm vm Versions

6 component(s)
Fixed Versions:
1.5.62.0.52.1.22.0.31.5.4
Product / Package Ecosystem Affected Versions Fixed Version
cosmwasm-vm
crates.io
< 1.5.6
1.5.6
cosmwasm-vm
crates.io
≥ 2.0.0
< 2.0.5
2.0.5
cosmwasm-vm
crates.io
≥ 2.1.0
< 2.1.2
2.1.2
github.com/CosmWasm/wasmvm/v2
Go
≥ 2.1.0
< 2.1.2
2.1.2
github.com/CosmWasm/wasmvm/v2
Go
≥ 2.0.0
< 2.0.3
2.0.3
github.com/CosmWasm/wasmvm
Go
< 1.5.4
1.5.4

References

Frequently Asked Questions

What is GHSA-rg2q-2jh9-447q?
GHSA-rg2q-2jh9-447q is a security vulnerability in Cosmwasm vm involving Gas mispricing in cosmwasm-vm under CWE-920: Improper Restriction of Power Consumption.
Which Cosmwasm vm versions are affected?
Affected versions include releases prior to 1.5.6, 2.0.5, 2.1.2, 2.0.3, 1.5.4 across affected packages: cosmwasm-vm, github.com/CosmWasm/wasmvm/v2, github.com/CosmWasm/wasmvm.
What version fixes GHSA-rg2q-2jh9-447q?
Upgrading to 1.5.6, 2.0.5, 2.1.2, 2.0.3, 1.5.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cosmwasm-vm affected?
Yes, cosmwasm-vm is affected in releases prior to 1.5.6, 2.0.5, 2.1.2. Upgrade your dependency to 1.5.6, 2.0.5, 2.1.2 or later.
Is github.com/CosmWasm/wasmvm/v2 affected?
Yes, github.com/CosmWasm/wasmvm/v2 is affected in releases prior to 2.1.2, 2.0.3. Upgrade your dependency to 2.1.2, 2.0.3 or later.
What is the CVSS score of GHSA-rg2q-2jh9-447q?
GHSA-rg2q-2jh9-447q has a CVSS v3.1 base score of 4.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with GHSA-rg2q-2jh9-447q?
GHSA-rg2q-2jh9-447q is classified under CWE-920: Improper Restriction of Power Consumption (The product operates in an environment in which power is a limited resource that cannot be automatically replenished, but the product does not properly restrict the amount of power that its operation consumes.).
How can I check crates.io dependencies for GHSA-rg2q-2jh9-447q?
Run the dependency tree command: 'inspect dependencies for cosmwasm-vm'. 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-rg2q-2jh9-447q",
  "modified" : "2024-08-08T17:03:07Z",
  "published" : "2024-08-08T16:30:50Z",
  "aliases" : [ ],
  "summary" : "Gas mispricing in cosmwasm-vm",
  "details" : "**Component:** wasmvm\n**Criticality:** Medium ([ACMv1](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md): I:Moderate; L:Likely)\n**Patched versions:** wasmvm 1.5.4, 2.0.3, 2.1.2\n\nSome Wasm operations take significantly more gas than our benchmarks indicated. This can lead to missing the [gas target](https://github.com/CosmWasm/cosmwasm/blob/e50490c4199a234200a497219b27f071c3409f58/docs/GAS.md#cosmwasm-gas-pricing) we defined by a factor of ~10x. This means a malicious contract could take 10 times as much time to execute as expected, which can be used to temporarily DoS a chain.\n\nSee [CWA-2024-004](https://github.com/CosmWasm/advisories/blob/main/CWAs/CWA-2024-004.md) for more details.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "cosmwasm-vm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.5.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "cosmwasm-vm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "cosmwasm-vm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1.0"
      }, {
        "fixed" : "2.1.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/CosmWasm/wasmvm/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1.0"
      }, {
        "fixed" : "2.1.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/CosmWasm/wasmvm/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/CosmWasm/wasmvm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.5.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/CosmWasm/wasmvm/security/advisories/GHSA-rg2q-2jh9-447q"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/CosmWasm/cosmwasm/commit/5bef1c588933bd60a04bb70099150cf84b69e144"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/CosmWasm/cosmwasm/commit/9b4d6d03772b75d500a7d3c972d0d8ba6d085c06"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/CosmWasm/cosmwasm/commit/c1313afeb261e17b1c8cf6a1eacee1da0dac42ae"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/CosmWasm/advisories/blob/main/CWAs/CWA-2024-004.md"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/CosmWasm/wasmvm"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2024-0361.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-920" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-08-08T16:30:50Z",
    "nvd_published_at" : null
  }
}