/

CVE-2026-85731

Severity:

HIGH RISK

(8.8)

Path Traversal (CWE-22) in oras-go OCI Layer Extraction

CVE-2026-85731

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-59

Impact:

Arbitrary File Overwrite and Potential Code Execution

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal and symlink-following flaw in oras-go layer extraction can allow a malicious OCI artifact to write files outside the intended store directory. When an attacker-controlled artifact is pulled, the issue may overwrite files writable by the extraction process and could enable code execution.

Affected context

The vulnerability affects oras-go deployments that use content/file.Store to extract OCI layers marked for unpacking. Risk arises when an attacker can supply or influence an OCI artifact and the extraction process handles archive entries involving symlinks and regular files. The impact depends on the files writable by the process performing extraction.

Exploit preconditions

  • Attack surface: OCI artifact or layer extraction through content/file.Store
  • Required access: Ability to cause the application to pull or process a malicious artifact
  • Trigger point: Extraction of an archive containing a crafted symlink chain followed by a same-named regular-file entry
  • Why exploitation is possible: Lexical path checks can treat the target as being within the extraction root while filesystem resolution follows a terminal symlink to an attacker-selected absolute path
  • Privilege dependency: The resulting overwrite is limited by the filesystem permissions of the extraction process

Why this happens

The underlying bug combines incomplete path containment checks with unsafe symlink handling during archive extraction. Validation examines paths lexically, while certain root-level entries do not receive complete parent-symlink resolution, and regular-file creation can follow a terminal symlink. This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with CWE-59: Improper Link Resolution Before File Access describing the unsafe interaction between validation and filesystem link resolution.

Potential impact

  • A malicious artifact may overwrite files outside the intended extraction directory.
  • The attacker could modify application, configuration, or startup files writable by the process.
  • The vulnerability may enable code execution when an overwritten file is later loaded or executed.
  • An affected process could suffer data loss, service disruption, or integrity compromise.
  • Broader compromise could occur if the extraction process has excessive filesystem privileges.

General mitigation guidance

Mitigation generally focuses on making archive extraction resistant to symlink-based escapes and enforcing containment against resolved filesystem paths.

Common defensive patterns include:

  • Extracting into an isolated, dedicated directory with narrowly scoped permissions.
  • Rejecting or safely neutralizing symlink and hard-link entries unless they are explicitly required.
  • Validating canonicalized paths and filesystem objects before creation or overwrite.
  • Using filesystem APIs and extraction modes that do not follow untrusted links.
  • Applying least privilege, read-only mounts, and sandboxing to the extraction process.
  • Treating externally sourced OCI artifacts as untrusted and enforcing provenance or policy checks before processing.

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules covering archive extraction, path joining, symlink creation, and file opening.
  • Code review checks for lexical-only containment validation and follows of terminal symlinks.
  • Tests using archives with nested links, root-level entries, absolute targets, and conflicting file names.
  • Runtime monitoring for writes outside designated extraction directories.
  • Policy enforcement that restricts artifact sources and blocks untrusted layers from privileged workloads.
  • Automated security review tools that flag path traversal and link-resolution patterns.

Sources

SourceLink
github.comgithub.com/oras-project/oras-go/commit/adab2f25ea95ef4e6e41f50db9266a6701399422
github.comgithub.com/oras-project/oras-go/releases/tag/v2.6.2
github.comgithub.com/oras-project/oras-go/security/advisories/GHSA-m37j-52j7-pjw7

Frequently asked

questions

It can be triggered through a remote or supply-chain path when an application pulls and extracts an attacker-controlled OCI artifact. Direct network reachability to the extraction process is not required if an attacker can influence an artifact source or registry workflow.

The attacker generally needs the ability to publish, substitute, or otherwise cause processing of a malicious OCI artifact. The files that can be overwritten are constrained by the permissions of the extracting process.

Use extraction logic that rejects unsafe links, resolves and validates filesystem paths before access, and prevents writes outside a dedicated extraction directory. Isolation and least privilege provide additional protection.

Treat archives as untrusted input, test extraction code with symlink and path-confusion cases, enforce artifact provenance policies, and monitor filesystem writes for unexpected locations.

Find out what's already
exploitable in your codebase.