Bugzilla – Bug 1134561
VUL-0: CVE-2019-2054: kernel-source: possible seccomp bypass due to seccomp policies that allow the use of ptrace
Last modified: 2021-01-18 07:44:31 UTC
In the seccomp implementation prior to kernel version 4.8, there is a possible
seccomp bypass due to seccomp policies that allow the use of ptrace. This could
lead to local escalation of privilege with no additional execution privileges
needed. User interaction is not needed for exploitation. Product: Android
Versions: Android kernel Android ID: A-119769499
Kees Cook <email@example.com>
Subject: [PATCH 00/14] run seccomp after ptrace
Date: Thu, 9 Jun 2016 14:01:50 -0700
Cc: Kees Cook <firstname.lastname@example.org>, Andy Lutomirski <email@example.com>, Benjamin Herrenschmidt <firstname.lastname@example.org>, Catalin Marinas <email@example.com>, Chris Metcalf <firstname.lastname@example.org>, Heiko Carstens <email@example.com>, Helge Deller <firstname.lastname@example.org>, "James E.J. Bottomley" <email@example.com>, James Hogan <firstname.lastname@example.org>, Jeff Dike <email@example.com>, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, "Maciej W. Rozycki" <firstname.lastname@example.org>, Mark Rutland <email@example.com>, Martin Schwidefsky <firstname.lastname@example.org>, Michael Ellerman <email@example.com>, Paul Mackerras <firstname.lastname@example.org>, Ralf Baechle <email@example.com>, Richard Weinberger <firstname.lastname@example.org>, Russell King <email@example.com>, firstname.lastname@example.org, Will Deacon <email@example.com>, firstname.lastname@example.org
There has been a long-standing (and documented) issue with seccomp
where ptrace can be used to change a syscall out from under seccomp.
This is a problem for containers and other wider seccomp filtered
environments where ptrace needs to remain available, as it allows
for an escape of the seccomp filter.
Since the ptrace attack surface is available for any allowed syscall,
moving seccomp after ptrace doesn't increase the actually available
attack surface. And this actually improves tracing since, for
example, tracers will be notified of syscall entry before seccomp
sends a SIGSYS, which makes debugging filters much easier.
The per-architecture changes do make one (hopefully small)
semantic change, which is that since ptrace comes first, it may
request a syscall be skipped. Running seccomp after this doesn't
make sense, so if ptrace wants to skip a syscall, it will bail
out early similarly to how seccomp was. This means that skipped
syscalls will not be fed through audit, though that likely means
we're actually avoiding noise this way.
This series first cleans up seccomp to remove the now unneeded
two-phase entry, fixes the SECCOMP_RET_TRACE hole (same as the
ptrace hole above), and then reorders seccomp after ptrace on
has some reference code and descriptions
The actually merged patches are 14 commits between 58d0a862f573c3354fa912603ef5a4db188774e7 and 26703c636c1f3272b39bd0f6d04d2e970984f1b6
The patchset touches and modifies the two-phase syscall entries heavily:
Miroslav, would you or your team can take a look at these changes?
I could take a look for sure, but I think there may be more suitable person in our team (Boris perhaps?). Michal?
bin/addnote CVE-2019-2054 "Due to complexity and high risk backport, we currently will not backport this issue for SUSE Linux Enterprise 12 SP3 and older products. When using seccomp we recommend also to not to allow ptrace when using seccomp."