Skip to content

Commit

Permalink
Only allow host openat(2) syscalls with O_NOFOLLOW with directfs.
Browse files Browse the repository at this point in the history
Updates the directfs seccomp filters to ensure that all openat(2) host syscalls
have O_NOFOLLOW bit set. This would ensure that we don't follow a symlink in
the host filesystem by mistake.

The gofer client currently always uses O_NOFOLLOW. But this will help prevent
any malicious usage of openat(2) if the sandbox is compromised somehow.

The container filesystem is well-isolated from the host filesystems using
pivot_root(2). So following a host symlink from sandbox context should still
not escape the container. But this provides an additional layer of security.

PiperOrigin-RevId: 523839219
  • Loading branch information
ayushr2 authored and gvisor-bot committed Apr 12, 2023
1 parent f515471 commit 114a033
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runsc/boot/filter/config.go
Expand Up @@ -416,7 +416,7 @@ func hostFilesystemFilters() seccomp.SyscallRules {
{
validFDCheck,
seccomp.MatchAny{},
seccomp.MatchAny{},
seccomp.MaskedEqual(unix.O_NOFOLLOW, unix.O_NOFOLLOW),
seccomp.MatchAny{},
},
},
Expand Down

0 comments on commit 114a033

Please sign in to comment.