{"id":"CVE-2026-47261","aliases":["CVE-2026-47261","GHSA-2r75-cxrj-cmph","RUSTSEC-2026-0149"],"related":[],"kind":"vulnerability","state":"published","title":"Wasmtime: WASI path_open(TRUNCATE) bypasses `FilePerms::WRITE` host restriction","summary":"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 path_open 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::open_at, lines 967–969) did not set open_mode |= 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 ERRNO_PERM 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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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 path_open 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::open_at, lines 967–969) did not set open_mode |= 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 ERRNO_PERM 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.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nIn `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 `path_open` interfaces by opening a file with `OpenFlags::TRUNCATE` oflag only, for example:\n\n```rust\ndir_descriptor.open_at(\n   PathFlags::empty(),\n   FILENAME,\n   OpenFlags::TRUNCATE,\n   DescriptorFlags::READ,\n)\n```\n\n```rust\nwasip1::path_open(\n    dir_fd,\n    0,\n    FILENAME,\n    wasip1::OFLAGS_TRUNC,\n    wasip1::RIGHTS_FD_READ,\n    0,\n    0\n)\n```\n\nThe root cause is that the clause that considered `OpenFlags::TRUNCATE` did not set `open_mode |= 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 `path_open` fail with `error-code.not-permitted` and `ERRNO_PERM` respectively.\n\nThe bug in `crates/wasi/src/filesystem.rs`, `Dir::open_at`, lines 967–969:\n\n```rust\nif oflags.contains(OpenFlags::TRUNCATE) {\n    opts.truncate(true).write(true);\n}\n```\nand the single line fix is:\n```rust\nif oflags.contains(OpenFlags::TRUNCATE) {\n    opts.truncate(true).write(true);\n    open_mode |= OpenMode::WRITE;\n}\n```\n\nOnly 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`:\n```rust\nbuilder.preopened_dir(\"readonly\", \"readonly\", DirPerms::READ | DirPerms::MUTATE, FilePerms::READ);\n```\n\nIn particular, the Wasmtime project's `wasmtime-cli`'s use of wasmtime-wasi is not affected, because it always sets `FilePerms::all()` for all preopens.","format":"markdown","source":"ghsa"},{"lang":"en","text":"This is an entry in the RustSec database for the Wasmtime security advisory\nlocated at\nhttps://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-2r75-cxrj-cmph\nFor more information see the GitHub-hosted security advisory.","format":"markdown","source":"rustsec"},{"lang":"es","text":"Wasmtime es un entorno de ejecución para WebAssembly. En versiones anteriores a la 24.0.9, 36.0.10 y 44.0.2, cuando a una preapertura del sistema de archivos se le otorgan DirPerms::all() y FilePerms::READ sin FilePerms::WRITE, este mecanismo de control de acceso puede ser eludido a través de las interfaces wasip2 descriptor.open-at o wasip1 path_open abriendo un archivo con solo el indicador OpenFlags::TRUNCATE. La causa raíz es que la cláusula que maneja OpenFlags::TRUNCATE en crates/wasi/src/filesystem.rs (Dir::open_at, líneas 967-969) no estableció open_mode |= OpenMode::WRITE;, lo cual se usa posteriormente para la verificación de control de acceso contra FilePerms para determinar si se permite abrir el archivo; la corrección de una sola línea añade esa asignación faltante, después de lo cual las llamadas afectadas fallan correctamente con error-code.not-permitted y ERRNO_PERM respectivamente. Solo las incrustaciones de wasmtime-wasi que combinan DirPerms::MUTATE con FilePerms::READ se ven afectadas por este error. En particular, el uso de wasmtime-wasi por parte de wasmtime-cli del proyecto Wasmtime no se ve afectado, porque siempre establece FilePerms::all() para todas las preaperturas. Este problema ha sido solucionado en las versiones 24.0.9, 36.0.10 y44.0.2.","source":"nvd"}],"published":"2026-05-21T12:00:00.000Z","modified":"2026-10-25T23:10:00.167Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},{"scorer":"RustSec Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-284"],"affected":[{"ranges":[{"version":">= 37.0.0, < 44.0.2","status":"affected"},{"version":">= 25.0.0, < 36.0.10","status":"affected"},{"version":"< 24.0.9","status":"affected"}],"vendor":"bytecodealliance","product":"wasmtime","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"37.0.0","status":"affected","fixed":"44.0.2"}],"ecosystem":"crates.io","package":"wasmtime-wasi","purl":"pkg:cargo/wasmtime-wasi","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"25.0.0","status":"affected","fixed":"36.0.10"}],"ecosystem":"crates.io","package":"wasmtime-wasi","purl":"pkg:cargo/wasmtime-wasi","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"24.0.9"}],"ecosystem":"crates.io","package":"wasmtime-wasi","purl":"pkg:cargo/wasmtime-wasi","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"24.0.9"},{"type":"semver","introduced":"25.0.0","status":"affected","fixed":"36.0.10"},{"type":"semver","introduced":"37.0.0","status":"affected","fixed":"44.0.2"},{"type":"semver","introduced":"45.0.0","status":"affected","fixed":"45.0.0"}],"ecosystem":"crates.io","package":"wasmtime-wasi","purl":"pkg:cargo/wasmtime-wasi","source":"rustsec"},{"ranges":[{"status":"affected","fixed":"24.0.9"},{"status":"affected","introduced":"25.0.0","fixed":"36.0.10"},{"status":"affected","introduced":"37.0.0","fixed":"44.0.2"}],"vendor":"bytecodealliance","product":"wasmtime","cpe":"cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:*","source":"nvd"}],"references":[{"url":"https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-2r75-cxrj-cmph","tags":["mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/bytecodealliance/wasmtime/releases/tag/v24.0.9","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/bytecodealliance/wasmtime/releases/tag/v36.0.10","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/bytecodealliance/wasmtime/releases/tag/v44.0.2","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/bytecodealliance/wasmtime/releases/tag/v45.0.0","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47261","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/bytecodealliance/wasmtime","tags":["package"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0149.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/wasmtime-wasi","tags":["package"],"sources":["rustsec"]},{"url":"https://github.com/bytecodealliance/wasmtime/pull/13429","tags":["web"],"sources":["rustsec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-06-16T12:45:55.792Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-47261","url":"https://www.cve.org/CVERecord?id=CVE-2026-47261","licence":"CVE Terms of Use","modified":"2026-06-16T12:46:04.260Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-2r75-cxrj-cmph","url":"https://github.com/advisories/GHSA-2r75-cxrj-cmph","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:07.520Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0149","url":"https://rustsec.org/advisories/RUSTSEC-2026-0149.html","licence":"CC0-1.0","modified":"2026-10-12T18:00:09.236Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-47261","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47261","licence":"Public domain","modified":"2026-10-25T23:10:00.167Z"}],"updatedAt":"2026-11-25T22:59:24.694Z","epss":{"score":0.00357,"percentile":0.31485,"date":"2026-12-01T12:00:22.000Z"}}