GHSA-4ch3-9j33-3pmj CVE-2026-58494 RUSTSEC-2026-0188
Wasmtime: WASI hard links bypass wasmtime-wasi's FilePerms for destination
- Severity
- 6.5 / 10
- Medium · CVSS 3.1
- Exploit chance (EPSS)
- 0.17%
- Chance of exploitation in the next 30 days. Higher than 6.46% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Fix
24.0.11- Upgrade wasmtime-wasi to this version or later
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
targetexists in a preopen with only FilePerms::READ - a hardlink named
alias, with destination to thetarget, is created in a preopen with FilePerms::READ | FilePerms::WRITE - the attacker opens the file
aliasfor writing, in which they can overwritetarget
The same attack is possible by way of renaming:
- a read-only file
targetexists in a preopen with only FilePerms::READ - a hardlink named
alias, with destination to thetarget, is created in that same preopen - the
aliasfile is renamed into a preopen with FilePerms::READ | FilePerms::WRITE - the attacker opens the file
aliasfor writing, in which they can overwritetarget
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.
Affected versions
crates.io
| Package | Vulnerable | Fixed in |
|---|---|---|
| wasmtime-wasi | < 24.0.11 |
24.0.11 |
| wasmtime-wasi | >= 25.0.0, < 36.0.12 |
36.0.12 |
| wasmtime-wasi | >= 37.0.0, < 45.0.3 |
45.0.3 |
| wasmtime-wasi | >= 46.0.0, < 46.0.1 |
46.0.1 |
| wasmtime-wasi | >= 0.0.0-0, < 24.0.11>= 25.0.0, < 36.0.12>= 37.0.0, < 45.0.3>= 46.0.0, < 46.0.1 |
24.0.1136.0.1245.0.346.0.1 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
wasmtime-wasi crates.io → 24.0.11
- cargo
cargo update -p wasmtime-wasi --precise 24.0.11
Severity breakdown
CVSS 3.1 6.5
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N
- Attack vector
- Local
- Attack complexity
- Low
- Privileges required
- Low
- User interaction
- None
- Scope
- Changed
- Confidentiality
- None
- Integrity
- High
- Availability
- None
Weakness
CWE-281: Improper Preservation of Permissions
The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended.
CWE-863: Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.
How to prevent it
- Architecture and Design: Divide the product into anonymous, normal, privileged, and administrative areas. Reduce the attack surface by carefully mapping roles with data and functionality. Use role-based access control (RBAC) [REF-229] to enforce the roles at the appropriate boundaries. Note that this approach may not protect against horizontal authorization, i.e., it will not protect a user from attacking others with the same role.
- Architecture and Design: Ensure that access control checks are performed related to the business logic. These checks may be different than the access control checks that are applied to more generic resources such as files, connections, processes, memory, and database records. For example, a database may restrict access for medical records to a specific database user, but each record might only be intended to be accessible to the patient and the patient's doctor [REF-7].
- Architecture and Design: Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, consider using authorization frameworks such as the JAAS Authorization Framework [REF-233] and the OWASP ESAPI Access Control feature [REF-45].
- Architecture and Design: For web applications, make sure that the access control mechanism is enforced correctly at the server side on every page. Users should not be able to access any unauthorized functionality or information by simply requesting direct access to that page. One way to do this is to ensure that all pages containing sensitive information are not cached, and that all such pages restrict access to requests that are accompanied by an active and authenticated session token associated with a user who has the required permissions to access that page.
- System Configuration, Installation: Use the access control capabilities of your operating system and server environment and define your access control lists accordingly. Use a "default deny" policy when defining these ACLs.
References
Advisories
Packages
Other links
- github.com/bytecodealliance/wasmtime/security/advisories/GHSA-4ch3-9j33-3pmj
- github.com/bytecodealliance/wasmtime/pull/13725
- github.com/bytecodealliance/wasmtime/commit/5ddfd5f1ef28f2041fa07d237ad0336e167…
- github.com/bytecodealliance/wasmtime/commit/7db94cdcf0c79cb3dfde884b534b653f2dd…
- github.com/bytecodealliance/wasmtime/commit/8a250aac0962ca1364b5f16525720e9d0b3…
- github.com/bytecodealliance/wasmtime/commit/d3ceb56ec35f39e02496eeb4e2d9c7f4fb9…
- github.com/bytecodealliance/wasmtime/releases/tag/v24.0.11
- github.com/bytecodealliance/wasmtime/releases/tag/v36.0.12
- github.com/bytecodealliance/wasmtime/releases/tag/v45.0.3
- github.com/bytecodealliance/wasmtime/releases/tag/v46.0.1
- rustsec.org/advisories/RUSTSEC-2026-0188.html
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| RUSTSEC-2026-0420 wasip3 UDP `send` can deliver a datagram to an address only allowed for receiving | Medium | Also affects wasmtime-wasi |
| RUSTSEC-2026-0352 Filesystem sandbox escape when renaming symlinks with trailing slashes | Not rated yet | Also affects wasmtime-wasi |
| RUSTSEC-2026-0324 Guest can panic host through filesystem timestamp before the epoch on wasip3 | Medium | Also affects wasmtime-wasi |
| RUSTSEC-2026-0321 WASI preview 0 implementation of `poll_oneoff` circumvents fuel consumption | Medium | Also affects wasmtime-wasi |
| RUSTSEC-2026-0323 fd_readdir copies uninitialized struct padding into guest memory | Low | Also affects wasmtime-wasi |
| RUSTSEC-2026-0322 Excessive allocated memory on the host when guests don't have stdio | Medium | Also affects wasmtime-wasi |
| RUSTSEC-2026-0314 Guest can panic host through filesystem datetime overflow | Medium | Also affects wasmtime-wasi |
| GHSA-3p27-qvp9-27qf Wasmtime has a leak in WASIp1 `fd_renumber` implementation | Medium | Also affects wasmtime-wasi |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor