Bug 2066845 (CVE-2022-27650)

Summary: CVE-2022-27650 crun: Default inheritable capabilities for linux container should be empty
Product: [Other] Security Response Reporter: Pedro Sampaio <psampaio>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: amctagga, bmontgom, container-sig, eparis, gscrivan, jburrell, jokerman, lsm5, nstielau, pehunt, rh.container.bot, security-response-team, sponnaga, vkumar
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: crun 1.4.4 Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in crun where containers were incorrectly started with non-empty default permissions. A vulnerability was found in Moby (Docker Engine) where containers were started incorrectly with non-empty inheritable Linux process capabilities. This flaw allows an attacker with access to programs with inheritable file capabilities to elevate those capabilities to the permitted set when execve(2) runs.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-12 00:47:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2067561, 2067562, 2067563, 2067564, 2067565, 2067566, 2067567, 2067568, 2067569, 2067570, 2067571, 2067572, 2067573, 2067574, 2067575, 2067576, 2067577, 2067578, 2067579, 2067580, 2070116, 2070117    
Bug Blocks: 2064591, 2070128    

Description Pedro Sampaio 2022-03-22 15:35:51 UTC
A bug was found in Moby (Docker Engine) where containers were incorrectly started with non-empty inheritable Linux process capabilities, creating an atypical Linux environment and enabling programs with inheritable file capabilities to elevate those capabilities to the permitted set during execve(2). Normally, when executable programs have specified permitted file capabilities, otherwise unprivileged users and processes can execute those programs and gain the specified file capabilities up to the bounding set. Due to this bug, containers which included executable programs with inheritable file capabilities allowed otherwise unprivileged users and processes to additionally gain these inheritable file capabilities up to the container's bounding set. Containers which use Linux users and groups to perform privilege separation inside the container are most directly impacted.

This bug did not affect the container security sandbox as the inheritable set never contained more capabilities than were included in the container's bounding set.

Patches
This bug has been fixed in Moby (Docker Engine) 20.10.14. Users should update to this version as soon as possible. Running containers should be stopped, deleted, and recreated for the inheritable capabilities to be reset.

This fix changes Moby (Docker Engine) behavior such that containers are started with a more typical Linux environment. Refer to capabilities(7) for a description of how capabilities work. Note that permitted file capabilities continue to allow for privileges to be raised up to the container's bounding set and that processes may add capabilities to their own inheritable set up to the container's bounding set per the rules described in the manual page. In all cases the container's bounding set provides an upper bound on the capabilities that can be assumed and provides for the container security sandbox.

Workarounds
The entrypoint of a container can be modified to use a utility like capsh(1) to drop inheritable capabilities prior to the primary process starting.

Comment 3 Avinash Hanwate 2022-03-30 12:40:07 UTC
Created crun tracking bugs for this issue:

Affects: fedora-all [bug 2070116]

Comment 7 errata-xmlrpc 2022-05-10 13:18:14 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2022:1762 https://access.redhat.com/errata/RHSA-2022:1762

Comment 8 errata-xmlrpc 2022-05-10 13:27:01 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2022:1793 https://access.redhat.com/errata/RHSA-2022:1793

Comment 9 Product Security DevOps Team 2022-05-12 00:47:42 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-2022-27650

Comment 10 Sage McTaggart 2022-11-23 20:01:50 UTC
This is a high complexity attack, as an attacker must elevate the capabilities at a specific point (when execve(2) runs), and thus know when processes are running. By modifying the permissions, one can impact CIA, but it depends on how the attacker modifies the permissions, thus a low impact, since not automatically root, and one would need a container with higher permissions to be inherited, which is not a best practice.