Summary
A path traversal vulnerability in oc-mirror's operator catalog image extraction can cause archive entries to be written outside the intended destination directory. An attacker who can provide or influence a catalog image layer may overwrite arbitrary files accessible to the mirroring process.
Affected context
The issue occurs when oc-mirror extracts operator catalog image layers through either the legacy v1 workflow or the OCI feature workflow. Risk depends on whether an attacker can influence the catalog image or its layers and whether the extraction process has write access beyond its intended working directory.
Exploit preconditions
- Attack surface: Operator catalog image extraction during mirroring
- Required access: Ability to provide or influence a catalog image layer, directly or through a trusted image source
- Trigger point: Extraction of tar archive entries from catalog image layers
- Why exploitation is possible: Archive paths are not sufficiently validated to ensure that resolved destinations remain within the designated extraction directory
Why this happens
The vulnerability results from treating archive entry names as safe filesystem paths without canonicalizing them and enforcing destination containment. Path components that refer outside the extraction directory can therefore redirect writes to unintended locations, matching CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
Potential impact
- Arbitrary files may be overwritten by the mirroring process
- Local configuration or operational data could be modified
- The mirroring workflow could be disrupted
- Security controls or executable files may be altered if writable by the process
- Follow-on compromise could occur depending on permissions and the affected environment
General mitigation guidance
Mitigation generally focuses on treating archive contents as untrusted and enforcing strict extraction boundaries.
Common defensive patterns include:
- Canonicalizing each archive entry before writing it
- Rejecting absolute paths and traversal components
- Verifying that the resolved destination remains within the intended extraction directory
- Handling symbolic links and hard links conservatively during extraction
- Using a dedicated, minimally privileged workspace for catalog processing
- Restricting catalog image sources and reducing trust in externally supplied image content
- Applying least-privilege filesystem permissions and isolation around mirroring jobs
How teams detect issues like this
Organizations can detect path traversal risks through:
- Static analysis for archive extraction APIs that write entries without containment checks
- Code review signals involving path joins, archive filenames, and symbolic-link handling
- Tests using absolute paths, parent-directory components, and link-based archive entries
- Policy checks requiring canonical-path validation before filesystem writes
- Runtime monitoring for unexpected writes outside designated mirroring workspaces
Automated security scanning and code review tools may help identify missing archive-boundary validation.

