Categories
CVE-2021-39218

Vulnerability in wasmtime (CVE-2021-39218)

Summary

Vulnerability in wasmtime (CVE-2021-39218). Data can be tampered with by attackers. Exploitable via externref. Mitigation: upgrade to 0.30.0 or later.

Original description

The description as published by the source.

Wasmtime is an open source runtime for WebAssembly & WASI. In Wasmtime from version 0.26.0 and before version 0.30.0 is affected by a memory unsoundness vulnerability. There was an invalid free and out-of-bounds read and write bug when running Wasm that uses externrefs in Wasmtime. To trigger this bug, Wasmtime needs to be running Wasm that uses externrefs, the host creates non-null externrefs, Wasmtime performs a garbage collection (GC), and there has to be a Wasm frame on the stack that is at a GC safepoint where there are no live references at this safepoint, and there is a safepoint with live references earlier in this frame's function. Under this scenario, Wasmtime would incorrectly use the GC stack map for the safepoint from earlier in the function instead of the empty safepoint. This would result in Wasmtime treating arbitrary stack slots as externrefs that needed to be rooted for GC. At the next GC, it would be determined that nothing was referencing these bogus externrefs (because nothing could ever reference them, because they are not really externrefs) and then Wasmtime would deallocate them and run ::drop on them. This results in a free of memory that is not necessarily on the heap (and shouldn't be freed at this moment even if it was), as well as potential out-of-bounds reads and writes. Even though support for externrefs (via the reference types proposal) is enabled by default, unless you are creating non-null externrefs in your host code or…

Source: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV

Auto-generated summary

Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.

A vulnerability tracked as CVE-2021-39218 has been found in wasmtime.
Attackers can target a specific entry point like externref over the network to misuse the product.
Data can be tampered with by attackers.
What to do: upgrade wasmtime to 0.30.0 or later.
If unsure, ask your IT team or search "wasmtime CVE-2021-39218" on the vendor's site.

CVE-2021-39218 (wasmtime) — CWE-843
Attack vector: local / no user interaction
Attack surface: externref / externrefs / false
Patched: 0.30.0 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.

❓ What is the problem

A vulnerability (CWE-843) exists in wasmtime. Attackers reach the vulnerable code path via externref.

📍 Affected scope

Check the vendor advisory for the affected versions of wasmtime. Attack surface: externref / externrefs / false.

🔥 Severity

Severity: ?. Data can be tampered with by attackers.

🔧 How to fix

Update to 0.30.0.

🛡️ Workaround

Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.

🔍 Detection

Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'wasmtime' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.

Response actions

Concrete steps and command examples for SOC/SRE teams to execute in order

  1. 1
    Identify exposure identify
    grep -r 'wasmtime' . | grep -v node_modules

    リポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で wasmtime を grep し、稼働しているサービス・バージョンを把握する。

  2. 2
    Apply patch patch
    Upgrade wasmtime to 0.30.0

    ステージング環境で 0.30.0 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。

  3. 3
    Post-deployment verification verify
    Confirm patched version is live in production

    パッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。

Affected packages

crates.io wasmtime
[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.30.0"}]}]
PyPI wasmtime
[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.30.0"}]}]

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details