Am I affected?

type your gleam.run/gleam version to check

Description

Insufficient Verification of Data Authenticity vulnerability in Gleam allows an adversary in the middle to substitute forged Hex package contents during dependency resolution.

During dependency resolution Gleam fetches package metadata from the signature-verified Hex repository, which covers each release's dependency requirements and SHA-256 outer_checksum. After resolving versions, gleam_cli::dependencies::lookup_package makes a second request to the unsigned Hex API through gleam_core::hex::get_package_release and records the outer_checksum and dependency names from that JSON response into manifest.toml, instead of the values from the verified repository metadata. The Hex repository signature does not cover the API response.

An adversary in the middle who can intercept TLS with a certificate trusted by the Gleam process (for example a TLS-inspecting proxy using a CA in the operating system trust store or added through GLEAM_CACERTS_PATH), and who can modify both the API release response and the corresponding repository tarball, can supply a package archive with a matching forged checksum without the Hex repository signing key. Gleam verifies the forged tarball against the forged checksum, accepts it, and extracts it as a dependency source, resulting in loss of integrity of the downloaded package contents.

Only projects that resolve or update Hex dependencies are affected, which happens when the manifest is missing, a dependency is added or updated, or dependency requirements change. Builds that reuse an unchanged, known-good manifest.toml continue to verify tarballs against its pinned checksum. This issue affects gleam: from 0.18.0 before 1.18.0.

Weaknesses & attack patterns

Weakness

CWE-345 · Insufficient Verification of Data Authenticity in catalog → MITRE ↗

Attack patterns

CAPEC-94 · Adversary in the Middle (AiTM) MITRE ↗
CAPEC-185 · Malicious Software Download MITRE ↗

Affected — Gleam Repository ↗

0.18.0 < 1.18.0 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:gleam-lang:gleam:*:*:*:*:*:*:*:*
modules · source files · routines
modules gleam_cli::dependencies · gleam_cli::dependencies::dependency_manager
source files compiler-cli/src/dependencies.rs · compiler-cli/src/dependencies/dependency_manager.rs
routines gleam_cli::dependencies::lookup_package · gleam_cli::dependencies::dependency_manager::DependencyManager::perform_version_resolution

Affected — GitHub / gleam-lang/gleam Repository ↗

0.18.0 < 1.18.0 affected
8447b78 < c9c0d48 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:gleam-lang:gleam:*:*:*:*:*:*:*:*
modules · source files · routines
modules gleam_cli::dependencies · gleam_cli::dependencies::dependency_manager
source files compiler-cli/src/dependencies.rs · compiler-cli/src/dependencies/dependency_manager.rs
routines gleam_cli::dependencies::lookup_package · gleam_cli::dependencies::dependency_manager::DependencyManager::perform_version_resolution

Affected — ghcr.io / gleam-lang/gleam Container registry ↗

v0.18.0-elixir < v1.18.0-elixir affected
v0.18.0-elixir-slim < v1.18.0-elixir-slim affected
v0.18.0-elixir-alpine < v1.18.0-elixir-alpine affected
v0.18.0-erlang < v1.18.0-erlang affected
v0.18.0-erlang-slim < v1.18.0-erlang-slim affected
v0.18.0-erlang-alpine < v1.18.0-erlang-alpine affected
v0.18.0-node < v1.18.0-node affected
v0.18.0-node-slim < v1.18.0-node-slim affected
v0.18.0-node-alpine < v1.18.0-node-alpine affected
v1.6.0-scratch < v1.18.0-scratch affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:gleam-lang:gleam:*:*:*:*:*:*:*:*
modules · source files · routines
modules gleam_cli::dependencies · gleam_cli::dependencies::dependency_manager
source files compiler-cli/src/dependencies.rs · compiler-cli/src/dependencies/dependency_manager.rs
routines gleam_cli::dependencies::lookup_package · gleam_cli::dependencies::dependency_manager::DependencyManager::perform_version_resolution

References

Credits

John Downey Finder Remediation developer
Louis Pilfold Remediation reviewer

CVSS breakdown

CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
« All CVEs