You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Low] guestVolumeSource can map host paths containing ".." outside the microVM guest share #2920
In internal/ocispec/microvm.go, guestVolumeSource translates host volume bind mount sources into in-guest paths under GuestSharedDir using strings.CutPrefix followed by path.Join. It does not validate that the prefix is non-empty or check whether the trimmed relative path contains .. traversal segments, allowing paths to escape GuestSharedDir.
Because path.Join performs lexical path resolution via path.Clean, passing a hostPath such as staged.host + "/../../../../../dev/vda" succeeds in strings.CutPrefix and cleans the joined path to /dev/vda, escaping GuestSharedDir (/run/kata-containers/shared/containers).
Impact
At the unit level, an unvalidated OCI spec passed to ShapeMicroVM can map host bind mounts to arbitrary guest device or filesystem nodes outside the virtio-fs shared directory. However, in production, ShapeMicroVM is only called by cmd/ateworker-microvm/run.go on specs generated by ocispec.Build. Volume and container names are validated as DNS-1123 labels (validate.ShortName), and host directory paths are validated as clean absolute paths (resources.ValidateActorDirs), preventing traversal sequences from reaching guestVolumeSource. The issue is therefore a defense-in-depth and hardening defect rather than an exploitable vulnerability.
Suggested fix
Validate that the relative path does not escape the target directory using filepath.Rel and filepath.IsLocal (or path.IsLocal), and verify that staged.host is non-empty before prefix matching.
Activity