Bug 1390163 (CVE-2016-8867) - CVE-2016-8867 docker: Ambient capability usage in containers
Summary: CVE-2016-8867 docker: Ambient capability usage in containers
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2016-8867
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:
Depends On: 1851083 1390104 1849099
Blocks: 1848236
TreeView+ depends on / blocked
 
Reported: 2016-10-31 11:27 UTC by Andrej Nemec
Modified: 2022-06-24 12:52 UTC (History)
28 users (show)

Fixed In Version: docker 1.12.3
Doc Type: If docs needed, set a value
Doc Text:
The runc version as used in docker 1.12.2 was incorrectly setting ambient capabilities for all processes executed inside containers. This caused processes of non-root users to run with unexpected privileges, allowing them to escalate their privileges to root.
Clone Of:
Environment:
Last Closed: 2020-06-23 23:20:23 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:2762 0 None None None 2020-06-29 16:56:49 UTC
Red Hat Product Errata RHSA-2020:2653 0 None None None 2020-06-23 19:43:21 UTC

Description Andrej Nemec 2016-10-31 11:27:14 UTC
It was found that Docker 1.12.2 did not correctly apply user permissions in containers

Upstream bug:

https://github.com/docker/docker/issues/27590

Upstream patch:

https://github.com/docker/docker/pull/27610/commits/d60a3418d0268745dff38947bc8c929fbd24f837

Comment 1 Florian Weimer 2016-10-31 19:41:51 UTC
This seems to be the actual fix attempt:

https://github.com/opencontainers/runc/commit/a83f5bac28554fa0fd49bc1559a3c79f5907348f

The fix looks correct.  It deals with an embedded ')', as long as newer kernel versions do not add more non-escaped free-text fields at the end which could contain another ')'.

Comment 2 Antonio Murdaca 2016-10-31 20:39:37 UTC
No, the actual fix was to revert the commit which introduced ambient capabilities in runc afaict (I don't have the link handy). 

The runc version we use in projectatomic/runc in branch docker-1.12.3 contains the actual fix. 

That commit is just a fix for a panic afaict (?)

Comment 3 Florian Weimer 2016-10-31 21:01:21 UTC
(In reply to Antonio Murdaca from comment #2)
> No, the actual fix was to revert the commit which introduced ambient
> capabilities in runc afaict (I don't have the link handy). 
> 
> The runc version we use in projectatomic/runc in branch docker-1.12.3
> contains the actual fix. 
> 
> That commit is just a fix for a panic afaict (?)

Ohh, that might be the case.  I thought it might cause the process start time to be misidentified, which could be a security problem in itself because PID and start time are sometimes (ab)used as a unique ID.

Comment 4 Roel van de Kraats 2020-03-23 14:50:18 UTC
I'm not sure if this is the right place to report this, but CentOS 7.7.1908 still has this problem (with docker-common-1.13.1-108.git4ef4b30.el7.centos.x86_64). Using the test described in https://bugs.gentoo.org/show_bug.cgi?id=CVE-2016-8867 :


$ docker run --user 1000:1000 fedora sh -c 'capsh --print; echo; ls /root' 
Current: = cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap+eip
Bounding set =cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap
Ambient set =cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap
Securebits: 00/0x0/1'b0
 secure-noroot: no (unlocked)
 secure-no-suid-fixup: no (unlocked)
 secure-keep-caps: no (unlocked)
 secure-no-ambient-raise: no (unlocked)
uid=1000(???)
gid=1000(???)
groups=

anaconda-ks.cfg
anaconda-post-nochroot.log
anaconda-post.log
original-ks.cfg


Whereas the expected outcome (as run on e.g. Fedora 31 with moby-engine-18.09.8-2.ce.git0dd43dd.fc31.x86_64) is:

$ docker run --user 1000:1000 fedora sh -c 'capsh --print; echo; ls /root' 
Current: = cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap+i
Bounding set =cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap
Ambient set =
Securebits: 00/0x0/1'b0
 secure-noroot: no (unlocked)
 secure-no-suid-fixup: no (unlocked)
 secure-keep-caps: no (unlocked)
 secure-no-ambient-raise: no (unlocked)
uid=1000(???)
gid=1000(???)
groups=

ls: cannot open directory '/root': Permission denied


"Note the lack of "+eip" for capabilities and that filesystem permissions now work." (from https://bugs.gentoo.org/show_bug.cgi?id=CVE-2016-8867)

Comment 5 Roel van de Kraats 2020-03-24 08:38:05 UTC
It appears I just hit a docker version having this issue:
* docker-1.13.1-103.git7f2769b.el7.centos.x86_64 (a little older) behaves correctly
* docker-1.13.1-108.git4ef4b30.el7.centos.x86_64 (the one I reported) is faulty
* docker-1.13.1-109.gitcccb291.el7.centos.x86_64 (the latest version) already has it fixed again

Sorry to have bothered you.

Comment 11 errata-xmlrpc 2020-06-23 19:43:19 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7 Extras

Via RHSA-2020:2653 https://access.redhat.com/errata/RHSA-2020:2653

Comment 12 Product Security DevOps Team 2020-06-23 23:20:23 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2016-8867

Comment 13 Tomas Hoger 2020-06-24 09:33:27 UTC
Statement:

This issue only affected a single version of the docker packages as shipped with Red Hat Enterprise Linux 7 Extras - docker-1.13.1-108.git4ef4b30.el7. This version was released on January 8th 2020 via erratum RHBA-2020:0053 and the problem was corrected in version docker-1.13.1-109.gitcccb291.el7_7 released on February 4th 2020 via erratum RHBA-2020:0427. This CVE is listed as fixed in erratum RHSA-2020:2653 released on June 23rd 2020. However, the erratum RHSA-2020:2653 does not provide any new or improved fix compared to RHBA-2020:0427 and it was released to ensure proper visibility of the problem to users and security scanning tools, as the fix was originally releases via a non-security bug fix erratum.

The current version of OpenShift Container Platform (OCP) 3.11 is not affected because it installs the latest package from the Red Hat Enterprise Linux 7 Extras repository. If on an earlier version of OCP 3.11 be sure to update to a docker package later than 1.13.1-108.git4ef4b30.el7.


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