CVE-2026-43965
Path Traversal in build/packages/packages.toml Allows Arbitrary Directory Deletion
Weakness Type (CWE)
CWE-22 — CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
CAPEC
Vulnerability description
Path traversal vulnerability in Gleam's dependency management allows arbitrary directory deletion via malicious build/packages/packages.toml content.
Package keys read from build/packages/packages.toml by LocalPackages::read_from_disc are passed without validation to paths.build_packages_package(), which constructs a filesystem path by joining the project build directory with the attacker-controlled key. The resulting path is then passed to fs::delete_directory (which calls remove_dir_all). No check is performed to ensure the path remains within the intended build/packages/ directory. Both absolute paths and relative traversal sequences (e.g. ../) are accepted as package keys, allowing deletion of arbitrary directories.
An attacker who can cause a victim to run gleam deps download on a project containing a malicious build/packages/packages.toml (e.g. by committing the normally-gitignored file to a repository) can cause arbitrary directories on the victim's system to be recursively deleted.
This issue affects Gleam from 0.18.0-rc1 until 1.17.0.
Affected
pkg:sid/gleam.run/gleam
| Module | Source File | Routine |
|---|---|---|
compiler-cli
|
compiler-cli/src/dependencies.rs
|
compiler_cli::dependencies::remove_extra_packages
|
compiler_cli::dependencies::LocalPackages::read_from_disc
|
||
compiler_cli::dependencies::LocalPackages::extra_local_packages
|
| Status | Type | Version | Changes / Fixed in |
|---|---|---|---|
| affected | semver ⓘ | 0.18.0-rc1
|
< 1.17.0
|
pkg:github/gleam-lang/gleam
| Module | Source File | Routine |
|---|---|---|
compiler-cli
|
compiler-cli/src/dependencies.rs
|
compiler_cli::dependencies::remove_extra_packages
|
compiler_cli::dependencies::LocalPackages::read_from_disc
|
||
compiler_cli::dependencies::LocalPackages::extra_local_packages
|
| Status | Type | Version | Changes / Fixed in |
|---|---|---|---|
| affected | semver ⓘ | 0.18.0-rc1
|
< 1.17.0
|
| affected | git ⓘ | ed7aec0484
|
< 690ca06981
|
pkg:oci/gleam
| Module | Source File | Routine |
|---|---|---|
compiler-cli
|
compiler-cli/src/dependencies.rs
|
compiler_cli::dependencies::remove_extra_packages
|
compiler_cli::dependencies::LocalPackages::read_from_disc
|
||
compiler_cli::dependencies::LocalPackages::extra_local_packages
|
| Status | Type | Version | Changes / Fixed in |
|---|---|---|---|
| affected | other | v0.18.0-rc1-elixir
|
< v1.17.0-elixir
|
| affected | other | v0.18.0-rc1-erlang
|
< v1.17.0-erlang
|
| affected | other | v0.18.0-rc1-node
|
< v1.17.0-node
|
| affected | other | v0.18.0-rc1-node-slim
|
< v1.17.0-node-slim
|
| affected | other | v0.18.0-rc1-elixir-slim
|
< v1.17.0-elixir-slim
|
| affected | other | v0.18.0-rc1-erlang-slim
|
< v1.17.0-erlang-slim
|
| affected | other | v0.18.0-rc1-erlang-alpine
|
< v1.17.0-erlang-alpine
|
| affected | other | v0.18.0-rc1-elixir-alpine
|
< v1.17.0-elixir-alpine
|
| affected | other | v0.18.0-rc1-node-alpine
|
< v1.17.0-node-alpine
|
| affected | other | v0.18.0-rc1-scratch
|
< v1.17.0-scratch
|
References
- https://github.com/gleam-lang/gleam/security/advisories/GHSA-jqvf-f6p2-wrv3 vendor-advisory related
- https://osv.dev/vulnerability/EEF-CVE-2026-43965 related
- https://github.com/gleam-lang/gleam/commit/690ca069817bee5f77a28fc3e360627c1da19291 patch
Credits
- Finder: Aly (spect3r1)
- Finder: Abdelrahman Ahmed Aboelkasem (0x2face)
- Remediation developer: Louis Pilfold
- Analyst: Jonatan Männchen / EEF
CVE record as JSON:
GET /cves/CVE-2026-43965.json
OSV record as JSON:
GET /osv/EEF-CVE-2026-43965.json