A bug in the 32-bit compatibility layer of the ioctl handling code of the v4l2 video driver in the Linux kernel has been found. A memory protection mechanism ensuring that user-provided buffers always point to a userspace memory were disabled, allowing destination address to be in a kernel space. This flaw could be exploited by an attacker to overwrite a kernel memory from an unprivileged userspace process, leading to privilege escalation. References: http://source.android.com/security/bulletin/pixel/2017-12-01#kernel-components http://nvd.nist.gov/vuln/detail/CVE-2017-13166 An upstream fix: http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a1dfb4c48cc1e64eeb7800a27c66a6f7e88d075a
Created kernel tracking bugs for this issue: Affects: fedora-all [bug 1548413]
details of the flaw impact per upstream commit a1dfb4c48cc1: ...As a workaround, set_fs(KERNEL_DS) is called to temporarily disable this extra safety check and allow kernel pointers. However, this might introduce a security vulnerability: The result of the 32-bit to 64-bit conversion is writeable by user space because the output buffer has been allocated via compat_alloc_user_space(). A malicious user space process could then manipulate pointers inside this output buffer, and due to the previous set_fs(KERNEL_DS) call, functions like get_user() or put_user() no longer prevent kernel memory access.
This was fixed for Fedora with the 4.15.4 stable updates.
Mitigation: A systemtap script intercepting v4l2_compat_ioctl32() function of the [videodev] module and making it to return -ENOIOCTLCMD error value would work just fine, except breaking all 32bit video capturing software, but not 64bit ones. Alternatively, blacklisting [videodev] module will work too, but it will break all video capturing software.
This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2018:0676 http://access.redhat.com/errata/RHSA-2018:0676
This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2018:1062 http://access.redhat.com/errata/RHSA-2018:1062
This issue has been addressed in the following products: Red Hat Enterprise MRG 2 Via RHSA-2018:1170 http://access.redhat.com/errata/RHSA-2018:1170
This issue has been addressed in the following products: Red Hat Enterprise Linux 7.4 Extended Update Support Via RHSA-2018:1130 http://access.redhat.com/errata/RHSA-2018:1130
This issue has been addressed in the following products: Red Hat Enterprise Linux 6 Via RHSA-2018:1319 http://access.redhat.com/errata/RHSA-2018:1319
This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2018:2948 http://access.redhat.com/errata/RHSA-2018:2948