CVE-2026-47261

Wasmtime: WASI path_open(TRUNCATE) bypasses `FilePerms::WRITE` host restriction

Published Jun 15, 2026 CVSS 3.1 · 7.5 High EPSS < 1% KEV · Not listed
Description
Wasmtime is a runtime for WebAssembly. In versions prior to 24.0.9, 36.0.10, and 44.0.2, when a filesystem preopen is given DirPerms::all() and FilePerms::READ without FilePerms::WRITE, this access control mechanism can be bypassed via the wasip2 descriptor.open-at or wasip1 path_open interfaces by opening a file with only the OpenFlags::TRUNCATE oflag. The root cause is that the clause handling OpenFlags::TRUNCATE in crates/wasi/src/filesystem.rs (Dir::open_at, lines 967–969) did not set open_mode |= OpenMode::WRITE;, which is later used for the access control check against FilePerms to determine whether opening the file is permitted; the single-line fix adds that missing assignment, after which the affected calls correctly fail with error-code.not-permitted and ERRNO_PERM respectively. Only wasmtime-wasi embeddings that combine DirPerms::MUTATE with FilePerms::READ are affected by this bug. In particular, the Wasmtime project's wasmtime-cli's use of wasmtime-wasi is not affected, because it always sets FilePerms::all() for all preopens. This issue has been fixed in versions 24.0.9, 36.0.10 and44.0.2.

Analysis

AI-generated

Technical impact

The vulnerability is in Wasmtime’s WASI path_open and open_at interfaces. When a preopened directory is granted DirPerms::MUTATE and FilePerms::READ but not FilePerms::WRITE, an attacker can open a file using the OpenFlags::TRUNCATE flag and the implementation fails to mark the operation as a write because the WRITE bit is not set on the open_mode flag. This bypasses the later access‑control check that enforces FilePerms::WRITE. As a result, modules can truncate or overwrite files that should be read‑only, constituting an Access Control weakness (CWE‑284) and allowing integrity violations of preopened files.

Affected Systems

Bytecode Alliance Wasmtime runtimes built before v24.0.9, v36.0.10, or v44.0.2 are vulnerable when an embedding configures a preopened directory with DirPerms::MUTATE and FilePerms::READ. Embeddings that combine these permissions, such as the standard wasmtime-wasi library, are affected; the wasmtime-cli, which always uses FilePerms::all for its preopens, is not affected. The flaw was fixed in the releases cited in the advisories.

Risk and Exploitability

The CVSS score of 7.5 indicates medium‑to‑high severity. The EPSS score is below 1%, implying low exploitation likelihood. It is not listed in the CISA KEV catalog. Based on the description, the likely attack vector is a malicious WebAssembly module that requests a file open with the TRUNCATE flag; if the host’s preopen grants DirPerms::MUTATE and FilePerms::READ but not FilePerms::WRITE, the module can open the target file and truncate it. The flaw does not introduce denial‑of‑service or arbitrary code execution beyond the file modification context.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade to a fixed Wasmtime release (v24.0.9, v36.0.10, v44.0.2 or later).
  • Adjust the embedding configuration to avoid combining DirPerms::MUTATE with FilePerms::READ when setting preopens.
  • Restrict or remove support for the TRUNCATE flag from untrusted modules until a patch is available.

Generated by OpenCVE AI on August 13, 2026 at 20:18 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-2r75-cxrj-cmph wasmtime-wasi: WASI path_open(TRUNCATE) bypasses `FilePerms::WRITE` host restriction
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Bytecodealliance
Bytecodealliance wasmtime
Vendors & Products Bytecodealliance
Bytecodealliance wasmtime
Type Values Removed Values Added
Description Wasmtime is a runtime for WebAssembly. In versions prior to 24.0.9, 36.0.10, and 44.0.2, when a filesystem preopen is given DirPerms::all() and FilePerms::READ without FilePerms::WRITE, this access control mechanism can be bypassed via the wasip2 descriptor.open-at or wasip1 path_open interfaces by opening a file with only the OpenFlags::TRUNCATE oflag. The root cause is that the clause handling OpenFlags::TRUNCATE in crates/wasi/src/filesystem.rs (Dir::open_at, lines 967–969) did not set open_mode |= OpenMode::WRITE;, which is later used for the access control check against FilePerms to determine whether opening the file is permitted; the single-line fix adds that missing assignment, after which the affected calls correctly fail with error-code.not-permitted and ERRNO_PERM respectively. Only wasmtime-wasi embeddings that combine DirPerms::MUTATE with FilePerms::READ are affected by this bug. In particular, the Wasmtime project's wasmtime-cli's use of wasmtime-wasi is not affected, because it always sets FilePerms::all() for all preopens. This issue has been fixed in versions 24.0.9, 36.0.10 and44.0.2.
Title Wasmtime: WASI path_open(TRUNCATE) bypasses `FilePerms::WRITE` host restriction
Weaknesses CWE-284
References
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jun 16, 2026, 12:46 PM
Reserved
May 18, 2026, 11:03 PM
Status
Analyzed
Published
Jun 15, 2026, 9:17 PM
Modified
Oct 25, 2026, 11:10 PM