{"id":"CVE-2026-50162","aliases":["CVE-2026-50162","GHSA-8xwf-rjm4-xvhv","GO-2026-5879"],"related":[],"kind":"vulnerability","state":"published","title":"oras-go: file store write outside workingDir via symlink traversal","summary":"oras-go is a Go library for managing OCI artifacts. Prior to 2.6.1, resolveWritePath() in content/file/file.go uses a lexical filepath.Rel check for workingDir and does not account for symlink traversal, so when AllowPathTraversalOnWrite=false an attacker-controlled blob title through ocispec.AnnotationTitle such as out/pwn.txt can follow a workingDir symlink out -> /some/outside/dir and cause pushFile() to create /some/outside/dir/pwn.txt outside workingDir. This issue is fixed in version 2.6.1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"oras-go is a Go library for managing OCI artifacts. Prior to 2.6.1, resolveWritePath() in content/file/file.go uses a lexical filepath.Rel check for workingDir and does not account for symlink traversal, so when AllowPathTraversalOnWrite=false an attacker-controlled blob title through ocispec.AnnotationTitle such as out/pwn.txt can follow a workingDir symlink out -> /some/outside/dir and cause pushFile() to create /some/outside/dir/pwn.txt outside workingDir. This issue is fixed in version 2.6.1.","source":"cvelist"},{"lang":"en","text":"The file content store in `oras-go` attempts to confine writes to `workingDir` when `AllowPathTraversalOnWrite=false`, but the guard is lexical and does not account for symlink traversal. If `workingDir` contains a symlink path component and an attacker-controlled blob title (via `ocispec.AnnotationTitle`) targets a path under that symlink, `pushFile()` can create a file outside `workingDir`.\n\n## relevant links\n\n- repository: https://github.com/oras-project/oras-go\n- commit: 03243809936cce826494b5506f724c6dc11115b1\n- callsite: content/file/file.go:609 `resolveWritePath()` (used by `pushFile()`)\n\n## vulnerability details\n\n**pins:** oras-project/oras-go@03243809936cce826494b5506f724c6dc11115b1\n\n**as-of:** 2026-02-17\n\n**policy:** GitHub Security Advisory (oras-project/oras-go)\n\n**callsite:** content/file/file.go:609 `resolveWritePath()` → `pushFile()`\n\n**attacker control:** Attacker controls the pushed name (`ocispec.AnnotationTitle`) and can select a path with a symlink path component under `workingDir` → `resolveWritePath()` blocks `..` via `filepath.Rel` but does not prevent symlink traversal → `pushFile()` opens/creates the final path and follows the symlink → a file is created outside `workingDir`\n\n### root cause\n\n`resolveWritePath()` enforces the write boundary using a `filepath.Rel`-style check against `workingDir`. This prevents `../` escapes but is purely lexical and does not resolve symlinks. If a path component under `workingDir` is a symlink to an external location, the subsequent filesystem operation in `pushFile()` follows that symlink and performs the write outside `workingDir` while still passing the lexical boundary check.\n\n### attack path\n\n1. Attacker provides a blob title (via `ocispec.AnnotationTitle`) that contains a path like `out/pwn.txt`.\n2. Victim uses `oras-go` file store with `AllowPathTraversalOnWrite=false` and a `workingDir` that contains a symlink directory `out -> /some/outside/dir`.\n3. The lexical boundary check accepts `out/pwn.txt` as being under `workingDir`.\n4. The write follows the symlink and creates `/some/outside/dir/pwn.txt`.\n\n## impact\n\nThis is a filesystem boundary bypass that permits writes outside `workingDir` when a symlink path component exists under `workingDir`. The concrete security impact depends on the runtime environment (what filesystem locations are writable by the process and what downstream consumers do with the written file), but the intended confinement guarantee is violated.\n\n## proof of concept\n\nthe attached `poc.zip` contains a small, self-contained go harness that demonstrates:\n\n- canonical (vulnerable): prints `[CALLSITE_HIT]` and `[PROOF_MARKER]` and shows the file is created outside `workingDir`\n- control (no symlink component): prints `[NC_MARKER]` and confirms no outside write occurs\n\nrun:\n\n```bash\nunzip -q -o poc.zip -d /tmp\ncd /tmp/poc-F-ORAS-SYMLINK-WRITE-001\nmake test\n```\n\n**expected:** when `AllowPathTraversalOnWrite=false`, file store writes should not be able to escape `workingDir`, including via symlink traversal.\n\n**actual:** A symlink path component under `workingDir` allows writes to escape `workingDir` even when `AllowPathTraversalOnWrite=false`.\n\n## recommended fix\n\nensure confinement checks account for symlink traversal. Options include rejecting symlinks in any path component (walk components with `os.Lstat`), validating the resolved parent directory via `EvalSymlinks` and enforcing it remains under the resolved `workingDir`, or using an `openat()`-style approach so the check and open happen relative to a trusted directory file descriptor.\n\n**fix accepted when:** The canonical PoC no longer prints `[PROOF_MARKER]` for the same attacker-controlled inputs.\n\n\ncheers,\nOleh","format":"markdown","source":"ghsa"},{"lang":"en","text":"Oras-go: File store write outside workingDir via symlink traversal in oras.land/oras-go","format":"markdown","source":"go"},{"lang":"es","text":"oras-go es una biblioteca Go para gestionar artefactos OCI. Antes de la versión 2.6.1, resolveWritePath() en content/file/file.go utiliza una comprobación léxica de filepath.Rel para workingDir y no tiene en cuenta el recorrido de enlaces simbólicos, por lo que cuando AllowPathTraversalOnWrite=false un título de blob controlado por el atacante a través de ocispec.AnnotationTitle como out/pwn.txt puede seguir un enlace simbólico de workingDir out   ->   /some/outside/dir y hacer que pushFile() cree /some/outside/dir/pwn.txt fuera de workingDir. Este problema se ha solucionado en la versión 2.6.1.","source":"nvd"}],"published":"2026-07-01T21:43:10.000Z","modified":"2026-10-24T20:10:00.137Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","score":6.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","score":6.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"}],"cwes":["CWE-73"],"affected":[{"ranges":[{"version":"< 2.6.1","status":"affected"}],"vendor":"oras-project","product":"oras-go","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.6.1"}],"ecosystem":"Go","package":"oras.land/oras-go/v2","purl":"pkg:golang/oras.land/oras-go/v2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.6.1"}],"ecosystem":"Go","package":"oras.land/oras-go/v2","purl":"pkg:golang/oras.land/oras-go/v2","source":"go"}],"references":[{"url":"https://github.com/oras-project/oras-go/security/advisories/GHSA-8xwf-rjm4-xvhv","tags":["advisory","exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/oras-project/oras-go/commit/cc323e564d90c6b5b4bdd71d3c8d2ee2713b37e5","tags":["fix","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/oras-project/oras-go/releases/tag/v2.6.1","tags":["x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/oras-project/oras-go","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-07-20T18:18:39.453Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-50162","url":"https://www.cve.org/CVERecord?id=CVE-2026-50162","licence":"CVE Terms of Use","modified":"2026-07-20T18:18:44.172Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8xwf-rjm4-xvhv","url":"https://github.com/advisories/GHSA-8xwf-rjm4-xvhv","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:11.102Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5879","url":"https://pkg.go.dev/vuln/GO-2026-5879","licence":"CC-BY-4.0","modified":"2026-07-24T19:00:26.723Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-50162","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-50162","licence":"Public domain","modified":"2026-10-24T20:10:00.137Z"}],"updatedAt":"2026-11-25T22:59:28.539Z","epss":{"score":0.00437,"percentile":0.39724,"date":"2026-12-01T12:00:22.000Z"}}