highCVSS 7.1Vulnerability

CVE-2026-50163

### Root cause The tar-extraction helper `ensureLinkPath` at [`content/file/utils.go:262-275`](https://github.com/oras-project/oras-go/blob/main/content/file/utils.go#L262-L275) validates that a hardlink's target resolves inside the extract base, but then returns the original unresolved `target` string back to the caller: ```go func ensureLinkPath(baseAbs, baseRel, link, target string) (string, error) { path := target if !filepath.IsAbs(target) { path = filepath.Join(filepath.Dir(link), target) // resolved FOR VALIDATION } if _, err := resolveRelToBase(baseAbs, baseRel, path); err != nil { return "", err } return target, nil // <-- returns the ORIGINAL target, not the validated path } ``` The caller for `TypeLink` hardlinks then does: ```go case tar.TypeLink: var target string if target, err = ensureLinkPath(dirPath, dirName, filePath, header.Linkname); err == nil { err = os.Link(target, filePath) } ``` `os.Link(oldname, newname)` wraps the `link(2)` system call. From the `link(2)` man page: > oldpath and newpath are interpreted relative to the current working directory of the calling process. So when `target` (i.e., `header.Linkname`) is a **relative** path, `os.Link` resolves it against the process's **current working directory**, not against `filepath.Dir(link)` as the validation assumed. ### Attack An attacker who controls an OCI-compliant registry (or any artifact source the victim consumes via `oras pull`) crafts a tarball layer with: - A regular file: `payload.tar.gz/README.txt`. - A hardlink entry: `Typeflag=TypeLink`, `Name=payload.tar.gz/evil_cwd_link`, `Linkname="victim.secret"` (relative). and marks the layer descriptor with `io.deis.oras.content.unpack: "true"` (a standard annotation that tells `oras-go` to auto-extract). When a victim runs `oras pull` (or any Go code using `content.File`), the extraction: 1. Validates `payload.tar.gz/evil_cwd_link` — passes. 2. Calls `ensureLin

Properties

severity
high
summary
`oras-go` tar extraction: Hardlink entry with relative Linkname escapes extract dir via process CWD resolution
epss_score
0.00345
cvss_score
7.1
ghsa_published
2026-07-01T21:48:04Z
source_url
https://github.com/advisories/GHSA-fxhp-mv3v-67qp
ghsa_updated
2026-07-01T21:48:05Z
ghsa_id
GHSA-fxhp-mv3v-67qp
cve_id
CVE-2026-50163
cvss_vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
is_ghsa_only
false
epss_percentile
0.27369

Related Entities (6)

ENRICHED_BY (1)

[Source]FIRST EPSS

VULNERABLE_TO (1)

[Software]go/oras.land/oras-go/v2

AFFECTS (1)

[Software]go/oras.land/oras-go/v2

HAS_WEAKNESS (2)

[Weakness]Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
[Weakness]Improper Link Resolution Before File Access ('Link Following')

REPORTED_BY (1)

[Source]GitHub Advisory Database

Explore deeper with Ninja Signal's threat intelligence graph