CVE-2026-47261: Wasmtime: WASI path_open(TRUNCATE) bypasses `FilePerms::WRITE` host restriction

Published Jun 5, 2026
·
Updated

Summary

In wasmtime-wasi, when a filesystem preopen is given DirPerms::all() and FilePerms::READ without FilePerms::WRITE, this wasmtime-wasi enforced access control mechanism can be bypassed by using the wasip2 descriptor.open-at or wasip1 pathopen interfaces by opening a file with OpenFlags::TRUNCATE oflag only, for example:

rust dirdescriptor.openat( PathFlags::empty(), FILENAME, OpenFlags::TRUNCATE, DescriptorFlags::READ, )

rust wasip1::pathopen( dirfd, 0, FILENAME, wasip1::OFLAGSTRUNC, wasip1::RIGHTSFDREAD, 0, 0 )

The root cause is that the clause that considered OpenFlags::TRUNCATE did not set openmode |= OpenMode::WRITE;, used later in that function for the access control check against FilePerms for whether opening that file is permitted. With the bug corrected, these calls to open-at and pathopen fail with error-code.not-permitted and ERRNOPERM respectively.

The bug in crates/wasi/src/filesystem.rs, Dir::openat, lines 967–969:

rust if oflags.contains(OpenFlags::TRUNCATE) { opts.truncate(true).write(true); } and the single line fix is: rust if oflags.contains(OpenFlags::TRUNCATE) { opts.truncate(true).write(true); openmode |= OpenMode::WRITE; }

Only wasmtime-wasi embeddings that use a combination of DirPerms::MUTATE with FilePerms::READ are affected by this bug, e.g. those that use in the WasiCtxBuilder: rust builder.preopeneddir("readonly", "readonly", DirPerms::READ | DirPerms::MUTATE, FilePerms::READ);

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.

Other sources

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 pathopen 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::openat, lines 967–969) did not set openmode |= 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 ERRNOPERM 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.

MITRE

Affected Software

6 affected componentsFixes available
rust/wasmtime-wasi<24.0.9
24.0.9
rust/wasmtime-wasi>=25.0.0<36.0.10
36.0.10
rust/wasmtime-wasi>=37.0.0<44.0.2
44.0.2
bytecodealliance Wasmtime Rust<24.0.9
bytecodealliance Wasmtime Rust>=25.0.0<36.0.10
bytecodealliance Wasmtime Rust>=37.0.0<44.0.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade rust/wasmtime-wasi to a version that resolves this vulnerability.

    Fixed in 24.0.9
  2. Upgrade

    Upgrade rust/wasmtime-wasi to a version that resolves this vulnerability.

    Fixed in 36.0.10
  3. Upgrade

    Upgrade rust/wasmtime-wasi to a version that resolves this vulnerability.

    Fixed in 44.0.2
  4. Configuration

    Ensure preopened directories are granted FilePerms::all() (or otherwise include FilePerms::WRITE) instead of only FilePerms::READ to prevent TRUNCATE-only opens from bypassing write-restriction checks.

    WasiCtxBuilder preopened_dir preopen file permissions = FilePerms::all()

Event History

Jun 5, 2026
Advisory Published
via GitHub·03:47 PM
Data Sourced
via GitHub·03:47 PM
DescriptionSeverityWeaknessAffected Software
Jun 15, 2026
CVE Published
via MITRE·07:47 PM
Data Sourced
via MITRE·07:47 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:17 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-47261?

The severity of CVE-2026-47261 is rated high with a score of 7.5.

2

What type of vulnerability is CVE-2026-47261?

CVE-2026-47261 is a bypass of the access control mechanism in the wasmtime-wasi library.

3

How do I fix CVE-2026-47261?

To fix CVE-2026-47261, ensure that filesystem preopens do not use DirPerms::all() with FilePerms::READ without FilePerms::WRITE.

4

What software is affected by CVE-2026-47261?

CVE-2026-47261 affects the rust/wasmtime-wasi software package.

5

When was CVE-2026-47261 published?

CVE-2026-47261 was published on June 5, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203