GHSA-4ch3-9j33-3pmj: Medium severity rust/wasmtime-wasi vulnerability

Published Oct 16, 2026
·
Updated

Summary

Wasmtime's WASI filesystem implementation lets a guest with a read-only source file capability overwrite that file by hard-linking it into another preopen that allows file writes. An attacker who can run a WASI guest can bypass WasiCtxBuilder per-preopen FilePerms and modify host files that were exposed as FilePerms::READ.

This attack is possible through the wasip1, wasip2, and wasip3 interfaces to the WASI filesystem.

This attack is also possible through an indirection of renaming a hardlink into another preopen.

Details

WasiCtxBuilder::preopeneddir documents fileperms as the maximum permissions usable for files in that preopen. However, hard-link creation and renaming only checked directory mutation for permission, and not whether the file permissions matched.

This makes an attack possible where: a read-only file target exists in a preopen with only FilePerms::READ a hardlink named alias, with destination to the target, is created in a preopen with FilePerms::READ | FilePerms::WRITE the attacker opens the file alias for writing, in which they can overwrite target

The same attack is possible by way of renaming: a read-only file target exists in a preopen with only FilePerms::READ a hardlink named alias, with destination to the target, is created in that same preopen the alias file is renamed into a preopen with FilePerms::READ | FilePerms::WRITE the attacker opens the file alias for writing, in which they can overwrite target

Symbolic links are not a vector for this attack because the wasi-filesystem interfaces already enforces that the destination for a symlink is under the same preopen. We do not believe there are any other vectors to this attack because there are no other wasi filesystem interfaces that take multiple borrows of a descriptor resource for e.g. the source and destination in different descriptors.

Remediation

The definition of Dir::linkat and Dir::renameat in wasmtime-wasi's src/filesystem.rs now have an additional permissions check that ensures the source and destination values for the directory permissions perms and the file permissions fileperms are identical.

rust if self.perms != newdir.perms || self.fileperms != newdir.fileperms { return Err(ErrorCode::NotPermitted); }

Impact

Only wasmtime-wasi embeddings that use a combination of DirPerms::MUTATE with FilePerms::READ, as well as using a second preopen with higher permissions (FilePerms::WRITE as well), are affected by this bug, e.g. those that use in the WasiCtxBuilder:

rust builder.preopeneddir("readwrite", "readwrite", DirPerms::READ | DirPerms::MUTATE, FilePerms::READ | FilePerms::WRITE); 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.

Affected Software

4 affected componentsFixes available
rust/wasmtime-wasi>=46.0.0<46.0.1
46.0.1
rust/wasmtime-wasi>=37.0.0<45.0.3
45.0.3
rust/wasmtime-wasi>=25.0.0<36.0.12
36.0.12
rust/wasmtime-wasi<24.0.11
24.0.11

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 46.0.1
  2. Upgrade

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

    Fixed in 45.0.3
  3. Upgrade

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

    Fixed in 36.0.12
  4. Upgrade

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

    Fixed in 24.0.11

Event History

Oct 16, 2026
Advisory Published
via GitHub·07:57 PM
Data Sourced
via GitHub·07:57 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Who is exposed to this issue?

Applications using Wasmtime's WASI filesystem that allow an attacker to run a WASI guest are exposed when they provide preopened directories with differing file permissions. The issue affects the wasip1, wasip2, and wasip3 filesystem interfaces.

2

What configuration is required for exploitation?

The guest must be able to access a target file exposed through a preopen with FilePerms::READ and another preopen that permits file writes with FilePerms::READ | FilePerms::WRITE. The attacker can hard-link the read-only target into the writable preopen, or use a rename-based indirection, then open the resulting path for writing.

3

What is the impact of a successful exploit?

A guest can overwrite host files that the application intended to expose as read-only through WasiCtxBuilder per-preopen FilePerms. The vulnerability bypasses the documented maximum file permissions for the affected preopen.

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