All vulnerabilities
CVE-2026-58494GHSA-4ch3-9j33-3pmjRUSTSEC-2026-0188

Wasmtime: WASI hard links bypass wasmtime-wasi's FilePerms for destination

bytecodealliance wasmtime-wasirustLibraries & packages
CVSS
6.5Medium
ExploitationNo known exploitationNot in CISA KEV, which does not prove it is unexploitedCISA KEV
Exploit odds (EPSS)0.17%Chance of exploitation activity in the next 30 days, higher than 6% of CVEs. Scored 23 Oct 2026FIRST EPSS
Fixed in24.0.11Also 36.0.12, 45.0.3 and 1 moreGitHub
Published8 Jul 2026Updated 16 Oct 2026CVE List

What fixes it

  • 24.0.11wasmtime-wasi, rustGitHub
  • 36.0.12wasmtime-wasi, rustGitHub
  • 45.0.3wasmtime-wasi, rustGitHub
  • 46.0.1wasmtime-wasi, rustGitHub
  • 24.0.11wasmtime-wasi, crates.ioOSVcargo update -p wasmtime-wasi --precise 24.0.11
  • 36.0.12wasmtime-wasi, crates.ioOSVcargo update -p wasmtime-wasi --precise 36.0.12
Show all 8 fixed versions
  • 45.0.3wasmtime-wasi, crates.ioOSVcargo update -p wasmtime-wasi --precise 45.0.3
  • 46.0.1wasmtime-wasi, crates.ioOSVcargo update -p wasmtime-wasi --precise 46.0.1

A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.

Description

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::preopened_dir documents file_perms 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::link_at and Dir::rename_at 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 file_perms are identical.

        if self.perms != new_dir.perms || self.file_perms != new_dir.file_perms {
            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:

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

Text from GitHub Advisory Database

Affected versions 12

  • wasmtime-wasi, rust< 24.0.11GitHub
  • wasmtime-wasi, rust>= 25.0.0, < 36.0.12GitHub
  • wasmtime-wasi, rust>= 37.0.0, < 45.0.3GitHub
  • wasmtime-wasi, rust>= 46.0.0, < 46.0.1GitHub
  • wasmtimeaffected: < 24.0.11CVE List
  • wasmtimeaffected: >= 25.0.0, < 36.0.12CVE List
  • wasmtimeaffected: >= 37.0.0, < 45.0.3CVE List
  • wasmtimeaffected: >= 46.0.0, < 46.0.1CVE List
  • wasmtime-wasi, crates.iofrom first release, fixed in 24.0.11OSV
  • wasmtime-wasi, crates.iofrom 25.0.0, fixed in 36.0.12OSV
  • wasmtime-wasi, crates.iofrom 37.0.0, fixed in 45.0.3OSV
  • wasmtime-wasi, crates.iofrom 46.0.0, fixed in 46.0.1OSV

References 13