Path traversal in Gleam via unvalidated package application names
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.
CVE-2026-103061
Primary source · Revision 1
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: cve:CVE-2026-103061
Gleam
Source reference: /containers/cna/affected/0/product
- Affected versions
- Not stated in this record
- Fixed versions
- Not stated in this record
- Prerequisites
- Not stated in this record
Gleam
Source reference: /containers/cna/affected/1/product
- Affected versions
- Not stated in this record
- Fixed versions
- Not stated in this record
- Prerequisites
- Not stated in this record
Gleam
Source reference: /containers/cna/affected/2/product
- Affected versions
- Not stated in this record
- Fixed versions
- Not stated in this record
- Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"cpes": [
"cpe:2.3:a:gleam-lang:gleam:*:*:*:*:*:*:*:*"
],
"vendor": "Gleam",
"modules": [
"gleam_cli::dependencies",
"gleam_core::manifest",
"gleam_core::paths",
"gleam_core::build::project_compiler",
"gleam_cli::fs"
],
"product": "Gleam",
"versions": [
{
"status": "affected",
"version": "0.32.4",
"lessThan": "1.19.2",
"versionType": "semver"
}
],
"packageURL": "pkg:software-id/gleam.run/gleam",
"packageName": "gleam",
"programFiles": [
"compiler-cli/src/dependencies.rs",
"compiler-core/src/manifest.rs",
"compiler-core/src/paths.rs",
"compiler-core/src/build/project_compiler.rs",
"compiler-cli/src/fs.rs"
],
"defaultStatus": "unaffected",
"programRoutines": [
{
"name": "gleam_cli::dependencies::hex_manifest_package"
},
{
"name": "gleam_core::manifest::ManifestPackage::application_name"
},
{
"name": "gleam_core::paths::ProjectPaths::build_directory_for_package"
},
{
"name": "gleam_core::build::project_compiler::ProjectCompiler::load_cache_or_compile_package"
},
{
"name": "gleam_cli::fs::delete_directory"
}
]
},
{
"cpes": [
"cpe:2.3:a:gleam-lang:gleam:*:*:*:*:*:*:*:*"
],
"vendor": "Gleam",
"modules": [
"gleam_cli::dependencies",
"gleam_core::manifest",
"gleam_core::paths",
"gleam_core::build::project_compiler",
"gleam_cli::fs"
],
"product": "Gleam",
"versions": [
{
"status": "affected",
"version": "v0.32.4-elixir",
"lessThan": "v1.19.2-elixir",
"versionType": "other"
},
{
"status": "affected",
"version": "v0.32.4-erlang",
"lessThan": "v1.19.2-erlang",
"versionType": "other"
},
{
"status": "affected",
"version": "v0.32.4-node",
"lessThan": "v1.19.2-node",
"versionType": "other"
},
{
"status": "affected",
"version": "v0.32.4-node-slim",
"lessThan": "v1.19.2-node-slim",
"versionType": "other"
},
{
"status": "affected",
"version": "v0.32.4-elixir-slim",
"lessThan": "v1.19.2-elixir-slim",
"versionType": "other"
},
{
"status": "affected",
"version": "v0.32.4-erlang-slim",
"lessThan": "v1.19.2-erlang-slim",
"versionType": "other"
},
{
"status": "affected",
"version": "v0.32.4-erlang-alpine",
"lessThan": "v1.19.2-erlang-alpine",
"versionType": "other"
},
{
"status": "affected",
"version": "v0.32.4-elixir-alpine",
"lessThan": "v1.19.2-elixir-alpine",
"versionType": "other"
},
{
"status": "affected",
"version": "v0.32.4-node-alpine",
"lessThan": "v1.19.2-node-alpine",
"versionType": "other"
},
{
"status": "affected",
"version": "v0.32.4-scratch",
"lessThan": "v1.19.2-scratch",
"versionType": "other"
}
],
"packageURL": "pkg:oci/gleam?repository_url=ghcr.io%2Fgleam-lang",
"packageName": "gleam-lang/gleam",
"programFiles": [
"compiler-cli/src/dependencies.rs",
"compiler-core/src/manifest.rs",
"compiler-core/src/paths.rs",
"compiler-core/src/build/project_compiler.rs",
"compiler-cli/src/fs.rs"
],
"collectionURL": "https://ghcr.io",
"defaultStatus": "unaffected",
"programRoutines": [
{
"name": "gleam_cli::dependencies::hex_manifest_package"
},
{
"name": "gleam_core::manifest::ManifestPackage::application_name"
},
{
"name": "gleam_core::paths::ProjectPaths::build_directory_for_package"
},
{
"name": "gleam_core::build::project_compiler::ProjectCompiler::load_cache_or_compile_package"
},
{
"name": "gleam_cli::fs::delete_directory"
}
]
},
{
"cpes": [
"cpe:2.3:a:gleam-lang:gleam:*:*:*:*:*:*:*:*"
],
"repo": "https://github.com/gleam-lang/gleam",
"vendor": "Gleam",
"modules": [
"gleam_cli::dependencies",
"gleam_core::manifest",
"gleam_core::paths",
"gleam_core::build::project_compiler",
"gleam_cli::fs"
],
"product": "Gleam",
"versions": [
{
"status": "affected",
"changes": [
{
"at": "d15c981fac6e533d70ac8ee89a6ef4dbf139adc3",
"status": "unaffected"
},
{
"at": "54bbb2b98af1505b6eed93c45b1936fc76412e5c",
"status": "unaffected"
}
],
"version": "d13f27ee80aae7a521d2e9433c4deaf53f892574",
"lessThan": "*",
"versionType": "git"
}
],
"packageURL": "pkg:github/gleam-lang/gleam",
"packageName": "gleam-lang/gleam",
"programFiles": [
"compiler-cli/src/dependencies.rs",
"compiler-core/src/manifest.rs",
"compiler-core/src/paths.rs",
"compiler-core/src/build/project_compiler.rs",
"compiler-cli/src/fs.rs"
],
"collectionURL": "https://github.com",
"defaultStatus": "unaffected",
"programRoutines": [
{
"name": "gleam_cli::dependencies::hex_manifest_package"
},
{
"name": "gleam_core::manifest::ManifestPackage::application_name"
},
{
"name": "gleam_core::paths::ProjectPaths::build_directory_for_package"
},
{
"name": "gleam_core::build::project_compiler::ProjectCompiler::load_cache_or_compile_package"
},
{
"name": "gleam_cli::fs::delete_directory"
}
]
}
]- Related CVEs
- CVE-2026-103061
Source reference:
/cveMetadata/cveId
Publisher severity
medium
Source reference: /containers/cna/metrics
- Event
- #32887 · Revision 1
- Added to Heist Feed
- Publisher date