Skip to main content
Menu
Advisories

Bubblewrap runner plants absolute symlinks from build layers, letting a package hardlink reach host files

GHSA-MWC9-VC42-CGJJPublished Updated GitHub

Description

When melange builds with the bubblewrap runner (the default on Linux), LoadImage extracts the build environment's layers onto the host. The symlink handling checked a cleaned path but created the link with the raw target, so an absolute symlink target was planted unchanged. A package hardlink whose target runs through that symlink then linked a host file into the guest root. The guest root is mounted read-write inside the sandbox, so build steps could read or modify that host file.

Preconditions

A crafted package, signed by a key the build trusts, in the build environment (for example, from a compromised repository, or from a config that adds its own repositories and keyring). The target file must be on the same filesystem as $TMPDIR and linkable by melange's user. The Docker and QEMU runners are not affected. Library callers that pass untrusted layers to the exported LoadImage are affected directly.

Patches

Fixed in v0.66.1 (#2773), which extracts layers through os.Root and fails the build on any entry that escapes the guest root.

Workarounds

Use the QEMU or Docker runner.

Affected versions

References

GitHub · chainguard-dev/melange