Bug 1409531 (CVE-2016-9962) - CVE-2016-9962 docker: insecure opening of file-descriptor allows privilege escalation
Summary: CVE-2016-9962 docker: insecure opening of file-descriptor allows privilege es...
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2016-9962
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Trevor Jay
QA Contact:
URL:
Whiteboard:
Depends On: 1409705 1409706 1409707 1409708 1412147 1412189 1412237 1412238 1412239
Blocks: 1409535
TreeView+ depends on / blocked
 
Reported: 2017-01-02 12:23 UTC by Martin Prpič
Modified: 2021-02-17 02:50 UTC (History)
29 users (show)

Fixed In Version: docker 1.12.6
Doc Type: Bug Fix
Doc Text:
The runc component used by `docker exec` feature of docker allowed additional container processes to be ptraced by the pid 1 of the container. This allows the main processes of the container, if running as root, to gain low-level access to these new processes during initialization. An attacker can, depending on the nature of the incoming process, leverage this to elevate access to the host. This ranges from accessing host content through the file descriptors of the incoming process to, potentially, a complete container escape by leveraging memory access or syscall interception.
Clone Of:
Environment:
Last Closed: 2017-01-18 08:17:37 UTC
Embargoed:


Attachments (Terms of Use)
CVE-2016-9962 patch (12.80 KB, text/plain)
2017-01-02 12:32 UTC, Martin Prpič
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:0116 0 normal SHIPPED_LIVE Moderate: docker security, bug fix, and enhancement update 2017-01-18 01:39:43 UTC
Red Hat Product Errata RHSA-2017:0123 0 normal SHIPPED_LIVE Moderate: docker-latest security, bug fix, and enhancement update 2017-01-18 01:41:25 UTC
Red Hat Product Errata RHSA-2017:0127 0 normal SHIPPED_LIVE Moderate: runc security and bug fix update 2017-01-18 01:42:24 UTC

Description Martin Prpič 2017-01-02 12:23:40 UTC
The following issue was reported in Docker:

RunC allowed additional container processes via `runc exec` to be ptraced by the pid 1 of the container.  This allows the main processes of the container, if running as root, to gain access to file-descriptors of these new processes during the initialization and can lead to container escapes or modification of runC state before the process is fully placed inside the container.

Comment 1 Martin Prpič 2017-01-02 12:23:52 UTC
Acknowledgments:

Name: the Docker project
Upstream: Aleksa Sarai (SUSE), Tõnis Tiigi (Docker)

Comment 2 Martin Prpič 2017-01-02 12:32:26 UTC
Created attachment 1236624 [details]
CVE-2016-9962 patch

Comment 8 Trevor Jay 2017-01-03 18:35:43 UTC
This is an extremely difficult to exploit flaw on standard RHEL and Fedora systems. 

I checked the 1.10.3 and 1.12.5 builds on Brew. Both drop the `CAP_SYS_PTRACE` capability by default. 1.10.3 blacklists `ptrace` calls under the default seccomp profile. Thus, this flaw only comes into play for containers that already have elevated privileges. 

Even if `ptrace` is available. The proposed exploit scenario of quickly attaching to a process joining the container space and using its file descriptors is *not* possible under the default SELinux configuration. The containerized PID 1 will have a type of `container_t` or similar SELinux type and thus will be blocked by standard type enforcement from accessing accessing any resources that haven't already been made available to containerized processes.

Comment 12 Andrej Nemec 2017-01-11 08:58:12 UTC
Public via:

http://seclists.org/oss-sec/2017/q1/54

Comment 13 Trevor Jay 2017-01-11 15:27:11 UTC
Created runc tracking bugs for this issue:

Affects: fedora-all [bug 1412238]

Comment 15 Vincent Danen 2017-01-11 21:34:32 UTC
External References:

https://access.redhat.com/security/vulnerabilities/cve-2016-9962

Comment 16 errata-xmlrpc 2017-01-17 20:45:29 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7 Extras

Via RHSA-2017:0116 https://rhn.redhat.com/errata/RHSA-2017-0116.html

Comment 17 errata-xmlrpc 2017-01-17 20:47:16 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7 Extras

Via RHSA-2017:0123 https://rhn.redhat.com/errata/RHSA-2017-0123.html

Comment 18 errata-xmlrpc 2017-01-17 20:48:01 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7 Extras

Via RHSA-2017:0127 https://rhn.redhat.com/errata/RHSA-2017-0127.html

Comment 20 Jason Shepherd 2020-06-22 01:21:50 UTC
Mitigation:

On Red Hat systems with SELinux enabled, the dangers of even privileged containers are mitigated. SELinux prevents container processes from accessing host content even if those container processes manage to gain access to the actual file descriptors.

Comment 21 Jason Shepherd 2020-06-22 01:25:40 UTC
The impact of this vulnerability was upgraded to Important because the CAP_SYS_PTRACE capability is not required to exploit it, as previously thought.


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