Bug 1548412 (CVE-2017-13166) - CVE-2017-13166 kernel: v4l2: disabled memory access protection mechanism allowing privilege escalation
Summary: CVE-2017-13166 kernel: v4l2: disabled memory access protection mechanism allo...
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2017-13166
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard: impact=important,public=20170720,repo...
Depends On: 1548413 1548429 1548430 1548431 1548432 1548726 1548727 1548728 1550058 1550059 1550060
Blocks: 1548415
TreeView+ depends on / blocked
 
Reported: 2018-02-23 12:43 UTC by Vladis Dronov
Modified: 2019-06-11 11:13 UTC (History)
20 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
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.
Clone Of:
Environment:
Last Closed: 2019-06-08 03:41:04 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:0676 None None None 2018-04-10 08:19:53 UTC
Red Hat Product Errata RHSA-2018:1062 None None None 2018-04-10 09:43:59 UTC
Red Hat Product Errata RHSA-2018:1130 None None None 2018-04-17 16:24:06 UTC
Red Hat Product Errata RHSA-2018:1170 None None None 2018-04-17 15:33:31 UTC
Red Hat Product Errata RHSA-2018:1319 None None None 2018-05-08 18:59:50 UTC
Red Hat Product Errata RHSA-2018:2948 None None None 2018-10-30 08:58:11 UTC

Description Vladis Dronov 2018-02-23 12:43:00 UTC
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:

https://source.android.com/security/bulletin/pixel/2017-12-01#kernel-components

https://nvd.nist.gov/vuln/detail/CVE-2017-13166

An upstream fix:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a1dfb4c48cc1e64eeb7800a27c66a6f7e88d075a

Comment 1 Vladis Dronov 2018-02-23 12:43:43 UTC
Created kernel tracking bugs for this issue:

Affects: fedora-all [bug 1548413]

Comment 2 Vladis Dronov 2018-02-23 12:53:23 UTC
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.

Comment 6 Justin M. Forbes 2018-02-23 15:17:37 UTC
This was fixed for Fedora with the 4.15.4 stable updates.

Comment 9 Vladis Dronov 2018-02-28 12:18:04 UTC
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.

Comment 12 errata-xmlrpc 2018-04-10 08:19:44 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2018:0676 https://access.redhat.com/errata/RHSA-2018:0676

Comment 13 errata-xmlrpc 2018-04-10 09:43:49 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2018:1062 https://access.redhat.com/errata/RHSA-2018:1062

Comment 14 errata-xmlrpc 2018-04-17 15:33:19 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise MRG 2

Via RHSA-2018:1170 https://access.redhat.com/errata/RHSA-2018:1170

Comment 15 errata-xmlrpc 2018-04-17 16:23:55 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7.4 Extended Update Support

Via RHSA-2018:1130 https://access.redhat.com/errata/RHSA-2018:1130

Comment 16 errata-xmlrpc 2018-05-08 18:59:41 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 6

Via RHSA-2018:1319 https://access.redhat.com/errata/RHSA-2018:1319

Comment 17 errata-xmlrpc 2018-10-30 08:58:01 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2018:2948 https://access.redhat.com/errata/RHSA-2018:2948


Note You need to log in before you can comment on or make changes to this bug.