CVE-2024-28123: Wasmi Wasmi Out-of-bounds Write For Host Vulnerability

HIGH
Advisory Identifier: GHSA-75jp-vq8x-h4cq
CVSS 7.3
CWE-787
Published
Advisory Summary

CVE-2024-28123 is a HIGH (CVSS 7.3) wasmi out-of-bounds write for host vulnerability (CWE-787: Out-of-bounds Write) affecting Wasmi libraries in the crates.io ecosystem. The issue involves wasmi out-of-bounds write for host to wasm calls with more than 128 parameters. Remediation is available by upgrading affected packages to version 0.31.1.

CVE-2024-28123 at a Glance

CVE Identifier CVE-2024-28123
GHSA Identifier GHSA-75jp-vq8x-h4cq
Severity HIGH
CVSS v3.1 Base Score 7.3
CWE Classification CWE-787: Out-of-bounds Write
Affected Product Wasmi
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 7.3

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:L/I:L/A:L).

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 Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2024-28123

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

wasmi fixed: 0.31.1
Upgrade wasmi to 0.31.1
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 wasmi

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-28123, inspect your project dependencies for Wasmi:

inspect dependencies for wasmi

Analyze the terminal output to locate any version of Wasmi in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.31.1), 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-787: Out-of-bounds Write, where the product writes data past the end, or before the beginning, of the intended buffer. In Wasmi, 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

### Summary In the WASMI Interpreter, an [Out-of-bounds Buffer Write](https://cwe.mitre.org/data/definitions/787.html) will arise arise if the host calls or resumes a Wasm function with more parameters than the default limit (128), as it will surpass the stack value. This doesn’t affect calls from Wasm to Wasm, only from host to Wasm. ### Impact After conducting an analysis of the dependent Polkadot systems of `wasmi`: [Pallet Contracts](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/contracts), [Parity Signer](https://github.com/paritytech/parity-signer), and [Smoldot](https://github.com/smol-dot/smoldot), we have found that none on those systems have been affected by the issue as they are calling host to Wasm function with a small limited amount of parameters always. ### Mitigations If you are using `wasmi` betwen version 0.15.0 and 0.31.0, please update it to the [0.31.1](https://github.com/paritytech/wasmi/releases/tag/v0.31.1) patch release that we just published. ### Workarounds Ensure no more than 128 parameters can be pass in a call from the host to a Wasm function. ### References Patch PR: <PR> ### Special thanks Special thanks to Stellar Development Foundation for reporting this security vulnerability.

CVE-2024-28123 Affected Wasmi Versions

1 component(s)
Fixed Versions:
0.31.1
Product / Package Ecosystem Affected Versions Fixed Version
wasmi
crates.io
≥ 0.15.0
< 0.31.1
0.31.1

References

Frequently Asked Questions

What is CVE-2024-28123?
CVE-2024-28123 is a security vulnerability in Wasmi involving Wasmi Out-of-bounds Write for host to Wasm calls with more than 128 Parameters under CWE-787: Out-of-bounds Write.
Which Wasmi versions are affected?
Affected versions include releases prior to 0.31.1 across affected packages: wasmi.
What version fixes CVE-2024-28123?
Upgrading to 0.31.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is wasmi affected?
Yes, wasmi is affected in releases prior to 0.31.1. Upgrade your dependency to 0.31.1 or later.
What is the CVSS score of CVE-2024-28123?
CVE-2024-28123 has a CVSS v3.1 base score of 7.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2024-28123?
CVE-2024-28123 is classified under CWE-787: Out-of-bounds Write (The product writes data past the end, or before the beginning, of the intended buffer.).
How can I check crates.io dependencies for CVE-2024-28123?
Run the dependency tree command: 'inspect dependencies for wasmi'. 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-75jp-vq8x-h4cq",
  "modified" : "2025-06-04T00:35:09Z",
  "published" : "2024-03-07T17:26:27Z",
  "aliases" : [ "CVE-2024-28123" ],
  "summary" : "Wasmi Out-of-bounds Write for host to Wasm calls with more than 128 Parameters",
  "details" : "### Summary\n\nIn the WASMI Interpreter, an [Out-of-bounds Buffer Write](https://cwe.mitre.org/data/definitions/787.html) will arise arise if the host calls or resumes a Wasm function with more parameters than the default limit (128), as it will surpass the stack value. This doesn’t affect calls from Wasm to Wasm, only from host to Wasm.\n\n### Impact\n\nAfter conducting an analysis of the dependent Polkadot systems of `wasmi`: [Pallet Contracts](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/contracts), [Parity Signer](https://github.com/paritytech/parity-signer), and [Smoldot](https://github.com/smol-dot/smoldot), we have found that none on those systems have been affected by the issue as they are calling host to Wasm function with a small limited amount of parameters always. \n\n### Mitigations\n\nIf you are using `wasmi` betwen version 0.15.0 and 0.31.0, please update it to the [0.31.1](https://github.com/paritytech/wasmi/releases/tag/v0.31.1) patch release that we just published.\n\n### Workarounds\n\nEnsure no more than 128 parameters can be pass in a call from the host to a Wasm function. \n\n### References\n\nPatch PR: <PR>\n\n### Special thanks\n\nSpecial thanks to Stellar Development Foundation for reporting this security vulnerability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "wasmi"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.15.0"
      }, {
        "fixed" : "0.31.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.31.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/wasmi-labs/wasmi/security/advisories/GHSA-75jp-vq8x-h4cq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-28123"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/wasmi-labs/wasmi/commit/f7b3200e9f3dc9e2cbca966cb255c228453c792f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/wasmi-labs/wasmi"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/wasmi-labs/wasmi/releases/tag/v0.31.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-787" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-07T17:26:27Z",
    "nvd_published_at" : "2024-03-21T02:52:23Z"
  }
}