CVE-2026-42795
JSON

5.1medium

Symlink Following in Hex Package Export Allows Embedding Files Outside Project Root

Severity
5.1medium CVSS:4.0 by EEF
Exploit likelihood
0.24% (higher than 16% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
EEF
Also known as
EEF-CVE-2026-42795GHSA-qhh5-fg4c-8gqc

Description

Symlink following vulnerability in Gleam's Hex package export allows files outside the project root to be embedded in the generated package tarball. The 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. An 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. This issue affects gleam: from 0.10.0-rc1 before 1.17.0.

Affected

Product or packageVersionsReported by
gleam-lang/gleamfrom v0.10.0-rc1-elixir before v1.17.0-elixir, from v0.10.0-rc1-erlang before v1.17.0-erlang, from v0.10.0-rc1-node before v1.17.0-node, from v0.10.0-rc1-node-slim before v1.17.0-node-slim, from v0.10.0-rc1-elixir-slim before v1.17.0-elixir-slim, from v0.10.0-rc1-erlang-slim before v1.17.0-erlang-slim, from v0.10.0-rc1-erlang-alpine before v1.17.0-erlang-alpine, from v0.10.0-rc1-elixir-alpine before v1.17.0-elixir-alpine and 3 moreCVE List
gleamfrom 0.10.0-rc1 before 1.17.0CVE List
https://github.com/gleam-lang/gleamfrom c82a2d83bd0c06cafdc196820deb3f89a9b3ff7c before 6435a5528b9ae0449e2f32be579641ec485f6866Erlang Ecosystem Foundation

All scores

EEF5.1medium CVSS:4.0CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
Erlang Ecosystem FoundationNot scored CVSS:4.0CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

Classification

CWE-59

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

What each source says

CVE List

Symlink following vulnerability in Gleam's Hex package export allows files outside the project root to be embedded in the generated package tarball. The 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. An 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. This issue affects gleam: from 0.10.0-rc1 before 1.17.0.

Erlang Ecosystem Foundation

Summary

Symlink following vulnerability in Gleam's Hex package export allows files outside the project root to be embedded in the generated package tarball.

The 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.

An 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.

This issue affects gleam: from 0.10.0-rc1 before 1.17.0.

Workarounds

  • 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)
NVD (es)

Una vulnerabilidad de seguimiento de enlaces simbólicos en la exportación de paquetes Hex de Gleam permite que archivos fuera de la raíz del proyecto sean incrustados en el tarball del paquete generado. Los ayudantes de recolección de archivos (gleam_files, native_files, private_files) en compiler-cli/src/fs.rs usan follow_links(true) al recorrer directorios publicables como src/ y priv/. Las rutas recolectadas se añaden al archivo del paquete a través de add_path_to_tar en compiler-cli/src/publish.rs sin verificar que el objetivo resuelto permanezca dentro de la raíz del proyecto. Un enlace simbólico colocado bajo un directorio publicable hará que gleam export hex-tarball o gleam publish incrusten el contenido del objetivo del enlace simbólico en el paquete Hex generado. Un atacante con acceso de escritura al repositorio del proyecto puede colocar un enlace simbólico en src/ o priv/ apuntando a un archivo arbitrario. Cuando un mantenedor o una tubería de CI ejecuta gleam publish o gleam export hex-tarball, los archivos locales legibles por el publicador (como secretos, tokens o claves SSH) son incrustados silenciosamente en el artefacto del paquete publicado. Este problema afecta a Gleam desde 0.10.0-rc1 hasta 1.17.0.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-42795 changed 2026-11-20CVE Terms of Use
Erlang Ecosystem FoundationEEF-CVE-2026-42795 changed 2026-11-25CC-BY-4.0
NVDCVE-2026-42795 changed 2026-11-20Public domain