High severity8.1OSV Advisory· Published Sep 5, 2025· Updated Apr 19, 2026
CVE-2025-9566
CVE-2025-9566
Description
There's a vulnerability in podman where an attacker may use the kube play command to overwrite host files when the kube file container a Secrete or a ConfigMap volume mount and such volume contains a symbolic link to a host file path. In a successful attack, the attacker can only control the target file to be overwritten but not the content to be written into the file.
Binary-Affected: podman Upstream-version-introduced: v4.0.0 Upstream-version-fixed: v5.6.1
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
github.com/containers/podman/v5Go | < 5.6.1 | 5.6.1 |
github.com/containers/podman/v4Go | <= 4.9.5 | — |
Affected products
1- Range: v0.2, v0.2.1, v0.8.2
Patches
143fbde4e665fkube play: don't follow volume symlinks onto the host
4 files changed · +71 −4
pkg/domain/infra/abi/play.go+2 −3 modified@@ -810,8 +810,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY defaultMode := v.DefaultMode // Create files and add data to the volume mountpoint based on the Items in the volume for k, v := range v.Items { - dataPath := filepath.Join(mountPoint, k) - f, err := os.Create(dataPath) + f, err := openPathSafely(mountPoint, k) if err != nil { return nil, nil, fmt.Errorf("cannot create file %q at volume mountpoint %q: %w", k, mountPoint, err) } @@ -821,7 +820,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY return nil, nil, err } // Set file permissions - if err := os.Chmod(f.Name(), os.FileMode(defaultMode)); err != nil { + if err := f.Chmod(os.FileMode(defaultMode)); err != nil { return nil, nil, err } }
pkg/domain/infra/abi/play_linux.go+18 −0 added@@ -0,0 +1,18 @@ +//go:build !remote + +package abi + +import ( + "os" + + securejoin "github.com/cyphar/filepath-securejoin" +) + +// openSymlinkPath opens the path under root using securejoin.OpenatInRoot(). +func openSymlinkPath(root *os.File, unsafePath string, flags int) (*os.File, error) { + file, err := securejoin.OpenatInRoot(root, unsafePath) + if err != nil { + return nil, err + } + return securejoin.Reopen(file, flags) +}
pkg/domain/infra/abi/play_unsupported.go+13 −0 added@@ -0,0 +1,13 @@ +//go:build !linux && !remote + +package abi + +import ( + "errors" + "os" +) + +// openSymlinkPath is not supported on this platform. +func openSymlinkPath(root *os.File, unsafePath string, flags int) (*os.File, error) { + return nil, errors.New("cannot safely open symlink on this platform") +}
pkg/domain/infra/abi/play_utils.go+38 −1 modified@@ -2,7 +2,14 @@ package abi -import "github.com/containers/podman/v5/libpod/define" +import ( + "fmt" + "os" + "strings" + + "github.com/containers/podman/v5/libpod/define" + "golang.org/x/sys/unix" +) // getSdNotifyMode returns the `sdNotifyAnnotation/$name` for the specified // name. If name is empty, it'll only look for `sdNotifyAnnotation`. @@ -16,3 +23,33 @@ func getSdNotifyMode(annotations map[string]string, name string) (string, error) } return mode, define.ValidateSdNotifyMode(mode) } + +// openPathSafely opens the given name under the trusted root path, the unsafeName +// must be a single path component and not contain "/". +// The resulting path will be opened or created if it does not exists. +// Following of symlink is done within staying under root, escapes outsides +// of root are not allowed and prevent. +// +// This custom function is needed because securejoin.SecureJoin() is not race safe +// and the volume might be mounted in another container that could swap in a symlink +// after the function ahs run. securejoin.OpenInRoot() doesn't work either because +// it cannot create files and doesn't work on freebsd. +func openPathSafely(root, unsafeName string) (*os.File, error) { + if strings.Contains(unsafeName, "/") { + return nil, fmt.Errorf("name %q must not contain path separator", unsafeName) + } + fdDir, err := os.OpenFile(root, unix.O_RDONLY, 0) + if err != nil { + return nil, err + } + defer fdDir.Close() + flags := unix.O_CREAT | unix.O_WRONLY | unix.O_TRUNC | unix.O_CLOEXEC + fd, err := unix.Openat(int(fdDir.Fd()), unsafeName, flags|unix.O_NOFOLLOW, 0o644) + if err == nil { + return os.NewFile(uintptr(fd), unsafeName), nil + } + if err == unix.ELOOP { + return openSymlinkPath(fdDir, unsafeName, flags) + } + return nil, &os.PathError{Op: "openat", Path: unsafeName, Err: err} +}
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
32- github.com/advisories/GHSA-wp3j-xq48-xpjwghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-9566ghsaADVISORY
- access.redhat.com/errata/RHBA-2025:15692nvdWEB
- access.redhat.com/errata/RHBA-2025:15712nvdWEB
- access.redhat.com/errata/RHBA-2025:16158nvdWEB
- access.redhat.com/errata/RHBA-2025:16163nvdWEB
- access.redhat.com/errata/RHEA-2025:4782nvdWEB
- access.redhat.com/errata/RHSA-2025:15900nvdWEB
- access.redhat.com/errata/RHSA-2025:15901nvdWEB
- access.redhat.com/errata/RHSA-2025:15904nvdWEB
- access.redhat.com/errata/RHSA-2025:16480nvdWEB
- access.redhat.com/errata/RHSA-2025:16481nvdWEB
- access.redhat.com/errata/RHSA-2025:16482nvdWEB
- access.redhat.com/errata/RHSA-2025:16488nvdWEB
- access.redhat.com/errata/RHSA-2025:16515nvdWEB
- access.redhat.com/errata/RHSA-2025:16724nvdWEB
- access.redhat.com/errata/RHSA-2025:17669nvdWEB
- access.redhat.com/errata/RHSA-2025:18217nvdWEB
- access.redhat.com/errata/RHSA-2025:18218nvdWEB
- access.redhat.com/errata/RHSA-2025:18240nvdWEB
- access.redhat.com/errata/RHSA-2025:19002nvdWEB
- access.redhat.com/errata/RHSA-2025:19041nvdWEB
- access.redhat.com/errata/RHSA-2025:19046nvdWEB
- access.redhat.com/errata/RHSA-2025:19094nvdWEB
- access.redhat.com/errata/RHSA-2025:19894nvdWEB
- access.redhat.com/errata/RHSA-2025:20909nvdWEB
- access.redhat.com/errata/RHSA-2025:20983nvdWEB
- access.redhat.com/errata/RHSA-2026:8211nvdWEB
- access.redhat.com/security/cve/CVE-2025-9566nvdWEB
- bugzilla.redhat.com/show_bug.cginvdWEB
- github.com/containers/podman/commit/43fbde4e665fe6cee6921868f04b7ccd3de5ad89nvdWEB
- github.com/containers/podman/security/advisories/GHSA-wp3j-xq48-xpjwnvdWEB
News mentions
0No linked articles in our index yet.