CVE-2026-58494
JSON

6.5medium

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

Severity
6.5medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.12% (higher than 1% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-4ch3-9j33-3pmjRUSTSEC-2026-0188

Description

Wasmtime is a runtime for WebAssembly. Prior to 24.0.11, 36.0.12, 45.0.3, and 46.0.1, wasmtime-wasi hard-link creation and renaming check directory permissions but not matching FilePerms on source and destination preopens, allowing a WASI guest with a read-only source file capability to overwrite host files exposed as FilePerms::READ through wasip1, wasip2, or wasip3 filesystem interfaces. This issue is fixed in versions 24.0.11, 36.0.12, 45.0.3, and 46.0.1.

Affected

Product or packageVersionsReported by
bytecodealliance wasmtime< 24.0.11, >= 25.0.0, < 36.0.12, >= 37.0.0, < 45.0.3, >= 46.0.0, < 46.0.1CVE List
wasmtime-wasi (crates.io)before 24.0.11, from 25.0.0 before 36.0.12, from 37.0.0 before 45.0.3, from 46.0.0 before 46.0.1, from 0.0.0-0 before 24.0.11GitHub Advisory Database, RustSec Advisory Database

All scores

GitHub_M6.5medium CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N
GitHub6.5medium CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N
RustSec Advisory Database6.5medium CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N

Classification

CWE-281CWE-863

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

Wasmtime is a runtime for WebAssembly. Prior to 24.0.11, 36.0.12, 45.0.3, and 46.0.1, wasmtime-wasi hard-link creation and renaming check directory permissions but not matching FilePerms on source and destination preopens, allowing a WASI guest with a read-only source file capability to overwrite host files exposed as FilePerms::READ through wasip1, wasip2, or wasip3 filesystem interfaces. This issue is fixed in versions 24.0.11, 36.0.12, 45.0.3, and 46.0.1.

GitHub Advisory Database

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.

RustSec Advisory Database

This is an entry in the RustSec database for the Wasmtime security advisory located at https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-4ch3-9j33-3pmj For more information see the GitHub-hosted security advisory.

NVD (es)

Wasmtime es un tiempo de ejecución para WebAssembly. Antes de las versiones 24.0.11, 36.0.12, 45.0.3 y 46.0.1, la creación y el renombramiento de enlaces duros de wasmtime-wasi comprueban los permisos de directorio, pero no los FilePerms coincidentes en las preaperturas de origen y destino, lo que permite a un invitado WASI con una capacidad de archivo de origen de solo lectura sobrescribir archivos del host expuestos como FilePerms::READ a través de las interfaces del sistema de archivos wasip1, wasip2 o wasip3. Este problema está solucionado en las versiones 24.0.11, 36.0.12, 45.0.3 y 46.0.1.

References

https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-4ch3-9j33-3pmjweb
https://github.com/bytecodealliance/wasmtime/commit/5ddfd5f1ef28f2041fa07d237ad0336e167b0e0cweb
https://github.com/bytecodealliance/wasmtime/commit/7db94cdcf0c79cb3dfde884b534b653f2dd83367web
https://github.com/bytecodealliance/wasmtime/commit/8a250aac0962ca1364b5f16525720e9d0b39edcdweb
https://github.com/bytecodealliance/wasmtime/commit/d3ceb56ec35f39e02496eeb4e2d9c7f4fb964d9eweb
https://github.com/bytecodealliance/wasmtime/releases/tag/v24.0.11web
https://github.com/bytecodealliance/wasmtime/releases/tag/v36.0.12web
https://github.com/bytecodealliance/wasmtime/releases/tag/v45.0.3web
https://github.com/bytecodealliance/wasmtime/releases/tag/v46.0.1web
https://nvd.nist.gov/vuln/detail/CVE-2026-58494advisory
https://github.com/bytecodealliance/wasmtime/pull/13725web
https://github.com/bytecodealliance/wasmtimepackage

Sources

SourceRecordLicence
CVE ListCVE-2026-58494 changed 2026-07-09CVE Terms of Use
GitHub Advisory DatabaseGHSA-4ch3-9j33-3pmj changed 2026-10-16CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2026-0188 changed 2026-10-12CC0-1.0
NVDCVE-2026-58494 changed 2026-10-25Public domain