Path traversal in Gleam via unvalidated package application names
Gleam
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Gleam Gleam |
| No fix yet |
| Gleam Gleam |
Gleam
| Product | Affected | Fixed in |
|---|---|---|
| Gleam Gleam |
| No fix yet |
| Gleam Gleam |
≥ 0.32.4 · < 1.19.2| No fix yet |
| Gleam Gleam |
| No fix yet |
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in gleam-lang gleam allows a malicious package publisher to delete a directory outside the project's build directory when a developer builds a project.
A Hex package release's metadata carries an app field with the release's OTP application name. Gleam reads this field from the hex.pm release API when it downloads dependencies and uses it as the package's build directory name without validating it (hex_manifest_package in compiler-cli/src/dependencies.rs, ProjectPaths::build_directory_for_package). When a dependency fails to compile, Gleam deletes that directory with remove_dir_all. hex.pm didn't restrict the field to a directory name before 2026-10-12, so a publisher could set it to a value such as ../../../../target or an absolute path. When a project depends on such a release directly or transitively and the release fails to compile, gleam build, gleam check, gleam run, gleam test or gleam export deletes the directory the name resolves to. For a pure Gleam package no publisher code runs.
This issue affects gleam: from 0.32.4 before 1.19.2.
From the CVE record · EEF
Gleam uses an unvalidated package metadata field as a dependency build directory name. A malicious package publisher can set it to a path outside the project's build directory, causing Gleam to delete that directory if the dependency fails to compile. This requires a developer to build, check, run, test, or export a project that depends directly or transitively on the malicious release.
Developers using Gleam versions 0.32.4 through versions before 1.19.2 should check their installations.