GHSA-hfg8-hc9c-6c3h: Path Traversal
Summary The tar extraction routines in moby/go-archive (Unpack, UnpackLayer, Untar/UntarUncompressed, and the ApplyLayer helpers) do not confine filesystem operations to the destination directory. A crafted archive can create or overwrite files outside the intended destination.
Details The extractor decides where each archive entry lands using lexical string checks and then performs the filesystem operation on a path that is resolved by the OS, so a links introduced by the archive can be followed out of the destination directory.
Impact An attacker who controls the contents of archive can create or overwrite files at arbitrary paths writable by the extracting process.
Workarounds Only extract trusted archives.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/moby/go-archiveto a version that resolves this vulnerability.Fixed in 0.3.0 - Compensating control
Only extract trusted archives, because archive contents can create or overwrite files outside the intended destination via path traversal/symlink escape during extraction.
Event History
Frequently Asked Questions
Which archive-extraction code paths should be included in an exposure review?
The affected extraction paths are Unpack, UnpackLayer, Untar, UntarUncompressed, and the ApplyLayer helpers in go/github.com/moby/go-archive. Teams should identify uses of any of these routines when assessing exposure.
What access does an attacker need, and what limits the resulting file writes?
Exploitation requires an attacker to control the archive contents. The attacker can create or overwrite paths only where the extracting process has write permission.
What can be done if patching is not immediately possible?
Only extract archives from trusted sources until a remediation is available. Archives supplied by untrusted users or external sources should not be processed by the affected routines.