Описание
Container and Containerization archive extraction does not guard against escapes from extraction base directory.
Summary
The ArchiveReader.extractContents() function used by cctl image load and container image load performs no pathname validation before extracting an archive member. This means that a carelessly or maliciously constructed archive can extract a file into any user-writable location on the system using relative pathnames.
Details
The code in question is: https://github.com/apple/containerization/blob/main/Sources/ContainerizationArchive/Reader.swift#L180.
PoC
Sample script make-evil-tar.py:
Impact
Affects users of cctl image load in the containerization project, and any projects that depend on containerization and use the extractContent() function.
Affects users of container image load in the container project.
These operations can extract a file into any user-writable location on the system using carefully chosen pathnames. This advisory is not a privilege escalation, the affected files can only be written to already user-writable locations.
Пакеты
github.com/apple/containerization
<= 0.20.1
0.21.0
github.com/apple/container
<= 0.7.1
0.8.0
Связанные уязвимости
The ArchiveReader.extractContents() function used by cctl image load and container image load performs no pathname validation before extracting an archive member. This means that a carelessly or maliciously constructed archive can extract a file into any user-writable location on the system using relative pathnames. This issue is addressed in container 0.8.0 and containerization 0.21.0.