Skip to content

Commit

Permalink
tests: add regression test for CVE-2019-19921 / CVE-2023-27561
Browse files Browse the repository at this point in the history
We reintroduced this once already because it is quite easy to miss this
subtle aspect of proc mounting. The recent migration to
securejoin.MkdirAllInRoot could have also inadvertently reintroduced
this (though it didn't).

Signed-off-by: Aleksa Sarai <[email protected]>
  • Loading branch information
cyphar committed Sep 13, 2024
1 parent 7c2e69f commit 457e1ff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/integration/mounts.bats
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,18 @@ function test_mount_order() {
[ "$status" -eq 0 ]
}

# CVE-2023-27561 CVE-2019-19921
@test "runc run [/proc is a symlink]" {
# Make /proc in the container a symlink.
rm -rf rootfs/proc
mkdir -p rootfs/bad-proc
ln -sf /bad-proc rootfs/proc
# This should fail.
runc run test_busybox
[ "$status" -ne 0 ]
[[ "$output" == *"must be mounted on ordinary directory"* ]]
}

@test "runc run [ro /sys/fs/cgroup mounts]" {
# Without cgroup namespace.
update_config '.linux.namespaces -= [{"type": "cgroup"}]'
Expand Down

0 comments on commit 457e1ff

Please sign in to comment.