CVE-2026-115424: Oc: oc: symlink/hardlink target validation bypass in oc image extract allows file write outside destination

Published Oct 21, 2026
·
Updated

A flaw was found in openshift/oc's local tar-extraction code used by oc image extract. The createTarFile() function in pkg/cli/image/archive/archive.go (oc's private fork of Docker/Moby's pkg/archive) validates that a symlink or hardlink target stays inside the extraction directory by computing targetPath := filepath.Join(filepath.Dir(path), hdr.Linkname) and testing strings.HasPrefix(targetPath, extractDir), but then creates the symlink using the raw, unvalidated hdr.Linkname via os.Symlink(hdr.Linkname, path). The check fails in two independent ways: for an absolute Linkname (e.g. /etc/passwd), Go's filepath.Join does not re-root, so the computed path folds under the extraction directory and passes, while the created symlink points to the attacker-specified absolute path; and for a relative Linkname sharing the destination's basename as a text prefix (e.g. ../safe-x/marker against a safe destination), strings.HasPrefix matches across the path boundary and the target resolves into a sibling directory outside the destination. The hardlink (TypeLink) branch is affected by the sibling-prefix variant. oc image extract reaches this code by calling archive.ApplyLayer() directly with a reader sourced from the remote image's layer blob, so the processed tar stream is attacker-controlled. The dangling-symlink primitive further chains into an arbitrary-content write outside the destination: a second tar entry whose name traverses the just-planted symlink is written with OpenFile(path, OCREATE|OWRONLY, …), which follows symlinks, because the per-entry name check inspects only the textual dest+Name join and never Lstats intermediate components. The general entry-name containment check in the same file is correct (it uses filepath.Rel); only the symlink/hardlink target check was left in the older, insufficient form.

Other sources

A flaw was found in the OpenShift client oc. When extracting container image layers with oc image extract, the application fails to properly sanitize symbolic and hard link targets pointing to absolute paths or to sibling directories of the extraction destination. An attacker who supplies a malicious container image can exploit this vulnerability by embedding links, and a chained file entry, that reference locations outside the intended extraction directory. This allows the attacker to write attacker-controlled content to arbitrary locations on the host filesystem with the privileges of the user running the command, potentially leading to file modification outside the destination directory.

— MITRE

Affected Software

1 affected component
Red Hat OpenShift CLI (oc)

Event History

Oct 21, 2026
Data Sourced
via Red Hat·03:38 PM
DescriptionSeverityAffected Software
Oct 22, 2026
CVE Published
via MITRE·09:12 PM
Data Sourced
via MITRE·09:12 PM
DescriptionSeverityWeakness

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203