CVE-2024-47813: Bytecode Alliance Wasmtime race condition in internal type registry

CVE-2024-47813 · Severity: low · CVSS 3.1 · Published 2024-10-09

Wasmtime is a runtime used to execute WebAssembly code safely. A race condition in how it manages internal data types could allow a malicious or malfunctioning application to bypass security checks. This could lead to program crashes or the execution of code with incorrect data types, potentially compromising the integrity of the application's operations.

Technologies: wasmtime (crates.io), wasmtime (PyPI). Vendors: crates.io, PyPI.

Quick answers

Is CVE-2024-47813 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2024-47813 being exploited in the wild.
How severe is CVE-2024-47813?
Low severity, with a CVSS score of 3.1, published 9 October 2024.
Which products and versions are affected?
wasmtime (crates.io) SEMVER:introduced=19.0.0,fixed=21.0.2, SEMVER:introduced=19.0.0,fixed=21.0.2,introduced=22.0.0,fixed=22.0.1,introduced=23.0.0,fixed=23.0.3,introduced=24.0.0,fixed=24.0.1,introduced=25.0.0,fixed=25.0.2; wasmtime (PyPI) ECOSYSTEM:introduced=0,last_affected=19.0.0,last_affected=19.0.1,last_affected=19.0.2,last_affected=20.0.0,last_affected=20.0.1,last_affected=20.0.2,last_affected=21.0.0,last_affected=21.0.1,last_affected=22.0.0,last_affected=23.0.0,last_affected=23.0.1,last_affected=23.0.2,last_affected=24.0.0,last_affected=25.0.0,last_affected=25.0.1.
Is there a fix for CVE-2024-47813?
Yes. wasmtime (crates.io): upgrade to 21.0.2, 25.0.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2024-47813 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2024-47813?
Check whether you run wasmtime (crates.io) or wasmtime (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • wasmtime (crates.io): upgrade to 21.0.2, 25.0.2 or later
    cargo update -p wasmtime

Technical details

A time-of-check versus time-of-use (TOCTOU) race condition exists in the `wasmtime::Engine` internal type registry. When multiple threads concurrently create and drop types (e.g., `FuncType`, `ArrayType`), an atomic decrement of a registration count can be interleaved with a re-registration, leading to a double-unregistration of a type slot. This corruption can cause a new, different type to be assigned to a previously used slot, potentially allowing a `call_indirect` dynamic type check to incorrectly pass. This results in a violation of WebAssembly's control-flow integrity (CFI) and type safety. The vulnerability is only exploitable if the engine is shared across multiple threads performing concurrent type operations.

Affected products

  • Bytecode Alliance Wasmtime >= 19.0.0, < 21.0.2; >= 22.0.0, < 22.0.1; >= 23.0.0, < 23.0.3; >= 24.0.0, < 24.0.1; >= 25.0.0, < 25.0.2

Identifiers

  • CVE-2024-47813
  • GHSA-7qmx-3fpx-r45m
  • PYSEC-2024-311
  • RUSTSEC-2024-0439

Timeline

  • 2024-10-09: advisory
  • 2024-10-09: disclosed
  • 2024-10-09: patched

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.