-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle seccomp policies that don't include ptrace(2) #846
Comments
RequirementsOur solution must take into account the following:
On (1), we have verified that none of the systems we support has Linux kernel < 4.8. This applies also to Windows (WSL2) and macOS (HyperKit). On (2), we have seen that the default SolutionFor Podman versions < 4, we already have a workaround in our code that starts the process with Podman's default seccomp policy as of June 6th, 2024 (see dangerzone/dangerzone/isolation_provider/container.py Lines 117 to 119 in c2a47ec
For Docker Desktop, we have not a similar workaround, because we don't know exactly when was this restriction lifted. We do know that Containerd 1.6.7 first allowed the So, our suggestion is to:
This way, older releases will use our Podman seccomp policy, which will guarantee that Newer releases will use their default seccomp policy, and thus we will not mask any security-related fixes that happen in the future. AlternativesDocker also allows the dangerzone/dangerzone/isolation_provider/container.py Lines 123 to 124 in c2a47ec
Why is that? Because using the For this reason, we choose not to go down that path, and simply pass our own seccomp policy. |
It seems that
We can use the Docker Engine version instead:
Most likely, we can consider anything greater than 25.0 as safe. |
We are aware that some Docker Desktop releases before 25.0.0 ship with a seccomp policy which disables the `ptrace(2)` system call. In such cases, we opt to use our own seccomp policy which allows this system call. This seccomp policy is the default one in the latest releases of Podman, and we use it in Linux distributions where Podman version is < 4.0. Fixes #846
Based on discussions in #865, we will actually enforce this seccomp policy across all container engines. There are two reasons for doing so:
|
Problem
Our recent gVisor integration (#590) requires allowlisting the
ptrace(2)
system call in the outer container, in order to spawn the inner container withrunsc
. Nowadays, this is the default [1], but we have encountered systems that don't allow this system call, and thus Dangerzone cannot run in them, at least out of the box.Affected systems are:
runc
version 1.1.5Background
Before explaining how we plan to fix this issue, we'll give some background on the
ptrace(2)
system call.First of all, why is this syscall dangerous in the first place? The main reason is that a malicious process can use it in order to escalate its privileges, or thwart some system protections. A real-life example is CVE-2019-2054. This CVE is the reason why
ptrace(2)
is not allowed in Linux kernels < 4.8, but it's not the only ptrace-related CVE that has been reported.In order to control the scope of
ptrace(2)
system call, the Linux kernel offers the following mechanisms:CAP_SYS_PTRACE
Linux capability. If this capability is enabled, then the process can have full tracing capabilities, such as tracing other processes that it has not started. If this capability is not granted, then the usage ofptrace(2)
is still allowed, but restricted through the mechanisms listed below.ptrace(2)
in their seccomp policy, and then re-enabled it for kernels >= 4.8.ptrace_scope
setting. This setting controls the behavior ofptrace(2)
system-wide. In the Linux platforms we support, the default seems to be1
, i.e., allowptrace(2)
only for processes that the parent has direct relationship with (e.g., child processes).[1] See Podman's seccomp policy, Docker's seccomp policy, and
containerd
's seccomp policy.The text was updated successfully, but these errors were encountered: