Skip to content

Oss scanner 9 - #2344

Open
giuseppe wants to merge 3 commits into
containers:mainfrom
giuseppe:oss-scanner-9
Open

giuseppe wants to merge 3 commits into
containers:mainfrom
giuseppe:oss-scanner-9

Conversation

@giuseppe

Copy link
Copy Markdown
Member

No description provided.

do_umount_in_a_container() called umount2() on the destination path in
the container mount namespace, following any symlink created by the
container, so a different mount could be detached.  Walk to the parent
directory with O_NOFOLLOW and unmount the last component with
UMOUNT_NOFOLLOW.

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-TH0HP1G4.

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
libcrun_make_runtime_mounts() created non-bind file systems from the
crun process on the host, so they were bound to the host namespaces
(e.g. an added proc showed the host processes) and the data options
were dropped.  Create them from a helper process that joins the
container user, PID, net, IPC and cgroup namespaces, using
open_mount_of_type() as for the mounts in the configuration.

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-ZCEYY697.

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
run_in_container_namespace() joined with setns() whatever mount
namespace the init of the container was in, so an init that called
unshare(CLONE_NEWUSER|CLONE_NEWNS) received the mount created by
`mounts add` in a namespace where it holds CAP_SYS_ADMIN and where
the MNT_LOCK_* flags are not set, and could remount it without the
ro, nosuid, nodev and noexec flags it was given.

Open /proc/<pid>/ns/mnt, get its owning user namespace with
NS_GET_USERNS, check it is the one the configuration describes, and
join the same descriptor that was checked.  `mounts remove` goes
through the same function.

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-IJ52D413.

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant