{"id":"CVE-2026-42574","aliases":["CVE-2026-42574","GHSA-qq3r-w4hj-gjp6","GO-2026-5589"],"related":[],"kind":"vulnerability","state":"published","title":"apko dirFS has a symlink-following path traversal that allows multiple entry points to escape the build root","summary":"apko allows users to build and publish OCI container images built from apk packages. From version 0.14.8 to before version 1.2.5, a crafted .apk could install a TypeSymlink tar entry whose target pointed outside the build root, and a subsequent directory-creation or file-write entry in the same or later archive could traverse that symlink to reach host paths the build user could write to. This issue has been patched in version 1.2.5.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"apko allows users to build and publish OCI container images built from apk packages. From version 0.14.8 to before version 1.2.5, a crafted .apk could install a TypeSymlink tar entry whose target pointed outside the build root, and a subsequent directory-creation or file-write entry in the same or later archive could traverse that symlink to reach host paths the build user could write to. This issue has been patched in version 1.2.5.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nA crafted `.apk` could install a `TypeSymlink` tar entry whose target pointed outside the build root, and a subsequent directory-creation or file-write entry in the same or later archive could traverse that symlink to reach host paths the build user could write to. The root cause was the `sanitizePath` helper in `pkg/apk/fs/rwosfs.go`, which rejected only lexical `..` traversal and did not resolve or refuse symlinks. Every disk-backed `DirFS` method that handed its caller-supplied path to a symlink-following stdlib call — `ReadFile`, `WriteFile`, `Chmod`, `Chown`, `Chtimes`, `MkdirAll`, `Mkdir`, and `Mknod` — was affected. The reachable primitive from a malicious APK during tar extraction is the `MkdirAll` / `Mkdir` / `WriteFile` chain via `apko build-cpio` and disk-backed consumers such as `melange`; the remaining sinks are reachable by direct callers of the `pkg/apk/fs` package. The in-memory `tarfs` install path used by `apko build`, `apko publish`, and `apko build-minirootfs` is not affected.\n\n### Patches\n\nFixed in apko **v1.2.5** by [#2187](https://github.com/chainguard-dev/apko/pull/2187) / commit [f5a96e1](https://github.com/chainguard-dev/apko/commit/f5a96e1299ac81c7ea9441705ec467688086f442), which scopes all `DirFS` operations through a Go 1.24 `*os.Root`. The `sanitizePath` helper has been removed; `*os.Root` refuses traversal via `..`, absolute-target symlinks, relative-target symlinks, and hardlinks by construction. Regression tests in `pkg/apk/apk/path_traversal_test.go` cover each composite primitive.\n\n### Workarounds\n\nNo complete workaround. Operators running pre-1.2.5 apko (or downstream tools such as melange that embed pre-1.2.5 `pkg/apk/fs`) should upgrade. Consuming only APKs from trusted, signed sources reduces but does not eliminate exposure.\n\n### Resources\n\n- https://github.com/chainguard-dev/apko/pull/2187\n- https://github.com/chainguard-dev/apko/commit/f5a96e1299ac81c7ea9441705ec467688086f442\n- https://github.com/chainguard-dev/apko/releases/tag/v1.2.5\n- Related: GHSA-5g94-c2wx-8pxw (CVE-2026-25121) — prior lexical `..` traversal fix\n\n### Credits\n\napko thanks Oleh Konko ([@1seal](https://github.com/1seal) from [1seal.org](https://1seal.org/)) for the initial report of the symlink-escape class, and to [@Xh081iX](https://github.com/Xh081iX) for a follow-up set of reports covering additional reachable primitives (`ReadFile`, `Chmod`/`Chown`, `Mknod`, `MkdirAll`/`Mkdir`) that shaped the comprehensive fix.","format":"markdown","source":"ghsa"},{"lang":"en","text":"apko dirFS has a symlink-following path traversal that allows multiple entry points to escape the build root in chainguard.dev/apko","format":"markdown","source":"go"},{"lang":"es","text":"apko permite a los usuarios construir y publicar imágenes de contenedor OCI creadas a partir de paquetes apk. Desde la versión 0.14.8 hasta antes de la versión 1.2.5, un .apk manipulado podría instalar una entrada tar TypeSymlink cuyo objetivo apuntaba fuera de la raíz de construcción, y una entrada posterior de creación de directorio o escritura de archivo en el mismo archivo o en uno posterior podría atravesar ese enlace simbólico para alcanzar rutas del host a las que el usuario de construcción podría escribir. Este problema ha sido parcheado en la versión 1.2.5.","source":"nvd"}],"published":"2026-05-04T21:26:47.000Z","modified":"2026-09-10T03:51:06.920Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-22","CWE-59"],"affected":[{"ranges":[{"version":">= 0.14.8, < 1.2.5","status":"affected"}],"vendor":"chainguard-dev","product":"apko","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.14.8","status":"affected","fixed":"1.2.5"}],"ecosystem":"Go","package":"chainguard.dev/apko","purl":"pkg:golang/chainguard.dev/apko","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.14.8","status":"affected","fixed":"1.2.5"}],"ecosystem":"Go","package":"chainguard.dev/apko","purl":"pkg:golang/chainguard.dev/apko","source":"go"}],"references":[{"url":"https://github.com/chainguard-dev/apko/security/advisories/GHSA-qq3r-w4hj-gjp6","tags":["advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/chainguard-dev/apko/pull/2187","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/chainguard-dev/apko/commit/f5a96e1299ac81c7ea9441705ec467688086f442","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/chainguard-dev/apko/releases/tag/v1.2.5","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42574","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/chainguard-dev/apko","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-05-11T17:09:56.626Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-42574","url":"https://www.cve.org/CVERecord?id=CVE-2026-42574","licence":"CVE Terms of Use","modified":"2026-05-11T17:11:40.244Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-qq3r-w4hj-gjp6","url":"https://github.com/advisories/GHSA-qq3r-w4hj-gjp6","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:06.920Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5589","url":"https://pkg.go.dev/vuln/GO-2026-5589","licence":"CC-BY-4.0","modified":"2026-06-25T23:01:32.637Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-42574","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42574","licence":"Public domain","modified":"2026-07-24T21:10:00.143Z"}],"updatedAt":"2026-11-25T22:59:21.153Z","epss":{"score":0.00513,"percentile":0.37018,"date":"2026-11-30T12:00:22.000Z"}}