{"id":"CVE-2026-42795","published":"2026-06-02T13:41:39Z","modified":"2026-11-20T05:59:25Z","title":"Symlink Following in Hex Package Export Allows Embedding Files Outside Project Root","vendor":"Gleam","product":"Gleam","tier":"tail","description":{"text":"Symlink following vulnerability in Gleam's Hex package export allows files outside the project root to be embedded in the generated package tarball.\n\nThe file collection helpers (gleam_files, native_files, private_files) in compiler-cli/src/fs.rs use follow_links(true) when walking publishable directories such as src/ and priv/. The collected paths are added to the package archive via add_path_to_tar in compiler-cli/src/publish.rs without verifying that the resolved target remains within the project root. A symlink placed under a publishable directory will cause gleam export hex-tarball or gleam publish to embed the contents of the symlink target into the generated Hex package.\n\nAn attacker with write access to the project repository can place a symlink in src/ or priv/ pointing to an arbitrary file. When a maintainer or CI pipeline runs gleam publish or gleam export hex-tarball, local files readable by the publisher (such as secrets, tokens, or SSH keys) are silently embedded into the published package artifact.\n\nThis issue affects gleam: from 0.10.0-rc1 before 1.17.0.","provenance":"source","from":"CVE.org"},"cvss":{"score":5.1,"severity":"MEDIUM","version":"4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00199,"percentile":0.09926,"provenance":"source"},"cwes":[{"id":"CWE-59","name":"Improper Link Resolution Before File Access"}],"references":[{"url":"https://github.com/gleam-lang/gleam/security/advisories/GHSA-qhh5-fg4c-8gqc","tags":["vendor-advisory","related"]},{"url":"https://cna.erlef.org/cves/CVE-2026-42795.html","tags":["related"]},{"url":"https://osv.dev/vulnerability/EEF-CVE-2026-42795","tags":["related"]},{"url":"https://github.com/gleam-lang/gleam/commit/c82a2d83bd0c06cafdc196820deb3f89a9b3ff7c","tags":["related"]},{"url":"https://github.com/gleam-lang/gleam/commit/6435a5528b9ae0449e2f32be579641ec485f6866","tags":["patch"]}],"priority":{"score":5.6,"factors":[{"name":"EPSS percentile","points":1.99},{"name":"CVSS severity","points":3.57}]},"vendorSlug":"gleam","affectedVersions":[{"vendor":"Gleam","product":"Gleam","versions":[">= v0.10.0-rc1-elixir, < v1.17.0-elixir",">= v0.10.0-rc1-erlang, < v1.17.0-erlang",">= v0.10.0-rc1-node, < v1.17.0-node",">= v0.10.0-rc1-node-slim, < v1.17.0-node-slim",">= v0.10.0-rc1-elixir-slim, < v1.17.0-elixir-slim",">= v0.10.0-rc1-erlang-slim, < v1.17.0-erlang-slim",">= v0.10.0-rc1-erlang-alpine, < v1.17.0-erlang-alpine",">= v0.10.0-rc1-elixir-alpine, < v1.17.0-elixir-alpine",">= v0.10.0-rc1-node-alpine, < v1.17.0-node-alpine",">= v0.10.0-rc1-scratch, < v1.17.0-scratch"]},{"vendor":"Gleam","product":"Gleam","versions":[">= 0.10.0-rc1, < 1.17.0"]},{"vendor":"Gleam","product":"Gleam","versions":[">= c82a2d83bd0c06cafdc196820deb3f89a9b3ff7c, < 6435a5528b9ae0449e2f32be579641ec485f6866"]}],"workarounds":{"items":["* Avoid running gleam publish or gleam export hex-tarball on untrusted projects * Review the contents of src/ and priv/ for unexpected symlinks before publishing * Run publishing commands in a restricted or isolated environment (e.g. containers)"],"from":"CVE.org CNA","provenance":"source"},"capec":[{"id":"CAPEC-132","name":"Symlink Attack"}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"partial","timestamp":"2026-06-02T15:04:06.195456Z","from":"CISA ADP","provenance":"source"},"euvd":{"id":"EUVD-2026-33928","exploited":false,"provenance":"source"}}