Skip to content

v0.2.1

Latest

Choose a tag to compare

@saracen saracen released this 16 Nov 14:07

Security

Extraction is now contained within the chroot. Extractor.Extract previously
checked entry paths lexically and then wrote through path-based os calls,
which follow a directory symbolic link already present under the chroot. A
link left by an earlier extraction, or present in a shared destination,
redirected later entries outside of the chroot without an error.

Every filesystem operation is now performed relative to the chroot through an
os.Root. An entry whose path passes through a link that leads outside of the
chroot fails with an error wrapping the new ErrSymlinkEscapesChroot, and a
link found where an entry is to be extracted is replaced by the entry.

Advisory: GHSA-8gwq-33fg-g56p (CVE pending). Reported by @real-kicktheball and
@jamesb5959. Thank you both.

Changes

  • github.com/klauspost/compress updated from v1.18.0 to v1.18.7. v1.18.0 is in range
    for CVE-2026-63209 in compress/s2, which fastzip does not use, but the alert
    is raised against any module graph whose only requirement on compress comes
    from fastzip.
  • New WithExtractorSymlinkPolicy option. The default, SymlinkPolicyPreserve,
    creates symbolic link entries as stored. SymlinkPolicyContain rejects links
    whose target is absolute or resolves outside of the chroot, including through
    links already on disk, for callers that need a self-contained tree.
  • Extract creates the chroot directory if it does not exist. This was already
    the behaviour, and is now documented.
  • A directory entry extracted where a regular file exists replaces the file.
    Previously the file was kept and the directory's metadata applied to it.
  • The minimum supported Go version is 1.25, which is where os.Root gained
    Symlink, Chmod, Chtimes, Lchown and MkdirAll.

Notes

  • A symbolic link already on disk with an absolute target cannot be traversed,
    even when it points inside the chroot, because os.Root does not follow
    absolute links. Entries below such a link fail with ErrSymlinkEscapesChroot.
  • On Windows, a link entry whose target is absolute or outside of the chroot is
    created as a file link even when the target is a directory.
  • Resolving every path through os.Root costs a few extra syscalls and
    allocations per entry. Extraction throughput is within a few percent of
    v0.2.0 at low concurrency and 10 to 20 percent lower at higher concurrency
    in the bundled benchmarks.