Summary
A path traversal flaw in ArchiveReader.extractContents(), used by cctl image load and container image load, allows archive entries to be extracted without validating their pathnames.
If an attacker supplies a crafted archive with malicious relative paths, files can be written to arbitrary user-writable locations on the host, potentially overwriting or planting files in sensitive directories.
Affected context
This vulnerability arises in environments where container images or archives are imported using cctl image load or similar container image load workflows.
The affected function, ArchiveReader.extractContents(), trusts the pathnames inside the archive and writes them directly to the filesystem without normalization or restriction.
The risk is most pronounced when archives originate from untrusted or semi-trusted sources, or when automated tooling imports images without manual inspection.
Exploit preconditions
- Attack surface: Archive or container image loading functionality (e.g.,
cctl image load, container image load). - Required access: Ability to supply or influence the archive/image being loaded, such as publishing a crafted image, providing an archive file, or man-in-the-middle of a distribution channel.
- Trigger point: Execution of the archive extraction routine, where ArchiveReader.extractContents() processes member paths from the archive.
- Why exploitation is possible: Member filenames from the archive are not normalized or validated, so path components like
../or absolute/relative paths are honored, allowing extraction outside the intended target directory into any user-writable path.
Why this happens
The core issue is a missing validation and normalization step for archive entry paths before writing them to the filesystem.
ArchiveReader.extractContents() treats archive member names as trustworthy and directly concatenates them with the output directory, without preventing directory traversal constructs, absolute paths, or other unsafe patterns.
This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where user-controlled path data can escape the intended extraction root and affect arbitrary paths within the scope of the running user's privileges.
Potential impact
- Overwriting existing files in user-writable locations, potentially altering configuration or runtime behavior.
- Planting new files in directories that are later executed or read by other processes, enabling local code or script execution in certain configurations.
- Tampering with application or user data, causing integrity loss or data corruption.
- Facilitating follow-on attacks if extracted files are consumed by other components that assume they are trustworthy.
General mitigation guidance
Effective mitigation focuses on constraining where files can be written during archive extraction and reducing trust in archive metadata:
- Normalize and sanitize archive member paths before extraction, rejecting entries that resolve outside the intended extraction root or contain path traversal tokens (e.g.,
../, absolute paths). - Enforce a strict extraction root and resolve the final destination path using canonical path resolution, aborting extraction if it escapes the designated directory.
- Implement allowlists for permissible paths or directory prefixes when handling archives from untrusted sources.
- Run archive processing components with least privilege, ensuring that the executing user has access only to a minimal set of directories.
- Treat externally sourced container images and archives as untrusted input, incorporating validation into the loading pipeline rather than assuming publisher correctness.
How teams detect issues like this
Organizations can detect and manage this class of issue through a combination of code-level and operational controls:
- Static analysis rules that flag uses of archive extraction APIs where member paths are written without normalization or checks against a fixed root directory.
- Code review checklists that explicitly call out archive and file extraction logic, requiring reviewers to verify path sanitization and canonicalization.
- Security tests or fuzzing that feed crafted archives with nested directories,
../segments, and absolute paths to confirm that extraction is constrained. - Policy enforcement in CI/CD pipelines that scans for custom archive-handling implementations and requires adherence to approved helper utilities or frameworks that implement safe extraction by default.

